[Piglit] [PATCH 4/4] cmake: check for glproto headers

nobled nobled at dreamwidth.org
Tue Feb 28 14:06:32 PST 2012


And error out when they're not found, rather than failing to
compile later when GL/glxproto.h can't be found.
---
 CMakeLists.txt                                     |    2 ++
 tests/glx/CMakeLists.gl.txt                        |    1 +
 .../spec/glx_arb_create_context/CMakeLists.gl.txt  |    3 +++
 .../spec/glx_ext_import_context/CMakeLists.gl.txt  |    3 +++
 tests/util/CMakeLists.gl.txt                       |    9 +++++++++
 5 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d56fd8c..c0f0998 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ INCLUDE (CheckCCompilerFlag)
 INCLUDE (CheckCXXCompilerFlag)
 INCLUDE (CheckFunctionExists)
 INCLUDE (CheckIncludeFile)
+INCLUDE (FindPkgConfig)

 project (piglit)

@@ -12,6 +13,7 @@ find_package(TIFF)
 find_package(GLUT REQUIRED)
 find_package(PNG REQUIRED)
 find_package(X11)
+pkg_check_modules(GLPROTO glproto)

 # The 'REQUIRED' above correctly produces an error for
 # OpenGL and PNG, but there's a bug involving FindGLUT.cmake
diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt
index 3307fc7..8571119 100644
--- a/tests/glx/CMakeLists.gl.txt
+++ b/tests/glx/CMakeLists.gl.txt
@@ -19,6 +19,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 		message(FATAL_ERROR "Xrender development headers required!")
 	endif()
 	include_directories(
+		${GLPROTO_INCLUDE_DIRS}
 		${X11_Xrender_INCLUDE_PATH}
 	)
 	add_executable (glx-fbconfig-sanity glx-fbconfig-sanity.c)
diff --git a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
index 3b70207..a9f8a31 100644
--- a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
+++ b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
@@ -15,6 +15,9 @@ link_libraries (
 )

 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+	include_directories(
+		${GLPROTO_INCLUDE_DIRS}
+	)
 	add_executable (glx-create-context-default-major-version
default-major-version.c common.c)
 	add_executable (glx-create-context-default-minor-version
default-minor-version.c common.c)
 	add_executable (glx-create-context-invalid-attribute
invalid-attribute.c common.c)
diff --git a/tests/spec/glx_ext_import_context/CMakeLists.gl.txt
b/tests/spec/glx_ext_import_context/CMakeLists.gl.txt
index 2ba2acd..001ade9 100644
--- a/tests/spec/glx_ext_import_context/CMakeLists.gl.txt
+++ b/tests/spec/glx_ext_import_context/CMakeLists.gl.txt
@@ -15,6 +15,9 @@ link_libraries (
 )

 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+	include_directories(
+		${GLPROTO_INCLUDE_DIRS}
+	)
 	add_executable (glx-free-context free-context.c common.c)
 	add_executable (glx-get-context-id get-context-id.c common.c)
 	add_executable (glx-get-current-display-ext get-current-display.c common.c)
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index 13daa80..91dd8a8 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -23,6 +23,15 @@ if (C_COMPILER_FLAG_WDECL_AFTER_STMT)
 endif ()

 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+	if (NOT GLPROTO_FOUND)
+		message(FATAL_ERROR "X11 glproto headers required!")
+	endif()
+	# XXX: This is currently duplicated wherever tests
+	# include "piglit-glx-util.h". Is it possible to refactor it?
+	include_directories(
+		${GLPROTO_INCLUDE_DIRS}
+	)
+
 	add_definitions ( -DUSE_GLX )
 	add_library (piglitglxutil
 		    piglit-shader.c
-- 
1.7.4.1


More information about the Piglit mailing list