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

Jose Fonseca jfonseca at vmware.com
Sat Mar 3 00:01:23 PST 2012



----- Original Message -----
> And error out when they're not present, rather than failing to
> compile later when GL/glxproto.h can't be found.
> ---
>  CMakeLists.txt                                     |    5 +++++
>  tests/glx/CMakeLists.gl.txt                        |    3 +++
>  .../spec/glx_arb_create_context/CMakeLists.gl.txt  |    3 +++
>  .../spec/glx_ext_import_context/CMakeLists.gl.txt  |    3 +++
>  tests/util/CMakeLists.gl.txt                       |    6 ++++++
>  5 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2aa1020..a00efc5 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -4,6 +4,7 @@ INCLUDE (CheckCCompilerFlag)
>  INCLUDE (CheckCXXCompilerFlag)
>  INCLUDE (CheckFunctionExists)
>  INCLUDE (CheckIncludeFile)
> +INCLUDE (FindPkgConfig)
> 
>  project (piglit)
> 
> @@ -13,6 +14,10 @@ find_package(GLUT REQUIRED)
>  find_package(PNG REQUIRED)
>  find_package(X11)
> 
> +IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> +	pkg_check_modules(GLPROTO REQUIRED glproto)
> +ENDIF()
> +
>  # The 'REQUIRED' above correctly produces an error for
>  # OpenGL and PNG, but there's a bug involving FindGLUT.cmake
>  # that fails to produce the error as of CMake 2.8.5.
> diff --git a/tests/glx/CMakeLists.gl.txt
> b/tests/glx/CMakeLists.gl.txt
> index 1d6621e..157e820 100644
> --- a/tests/glx/CMakeLists.gl.txt
> +++ b/tests/glx/CMakeLists.gl.txt
> @@ -15,6 +15,9 @@ link_libraries (
>  )
> 
>  IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> +	include_directories(
> +		${GLPROTO_INCLUDE_DIRS}
> +	)
>  	add_executable (glx-fbconfig-sanity glx-fbconfig-sanity.c)
>  	add_executable (glx-fbconfig-compliance glx-fbconfig-compliance.c)
>  	add_executable (glx-fbo-binding glx-fbo-binding.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..b612f41 100644
> --- a/tests/util/CMakeLists.gl.txt
> +++ b/tests/util/CMakeLists.gl.txt
> @@ -23,6 +23,12 @@ if (C_COMPILER_FLAG_WDECL_AFTER_STMT)
>  endif ()
> 
>  IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> +	# XXX: This is currently duplicated wherever tests
> +	# include "piglit-glx-util.h". Is it possible to refactor it?

Good idea. Let's just put this at the top of tests subdirectory, next to where test/utils is included.

Jose

> +	include_directories(
> +		${GLPROTO_INCLUDE_DIRS}
> +	)
> +
>  	add_definitions ( -DUSE_GLX )
>  	add_library (piglitglxutil
>  		    piglit-shader.c
> --
> 1.7.4.1
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 


More information about the Piglit mailing list