summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Heidelberg <david.heidelberg@collabora.com>2024-03-31 21:25:42 +0200
committerMarge Bot <emma+marge@anholt.net>2024-04-12 12:05:54 +0000
commit7e5ca052dec1917349eeff6815b09cac294ce026 (patch)
tree3fd2c4e321ca425f04195f4b60d3777f746f83a3
parentcd9d153642276727dc255361494f5ae462c6d56f (diff)
cmake: implement switch for the EGL tests and simplify test conditions
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/898>
-rw-r--r--CMakeLists.txt46
1 files changed, 15 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8c8ebe52..922e08b3f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,7 @@ option(PIGLIT_USE_GBM "Use GBM" ${DEFAULT_GBM})
option(PIGLIT_USE_WAYLAND "Use Wayland" ${DEFAULT_WAYLAND})
option(PIGLIT_USE_X11 "Use X11" ${DEFAULT_X11})
+option(PIGLIT_BUILD_EGL_TESTS "Build tests that require EGL" ${DEFAULT_EGL})
option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" ${DEFAULT_GLX})
option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" ${DEFAULT_WGL})
@@ -97,6 +98,9 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_USE_GBM)
message(FATAL_ERROR "PIGLIT_BUILD_DMA_BUF_TESTS require GBM")
endif()
+if(PIGLIT_BUILD_EGL_TESTS AND NOT PIGLIT_USE_WAFFLE)
+ message(FATAL_ERROR "Waffle has to be enabled for EGL tests to build")
+endif()
if(PIGLIT_USE_X11)
find_package(X11 REQUIRED)
@@ -165,17 +169,15 @@ else()
endif()
endif(PIGLIT_USE_WAFFLE)
-if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires PIGLIT_USE_WAFFLE")
-endif(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
-
-if(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires PIGLIT_USE_WAFFLE")
-endif(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
-
-if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires PIGLIT_USE_WAFFLE")
-endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
+if(PIGLIT_BUILD_GLES1_TESTS AND (NOT PIGLIT_USE_WAFFLE OR NOT PIGLIT_BUILD_EGL_TESTS))
+ message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires EGL and PIGLIT_USE_WAFFLE")
+endif()
+if(PIGLIT_BUILD_GLES2_TESTS AND (NOT PIGLIT_USE_WAFFLE OR NOT PIGLIT_BUILD_EGL_TESTS))
+ message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires EGL and PIGLIT_USE_WAFFLE")
+endif()
+if(PIGLIT_BUILD_GLES3_TESTS AND (NOT PIGLIT_USE_WAFFLE OR NOT PIGLIT_BUILD_EGL_TESTS))
+ message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires EGL and PIGLIT_USE_WAFFLE")
+endif()
if(PIGLIT_BUILD_CL_TESTS)
find_package(OpenCL 1.2 REQUIRED)
@@ -458,32 +460,14 @@ if(GBM_FOUND)
endif(HAVE_LIBCACA)
endif(GBM_FOUND)
-if(PIGLIT_USE_WAFFLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
- pkg_check_modules(EGL egl)
-endif()
-
-if(EGL_FOUND)
+if(PIGLIT_BUILD_EGL_TESTS)
+ pkg_check_modules(EGL REQUIRED egl)
set(PIGLIT_HAS_EGL True)
add_definitions(-DPIGLIT_HAS_EGL)
include_directories(${EGL_INCLUDE_DIRS})
add_definitions (${EGL_CFLAGS_OTHER})
endif()
-if(PIGLIT_BUILD_GLES1_TESTS AND NOT EGL_FOUND)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires EGL. "
- "Failed to find EGL library.")
-endif()
-
-if(PIGLIT_BUILD_GLES2_TESTS AND NOT EGL_FOUND)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires EGL. "
- "Failed to find EGL library.")
-endif()
-
-if(PIGLIT_BUILD_GLES3_TESTS AND NOT EGL_FOUND)
- message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires EGL. "
- "Failed to find EGL library.")
-endif()
-
# Put all executables into the bin subdirectory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/lib)