1 cmake_minimum_required(VERSION 3.4)
3 # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
5 cmake_policy (SET CMP0042 NEW)
9 cmake_policy (SET CMP0072 OLD)
14 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
16 INCLUDE (GNUInstallDirs)
17 INCLUDE (CheckCCompilerFlag)
18 INCLUDE (CheckCSourceCompiles)
19 INCLUDE (CheckCXXCompilerFlag)
20 INCLUDE (CheckFunctionExists)
21 INCLUDE (CheckSymbolExists)
22 INCLUDE (CheckIncludeFile)
23 INCLUDE (FindPkgConfig)
25 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
30 add_definitions(-DPIGLIT_HAS_PNG)
34 set(PIGLIT_HAS_X11 True)
35 add_definitions(-DPIGLIT_HAS_X11)
38 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
39 set(PIGLIT_BUILD_GLES_TESTS_DEFAULT ON)
40 set(PIGLIT_BUILD_VK_TESTS_DEFAULT ON)
42 set(PIGLIT_BUILD_GLES_TESTS_DEFAULT OFF)
43 set(PIGLIT_BUILD_VK_TESTS_DEFAULT OFF)
46 option(PIGLIT_SSE2 "Build with SSE2 support on 32-bit x86 architecture" ON)
48 option(PIGLIT_BUILD_GL_TESTS "Build tests for OpenGL" ON)
49 option(PIGLIT_BUILD_GLES1_TESTS "Build tests for OpenGL ES1" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
50 option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL ES2" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
51 option(PIGLIT_BUILD_GLES3_TESTS "Build tests for OpenGL ES3" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
52 option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
53 option(PIGLIT_BUILD_VK_TESTS "Build tests for Vulkan" ${PIGLIT_BUILD_VK_TESTS_DEFAULT})
55 if(PIGLIT_BUILD_GL_TESTS)
56 find_package(OpenGL REQUIRED)
59 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
60 option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" ON)
62 option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" OFF)
67 pkg_check_modules(Waffle REQUIRED waffle-1)
70 message(FATAL_ERROR "Failed to find Waffle. If Waffle "
71 "is not packaged for your distribution, you can get "
72 "it at https://gitlab.freedesktop.org/mesa/waffle."
76 # Check the installed waffle version.
78 # We cannot reliably check the version with pkg_check_modules(), but
79 # instead must check the version manually as below. The problem is that,
80 # if one passes a required version to pkg_check_modules(), CMake
81 # validates the required version at most once for the lifetime of the
82 # source tree. If someone changes the required version by editing the
83 # CMakeLists, CMake fails to detect the new requirement.
84 set(Waffle_REQUIRED_VERSION "1.6.0")
85 if(Waffle_VERSION VERSION_LESS Waffle_REQUIRED_VERSION)
86 message(FATAL_ERROR "Found waffle-${Waffle_VERSION}, but "
87 "piglit requires waffle-${Waffle_REQUIRED_VERSION}")
90 find_path(Waffle_INCLUDE_DIRS waffle.h)
91 find_library(Waffle_LDFLAGS waffle-1)
92 if(Waffle_INCLUDE_DIRS AND Waffle_LDFLAGS)
93 set(Waffle_FOUND TRUE)
95 message(FATAL_ERROR "Failed to find Waffle. Get and build Waffle from "
96 "https://gitlab.freedesktop.org/mesa/waffle and set "
97 "Waffle_INCLUDE_DIRS and Waffle_LDFLAGS variables accordingly."
102 add_definitions(-DPIGLIT_USE_WAFFLE)
103 add_definitions(-DWAFFLE_API_VERSION=0x0103)
105 find_package(GLUT REQUIRED)
107 # The 'REQUIRED' above correctly produces an error for
108 # OpenGL, but there's a bug involving FindGLUT.cmake
109 # that fails to produce the error as of CMake 2.8.5.
111 # Instead, CMake keeps going and eventually spams
112 # the console with a message for every target that used
113 # e.g. the ${GLUT_INCLUDE_DIR} variable. So it
114 # prints a line for basically every single test in piglit.
116 # Work around the bug and error out quickly here instead.
118 message(FATAL_ERROR "GLUT library not found")
120 endif(PIGLIT_USE_WAFFLE)
122 if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
123 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires PIGLIT_USE_WAFFLE")
124 endif(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
126 if(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
127 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires PIGLIT_USE_WAFFLE")
128 endif(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
130 if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
131 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires PIGLIT_USE_WAFFLE")
132 endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
134 if(PIGLIT_BUILD_CL_TESTS)
135 find_package(OpenCL 1.2 REQUIRED)
136 endif(PIGLIT_BUILD_CL_TESTS)
138 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
139 if(X11_FOUND AND OPENGL_gl_LIBRARY AND PIGLIT_BUILD_GLX_TESTS)
140 set(PIGLIT_HAS_GLX True)
141 add_definitions(-DPIGLIT_HAS_GLX)
144 pkg_check_modules(GBM QUIET gbm>=17.1)
146 set(PIGLIT_HAS_GBM True)
147 add_definitions(-DPIGLIT_HAS_GBM)
148 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GBM_LIBRARIES})
149 CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
150 if (PIGLIT_HAS_GBM_BO_MAP)
151 add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
153 CHECK_FUNCTION_EXISTS(gbm_bo_get_fd_for_plane PIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
154 if (PIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
155 add_definitions(-DPIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
159 pkg_check_modules(WAYLAND QUIET wayland-client)
161 set(PIGLIT_HAS_WAYLAND True)
162 add_definitions(-DPIGLIT_HAS_WAYLAND)
163 include_directories(${WAYLAND_INCLUDE_DIRS})
165 FIND_LIBRARY(HAVE_XKBCOMMON NAMES xkbcommon)
166 if(NOT HAVE_XKBCOMMON)
167 message(FATAL_ERROR "Wayland support requires xkbcommon. "
168 "Failed to find xkbcommon library.")
170 pkg_check_modules(XKBCOMMON QUIET xkbcommon)
173 pkg_check_modules(LIBDRM QUIET libdrm)
174 pkg_check_modules(XCB QUIET xcb)
175 pkg_check_modules(XCB_DRI2 QUIET xcb-dri2)
176 pkg_check_modules(GLPROTO QUIET glproto)
177 pkg_check_modules(LIBVULKAN QUIET vulkan)
178 ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
179 if (PIGLIT_USE_WAFFLE)
180 set(PIGLIT_HAS_WGL True)
181 add_definitions(-DPIGLIT_HAS_WGL)
185 if(PIGLIT_BUILD_VK_TESTS)
187 if (NOT LIBVULKAN_FOUND)
188 message(FATAL_ERROR "libvulkan required by vulkan tests not found")
191 find_program(GLSLANG_VALIDATOR NAMES glslangValidator)
193 if (NOT GLSLANG_VALIDATOR)
194 message(FATAL_ERROR "glslangValidator required by vulkan tests not found")
197 endif(PIGLIT_BUILD_VK_TESTS)
200 option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" ON)
202 option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" OFF)
206 option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" ON)
208 option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" OFF)
212 # Choose to build tests that use dma_buf.
214 # Piglit's dma_buf utilities require xcb-dri2 to gain DRM authentication, and
215 # gbm_bo_map() to be available for generating dma_bufs, and libdrm for fourcc
218 if(LIBDRM_FOUND AND LIBDRM_VERSION VERSION_GREATER "2.4.97" AND XCB_DRI2_FOUND AND PIGLIT_HAS_GBM_BO_MAP)
219 set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true)
221 set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false)
224 if(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
225 option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" ON)
227 option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" OFF)
230 # If the users has updated PIGLIT_BUILD_DMA_BUF_TESTS in the CMakeCache, then
231 # we need to validate it.
232 if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
234 "PIGLIT_BUILD_DMA_BUF_TESTS require libdrm, "
235 "gbm_bo_map(), libdrm>=2.4.98 and xcb-dri2")
238 IF(PIGLIT_BUILD_GLX_TESTS)
239 pkg_check_modules(GLPROTO REQUIRED glproto)
242 if (NOT Python_ADDITIONAL_VERSIONS)
243 set(Python_ADDITIONAL_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6)
245 find_package(PythonInterp REQUIRED)
246 find_package(PythonNumpy 1.7.0 REQUIRED)
247 find_package(PythonMako 1.0.2 REQUIRED)
249 pkg_search_module(BASH_COMPLETION bash-completion)
251 # Default to compiling with debug information (`gcc -g`):
252 if(NOT CMAKE_BUILD_TYPE)
253 SET(CMAKE_BUILD_TYPE Debug CACHE STRING
254 "May be one of: None Debug RelWithDebInfo Release MinSizeRel" FORCE)
255 endif(NOT CMAKE_BUILD_TYPE)
258 if (PIGLIT_SSE2 AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)")
259 # enables SSE2 and precision used on x86-64 by default
260 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse")
261 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse")
263 # degrade performance a bit, but enforce required precision
264 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffloat-store")
265 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffloat-store")
267 CHECK_C_COMPILER_FLAG("-Wall" C_COMPILER_FLAG_WALL)
268 IF (C_COMPILER_FLAG_WALL)
269 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
270 ENDIF (C_COMPILER_FLAG_WALL)
271 CHECK_CXX_COMPILER_FLAG("-Wall" CXX_COMPILER_FLAG_WALL)
272 IF (CXX_COMPILER_FLAG_WALL)
273 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
274 ENDIF (CXX_COMPILER_FLAG_WALL)
276 # Target C99. GCC's default is gnu11 for 5.0 and newer, gnu89 for
278 check_c_compiler_flag ("-std=gnu99" C_COMPILER_FLAG_STD_GNU99)
279 if (C_COMPILER_FLAG_STD_GNU99)
280 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
282 # MSVC does not support C99 variable length arrays
283 CHECK_C_COMPILER_FLAG("-Werror=vla" C_COMPILER_FLAG_WEVLA)
284 IF (C_COMPILER_FLAG_WEVLA)
285 SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla")
287 # GCC allows void pointer arithmetic, but it is not part of ISO C and
288 # in particular MSVC will throw `C2036: 'void *' : unknown size`
289 check_c_compiler_flag ("-Werror=pointer-arith" C_COMPILER_FLAG_WEPOINTER_ARITH)
290 if (C_COMPILER_FLAG_WEPOINTER_ARITH)
291 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=pointer-arith")
293 # MSVC only supports C99 variadic macros. It doesn't support the
294 # non-standard GNU named variadic macro syntax that's documented in
295 # https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
297 # XXX: on older GCC version this option has no effect unless -Wpedantic
298 # is set, but this should be fixed on future GCC versions, per
299 # https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01459.html
300 check_c_compiler_flag ("-Werror=variadic-macros" C_COMPILER_FLAG_WVARIADIC_MACROS)
301 if (C_COMPILER_FLAG_WVARIADIC_MACROS)
302 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=variadic-macros")
305 CHECK_CXX_COMPILER_FLAG("-Wno-narrowing" CXX_COMPILER_FLAG_WNO_NARROWING)
306 IF (CXX_COMPILER_FLAG_WNO_NARROWING)
307 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
308 ENDIF (CXX_COMPILER_FLAG_WNO_NARROWING)
311 add_definitions (-W3)
312 add_definitions (-wd4018) # signed/unsigned mismatch
313 add_definitions (-wd4244) # conversion from 'type1' to 'type2', possible loss of data
314 add_definitions (-wd4305) # truncation from 'type1' to 'type2'
315 add_definitions (-wd4800) # forcing value to bool 'true' or 'false' (performance warning)
317 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
318 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
322 # Match MSVC default stack size
323 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,1048576")
326 if (${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
327 # Use C++ to link C files.
328 # http://developers.sun.com/solaris/articles/mixing.html#linking
329 # Modified rule from Modules/CMakeCInformation.cmake.
330 set (CMAKE_C_LINK_EXECUTABLE
331 "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
334 # Always enable GNU C extensions. Non-GNU platforms will need to
335 # define wrappers for them.
336 add_definitions(-D_GNU_SOURCE)
339 # MSVC & MinGW only define & use APIENTRY
340 add_definitions (-DGLAPIENTRY=__stdcall)
342 # Avoid namespace pollution when including windows.h
343 # http://support.microsoft.com/kb/166474
344 add_definitions (-DWIN32_LEAN_AND_MEAN=1)
346 # Don't define min/max macros
347 add_definitions (-DNOMINMAX)
349 # Even more no min/max macros
350 add_definitions (-D_CRT_DECLARE_NONSTDC_NAMES=0)
352 # Define M_PI and others
353 add_definitions (-D_USE_MATH_DEFINES)
357 # Don't warn about using deprecated OpenGL/GLUT functions.
358 # TODO: It would be nice to silence just the deprecation macros from
359 # OpenGLAvailability.h as opposed to all deprecated functions.
360 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
361 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
366 find_path(GLEXT_INCLUDE_DIR
368 PATHS ${OPENGL_INCLUDE_DIR}
369 DOC "Include for OpenGL/glext.h on OSX"
372 find_path(GLEXT_INCLUDE_DIR
374 PATHS ${OPENGL_INCLUDE_DIR}
375 DOC "Include for GL/glext.h"
380 if(CMAKE_USE_PTHREADS_INIT)
381 set(PIGLIT_HAS_PTHREADS true)
382 add_definitions(-DPIGLIT_HAS_PTHREADS)
385 FIND_LIBRARY(HAVE_LIBRT NAMES rt)
387 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
390 check_c_source_compiles(
392 #define _POSIX_C_SOURCE 199309L
394 int main() { return clock_gettime(CLOCK_MONOTONIC, NULL); }
396 PIGLIT_HAS_POSIX_CLOCK_MONOTONIC
399 if(PIGLIT_HAS_PTHREADS AND PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
400 check_c_source_compiles(
404 static void timeout(union sigval val) { }
406 struct sigevent sev = {
407 .sigev_notify = SIGEV_THREAD,
408 .sigev_notify_function = timeout,
411 return timer_create(CLOCK_MONOTONIC, &sev, &timerid);
414 PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD
418 set(CMAKE_REQUIRED_LIBRARIES)
420 if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
421 add_definitions(-DPIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
424 if(PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
425 add_definitions(-DPIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
429 FIND_LIBRARY(HAVE_LIBCACA NAMES caca)
431 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} caca)
432 add_definitions(-DPIGLIT_HAS_LIBCACA)
436 if(PIGLIT_USE_WAFFLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
437 pkg_check_modules(EGL egl)
441 set(PIGLIT_HAS_EGL True)
442 add_definitions(-DPIGLIT_HAS_EGL)
443 include_directories(${EGL_INCLUDE_DIRS})
444 add_definitions (${EGL_CFLAGS_OTHER})
447 if(PIGLIT_BUILD_GLES1_TESTS AND NOT EGL_FOUND)
448 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires EGL. "
449 "Failed to find EGL library.")
452 if(PIGLIT_BUILD_GLES2_TESTS AND NOT EGL_FOUND)
453 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires EGL. "
454 "Failed to find EGL library.")
457 if(PIGLIT_BUILD_GLES3_TESTS AND NOT EGL_FOUND)
458 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires EGL. "
459 "Failed to find EGL library.")
462 # Put all executables into the bin subdirectory
463 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/bin)
464 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/lib)
466 # Do the same for MSVC, regardless of the build type. This only works correctly
467 # for CMake 2.8.1 and above.
468 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${piglit_BINARY_DIR}/bin)
469 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${piglit_BINARY_DIR}/bin)
470 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${piglit_BINARY_DIR}/bin)
471 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${piglit_BINARY_DIR}/bin)
473 check_function_exists(asprintf HAVE_ASPRINTF)
474 check_function_exists(ffs HAVE_FFS)
475 check_function_exists(strchrnul HAVE_STRCHRNUL)
476 check_function_exists(strndup HAVE_STRNDUP)
478 check_function_exists(fopen_s HAVE_FOPEN_S)
480 check_function_exists(setrlimit HAVE_SETRLIMIT)
482 check_symbol_exists(htobe32 "endian.h" HAVE_HTOBE32)
483 check_symbol_exists(htole16 "endian.h" HAVE_HTOLE16)
484 check_symbol_exists(htole32 "endian.h" HAVE_HTOLE32)
485 check_symbol_exists(htole64 "endian.h" HAVE_HTOLE64)
487 check_include_file(sys/time.h HAVE_SYS_TIME_H)
488 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
489 check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
490 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
491 check_include_file(unistd.h HAVE_UNISTD_H)
492 check_include_file(fcntl.h HAVE_FCNTL_H)
493 check_include_file(linux/sync_file.h HAVE_LINUX_SYNC_FILE_H)
494 check_include_file(endian.h HAVE_ENDIAN_H)
496 if(DEFINED PIGLIT_INSTALL_VERSION)
497 set(PIGLIT_INSTALL_VERSION_SUFFIX
498 "-${PIGLIT_INSTALL_VERSION}")
500 set(PIGLIT_INSTALL_VERSION_SUFFIX "")
502 set(PIGLIT_INSTALL_LIBDIR
503 "${CMAKE_INSTALL_LIBDIR}/piglit${PIGLIT_INSTALL_VERSION_SUFFIX}")
504 if(NOT IS_ABSOLUTE ${PIGLIT_INSTALL_LIBDIR})
505 set(PIGLIT_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${PIGLIT_INSTALL_LIBDIR}")
507 set(PIGLIT_INSTALL_FULL_LIBDIR "${PIGLIT_INSTALL_LIBDIR}")
510 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
511 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-new-dtags")
512 endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
514 SET(CMAKE_INSTALL_RPATH "${PIGLIT_INSTALL_FULL_LIBDIR}/lib")
517 "${piglit_SOURCE_DIR}/tests/util/config.h.in"
518 "${piglit_BINARY_DIR}/tests/util/config.h"
521 include(cmake/piglit_util.cmake)
522 include(cmake/piglit_dispatch.cmake)
524 include_directories(src)
525 add_subdirectory(cmake/target_api)
526 add_subdirectory(generated_tests)
527 add_subdirectory(replayer)
530 ##############################################################################
538 DESTINATION share/doc/piglit${PIGLIT_INSTALL_VERSION_SUFFIX}
543 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
544 FILES_MATCHING PATTERN "*.py"
549 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
554 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
555 FILES_MATCHING REGEX ".*\\.(xml|xml.gz|py|program_test|shader_test|shader_source|frag|vert|geom|tesc|tese|comp|spv|ktx|cl|txt|inc|vk_shader_test)$"
556 REGEX "CMakeFiles|CMakeLists|serializer.py|opengl.py|cl.py|quick_gl.py|glslparser.py|shader.py|quick_shader.py|no_error.py|llvmpipe_gl.py|sanity.py" EXCLUDE
560 DIRECTORY ${CMAKE_BINARY_DIR}/tests
561 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
562 FILES_MATCHING REGEX ".*\\.xml.gz"
566 DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
567 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
568 FILES_MATCHING REGEX ".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|comp|cl|txt|vk_shader_test)$"
569 REGEX "CMakeFiles|CMakeLists" EXCLUDE
573 DIRECTORY generated_tests
574 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
575 FILES_MATCHING REGEX ".*\\.inc$"
576 REGEX "CMakeFiles|CMakeLists" EXCLUDE
579 if (BASH_COMPLETION_FOUND)
580 pkg_get_variable(BASH_COMPLETION_COMPLETIONSDIR bash-completion completionsdir)
582 if(NOT "${BASH_COMPLETION_PREFIX}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
583 string(REGEX REPLACE "^${BASH_COMPLETION_PREFIX}" "${CMAKE_INSTALL_PREFIX}" COMP_DIR ${BASH_COMPLETION_COMPLETIONSDIR})
584 set(BASH_COMPLETION_COMPLETIONSDIR ${COMP_DIR})
589 FILES completions/bash/piglit
590 DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR}
592 endif (BASH_COMPLETION_FOUND)
595 set (PYTHON_SUFFIX ".py")
597 set (PYTHON_SUFFIX "")
600 PROGRAMS piglit RENAME piglit${PIGLIT_INSTALL_VERSION_SUFFIX}${PYTHON_SUFFIX}
601 DESTINATION ${CMAKE_INSTALL_BINDIR}
604 # Install MinGW runtime DLLs
606 if (CMAKE_SIZEOF_VOID_P EQUAL 8)
607 set (LIBGCC_DLL_NAME libgcc_s_seh-1.dll)
609 set (LIBGCC_DLL_NAME libgcc_s_sjlj-1.dll)
612 COMMAND ${CMAKE_C_COMPILER} -print-file-name=${LIBGCC_DLL_NAME}
613 OUTPUT_STRIP_TRAILING_WHITESPACE
614 OUTPUT_VARIABLE LIBGCC_DLL
617 COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++-6.dll
618 OUTPUT_STRIP_TRAILING_WHITESPACE
619 OUTPUT_VARIABLE LIBSTDCXX_DLL
621 if (EXISTS ${LIBGCC_DLL})
622 message (STATUS "Found libgcc DLL: ${LIBGCC_DLL}")
623 install (FILES ${LIBGCC_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
625 if (EXISTS ${LIBSTDCXX_DLL})
626 message (STATUS "Found libstdc++ DLL: ${LIBSTDCXX_DLL}")
627 install (FILES ${LIBSTDCXX_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
631 # Install Waffle DLL if specified
632 if (WIN32 AND Waffle_DLL)
633 install (FILES ${Waffle_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
637 set (CPACK_PACKAGE_VERSION_MAJOR "1")
638 set (CPACK_PACKAGE_VERSION_MINOR "0")
640 # Use current date in YYYYMMDD format as patch number
642 COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
643 OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
646 # cpack mistakenly detects Mingw-w64 as win32
648 if (CMAKE_SIZEOF_VOID_P EQUAL 8)
649 set (CPACK_SYSTEM_NAME win64)
653 # See http://www.vtk.org/Wiki/CMake:CPackPackageGenerators
655 set (CPACK_GENERATOR "7Z")
656 set (CPACK_STRIP_FILES ON)
658 set (CPACK_GENERATOR "TBZ2")