Believe it or not, it is possible to have Linux without GLX.
Set PIGLIT_HAS_GLX only if glproto is found.

Otherwise, an egl only linux system would fail to build
piglit_x11_framework, since it could not find <GL/glx.h>.

Note that if PIGLIT_BUILD_GLX_TESTS option is selected, then
GLX (glproto) is REQUIRED, and the build will fail if it isn't
found.  Otherwise, we still look for glproto, and set HAS_GLX iff
GLPROTO_FOUND.

Signed-off-by: Daniel Kurtz <[email protected]>
---
 CMakeLists.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01b8ec7..3943d86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,9 +100,6 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
        set(PIGLIT_HAS_X11 True)
        add_definitions(-DPIGLIT_HAS_X11)
 
-       set(PIGLIT_HAS_GLX True)
-       add_definitions(-DPIGLIT_HAS_GLX)
-
        pkg_check_modules(LIBDRM QUIET libdrm)
        pkg_check_modules(LIBDRM_INTEL QUIET libdrm_intel)
        pkg_check_modules(XCB_DRI2 QUIET xcb-dri2)
@@ -145,8 +142,15 @@ endif()
 
 IF(PIGLIT_BUILD_GLX_TESTS)
        pkg_check_modules(GLPROTO REQUIRED glproto)
+ELSE()
+       pkg_check_modules(GLPROTO QUIET glproto)
 ENDIF()
 
+if(GLPROTO_FOUND)
+       set(PIGLIT_HAS_GLX True)
+       add_definitions(-DPIGLIT_HAS_GLX)
+endif()
+
 # Check for presence of Python 2.6 or greater.
 foreach(python_cmd python2 python)
        execute_process(
-- 
1.8.5.2

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to