diff options
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt | 4 | ||||
-rw-r--r-- | tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt | 5 | ||||
-rw-r--r-- | tests/util/CMakeLists.txt | 5 |
4 files changed, 32 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a39d9dfe3..2aba8448a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,11 +89,38 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 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) option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" ON) ELSE() option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" OFF) ENDIF() + +# Choose to build tests that use dma_buf. +# +# The presence of libdrm is not sufficient. At least one libdrm_${hardware} +# library is also needed. +# +if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND) + set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true) +else() + set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false) +endif() + +if(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID) + option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" ON) +else() + option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" OFF) +endif() + +# If the users has updated PIGLIT_BUILD_DMA_BUF_TESTS in the CMakeCache, then +# we need to validate it. +if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID) + message(FATAL_ERROR + "PIGLIT_BUILD_DMA_BUF_TESTS require libdrm and libdrm_intel") +endif() + IF(PIGLIT_BUILD_GLX_TESTS) pkg_check_modules(GLPROTO REQUIRED glproto) ENDIF() diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt index f514c5304..b60e50792 100644 --- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt +++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt @@ -11,7 +11,7 @@ link_libraries( ) # These tests rely on drm and are hence compiled only on linux/drm platforms -if(LIBDRM_FOUND) +if(PIGLIT_BUILD_DMA_BUF_TESTS) add_definitions(-DHAVE_LIBDRM) include_directories( @@ -24,6 +24,6 @@ if(LIBDRM_FOUND) piglit_add_executable(ext_image_dma_buf_import-ownership_transfer ownership_transfer.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-intel_unsupported_format intel_unsupported_format.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_only intel_external_sampler_only.c image_common.c) -endif(LIBDRM_FOUND) +endif() # vim: ft=cmake: diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt index d4bcba607..f8ebd21b1 100644 --- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt +++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt @@ -9,8 +9,7 @@ link_libraries( piglitutil_gles2 ) -# These tests rely on drm and are hence compiled only on linux/drm platforms -if(LIBDRM_FOUND) +if(PIGLIT_BUILD_DMA_BUF_TESTS) add_definitions(-DHAVE_LIBDRM) include_directories( @@ -19,6 +18,6 @@ if(LIBDRM_FOUND) piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c sample_common.c image_common.c) piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_dma_only intel_external_sampler_with_dma_only.c image_common.c) -endif(LIBDRM_FOUND) +endif() # vim: ft=cmake: diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt index 8f1420c93..6bfe45137 100644 --- a/tests/util/CMakeLists.txt +++ b/tests/util/CMakeLists.txt @@ -51,12 +51,9 @@ set(UTIL_GL_LIBS ) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - pkg_check_modules(LIBDRM_INTEL QUIET libdrm_intel) - pkg_check_modules(XCB_DRI2 QUIET xcb-dri2) - # One needs to have at least one hardware driver present, otherwise # there is no point compiling just the dispatcher. - if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND) + if(PIGLIT_BUILD_DMA_BUF_TESTS) add_definitions(-DHAVE_LIBDRM) list(APPEND UTIL_GL_SOURCES |