summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2013-09-09 15:37:14 -0500
committerChad Versace <chad.versace@linux.intel.com>2013-10-03 13:30:33 -0700
commitdd178de4e54e6771c2dd6aaa04c397469e5950ba (patch)
treeeb3973863063c78d89c71b69f833c07199a11d88 /CMakeLists.txt
parentec4ce38cfe248658720d444706e267ef7f56b110 (diff)
cmake,dma_buf: Refactor decisions to build dma_buf tests
This patch unifies the logic for deciding (1) to build dma_buf support into libpiglitutil and (2) to build the ext_image_dma_buf_import tests. In doing so, the patch creates a new CMake option, PIGLIT_BUILD_DMA_BUF_TESTS. It doesn't make sense to do (1) without (2) because the tests would all skip. There does exist some logic in the ext_image_dma_buf_import CMakeLists to prevent the tests from getting built without (1), but the logic is incopmlete. This patch's unification fixes the incompleteness. During Piglit's initial configuration, CMake chooses a default value of PIGLIT_BUILD_DMA_BUF_TESTS based on what packages are present on the system. Tested-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt27
1 files changed, 27 insertions, 0 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()