1 cmake_minimum_required(VERSION 3.2)
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_BUILD_GL_TESTS "Build tests for OpenGL" ON)
47 option(PIGLIT_BUILD_GLES1_TESTS "Build tests for OpenGL ES1" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
48 option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL ES2" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
49 option(PIGLIT_BUILD_GLES3_TESTS "Build tests for OpenGL ES3" ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
50 option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
51 option(PIGLIT_BUILD_VK_TESTS "Build tests for Vulkan" ${PIGLIT_BUILD_VK_TESTS_DEFAULT})
53 if(PIGLIT_BUILD_GL_TESTS)
54 find_package(OpenGL REQUIRED)
57 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
58 option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" ON)
60 option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" OFF)
65 pkg_check_modules(Waffle REQUIRED waffle-1)
68 message(FATAL_ERROR "Failed to find Waffle. If Waffle "
69 "is not packaged for your distribution, you can get "
70 "it at https://gitlab.freedesktop.org/mesa/waffle."
74 # Check the installed waffle version.
76 # We cannot reliably check the version with pkg_check_modules(), but
77 # instead must check the version manually as below. The problem is that,
78 # if one passes a required version to pkg_check_modules(), CMake
79 # validates the required version at most once for the lifetime of the
80 # source tree. If someone changes the required version by editing the
81 # CMakeLists, CMake fails to detect the new requirement.
82 set(Waffle_REQUIRED_VERSION "1.6.0")
83 if(Waffle_VERSION VERSION_LESS Waffle_REQUIRED_VERSION)
84 message(FATAL_ERROR "Found waffle-${Waffle_VERSION}, but "
85 "piglit requires waffle-${Waffle_REQUIRED_VERSION}")
88 find_path(Waffle_INCLUDE_DIRS waffle.h)
89 find_library(Waffle_LDFLAGS waffle-1)
90 if(Waffle_INCLUDE_DIRS AND Waffle_LDFLAGS)
91 set(Waffle_FOUND TRUE)
93 message(FATAL_ERROR "Failed to find Waffle. Get and build Waffle from "
94 "https://gitlab.freedesktop.org/mesa/waffle and set "
95 "Waffle_INCLUDE_DIRS and Waffle_LDFLAGS variables accordingly."
100 add_definitions(-DPIGLIT_USE_WAFFLE)
101 add_definitions(-DWAFFLE_API_VERSION=0x0103)
103 find_package(GLUT REQUIRED)
105 # The 'REQUIRED' above correctly produces an error for
106 # OpenGL, but there's a bug involving FindGLUT.cmake
107 # that fails to produce the error as of CMake 2.8.5.
109 # Instead, CMake keeps going and eventually spams
110 # the console with a message for every target that used
111 # e.g. the ${GLUT_INCLUDE_DIR} variable. So it
112 # prints a line for basically every single test in piglit.
114 # Work around the bug and error out quickly here instead.
116 message(FATAL_ERROR "GLUT library not found")
118 endif(PIGLIT_USE_WAFFLE)
120 if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
121 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires PIGLIT_USE_WAFFLE")
122 endif(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
124 if(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
125 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires PIGLIT_USE_WAFFLE")
126 endif(PIGLIT_BUILD_GLES2_TESTS AND NOT PIGLIT_USE_WAFFLE)
128 if(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
129 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires PIGLIT_USE_WAFFLE")
130 endif(PIGLIT_BUILD_GLES3_TESTS AND NOT PIGLIT_USE_WAFFLE)
132 if(PIGLIT_BUILD_CL_TESTS)
133 find_package(OpenCL 1.2 REQUIRED)
134 endif(PIGLIT_BUILD_CL_TESTS)
136 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
137 if(X11_FOUND AND OPENGL_gl_LIBRARY AND PIGLIT_BUILD_GLX_TESTS)
138 set(PIGLIT_HAS_GLX True)
139 add_definitions(-DPIGLIT_HAS_GLX)
142 pkg_check_modules(GBM QUIET gbm>=17.1)
144 set(PIGLIT_HAS_GBM True)
145 add_definitions(-DPIGLIT_HAS_GBM)
146 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GBM_LIBRARIES})
147 CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
148 if (PIGLIT_HAS_GBM_BO_MAP)
149 add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
151 CHECK_FUNCTION_EXISTS(gbm_bo_get_fd_for_plane PIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
152 if (PIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
153 add_definitions(-DPIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE)
157 pkg_check_modules(WAYLAND QUIET wayland-client)
159 set(PIGLIT_HAS_WAYLAND True)
160 add_definitions(-DPIGLIT_HAS_WAYLAND)
162 FIND_LIBRARY(HAVE_XKBCOMMON NAMES xkbcommon)
163 if(NOT HAVE_XKBCOMMON)
164 message(FATAL_ERROR "Wayland support requires xkbcommon. "
165 "Failed to find xkbcommon library.")
167 pkg_check_modules(XKBCOMMON QUIET xkbcommon)
170 pkg_check_modules(LIBDRM QUIET libdrm)
171 pkg_check_modules(XCB QUIET xcb)
172 pkg_check_modules(XCB_DRI2 QUIET xcb-dri2)
173 pkg_check_modules(GLPROTO QUIET glproto)
174 pkg_check_modules(LIBVULKAN QUIET vulkan)
175 ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
176 if (PIGLIT_USE_WAFFLE)
177 set(PIGLIT_HAS_WGL True)
178 add_definitions(-DPIGLIT_HAS_WGL)
182 if(PIGLIT_BUILD_VK_TESTS)
184 if (NOT LIBVULKAN_FOUND)
185 message(FATAL_ERROR "libvulkan required by vulkan tests not found")
188 find_program(GLSLANG_VALIDATOR NAMES glslangValidator)
190 if (NOT GLSLANG_VALIDATOR)
191 message(FATAL_ERROR "glslangValidator required by vulkan tests not found")
194 endif(PIGLIT_BUILD_VK_TESTS)
197 option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" ON)
199 option(PIGLIT_BUILD_GLX_TESTS "Build tests that require GLX" OFF)
203 option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" ON)
205 option(PIGLIT_BUILD_WGL_TESTS "Build tests that require WGL" OFF)
209 # Choose to build tests that use dma_buf.
211 # Piglit's dma_buf utilities require xcb-dri2 to gain DRM authentication, and
212 # gbm_bo_map() to be available for generating dma_bufs, and libdrm for fourcc
215 if(LIBDRM_FOUND AND LIBDRM_VERSION VERSION_GREATER "2.4.97" AND XCB_DRI2_FOUND AND PIGLIT_HAS_GBM_BO_MAP)
216 set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true)
218 set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false)
221 if(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
222 option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" ON)
224 option(PIGLIT_BUILD_DMA_BUF_TESTS "Build tests that use dma_buf" OFF)
227 # If the users has updated PIGLIT_BUILD_DMA_BUF_TESTS in the CMakeCache, then
228 # we need to validate it.
229 if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
231 "PIGLIT_BUILD_DMA_BUF_TESTS require libdrm, "
232 "gbm_bo_map(), libdrm>=2.4.98 and xcb-dri2")
235 IF(PIGLIT_BUILD_GLX_TESTS)
236 pkg_check_modules(GLPROTO REQUIRED glproto)
239 if (NOT Python_ADDITIONAL_VERSIONS)
240 set(Python_ADDITIONAL_VERSIONS 3.11 3.10 3.9 3.8 3.7 3.6)
242 find_package(PythonInterp REQUIRED)
243 find_package(PythonNumpy 1.7.0 REQUIRED)
244 find_package(PythonMako 1.0.2 REQUIRED)
246 find_package(bash-completion NO_MODULE)
248 # Default to compiling with debug information (`gcc -g`):
249 if(NOT CMAKE_BUILD_TYPE)
250 SET(CMAKE_BUILD_TYPE Debug CACHE STRING
251 "May be one of: None Debug RelWithDebInfo Release MinSizeRel" FORCE)
252 endif(NOT CMAKE_BUILD_TYPE)
255 CHECK_C_COMPILER_FLAG("-Wall" C_COMPILER_FLAG_WALL)
256 IF (C_COMPILER_FLAG_WALL)
257 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
258 ENDIF (C_COMPILER_FLAG_WALL)
259 CHECK_CXX_COMPILER_FLAG("-Wall" CXX_COMPILER_FLAG_WALL)
260 IF (CXX_COMPILER_FLAG_WALL)
261 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
262 ENDIF (CXX_COMPILER_FLAG_WALL)
264 # Target C99. GCC's default is gnu11 for 5.0 and newer, gnu89 for
266 check_c_compiler_flag ("-std=gnu99" C_COMPILER_FLAG_STD_GNU99)
267 if (C_COMPILER_FLAG_STD_GNU99)
268 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
270 # MSVC does not support C99 variable length arrays
271 CHECK_C_COMPILER_FLAG("-Werror=vla" C_COMPILER_FLAG_WEVLA)
272 IF (C_COMPILER_FLAG_WEVLA)
273 SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla")
275 # GCC allows void pointer arithmetic, but it is not part of ISO C and
276 # in particular MSVC will throw `C2036: 'void *' : unknown size`
277 check_c_compiler_flag ("-Werror=pointer-arith" C_COMPILER_FLAG_WEPOINTER_ARITH)
278 if (C_COMPILER_FLAG_WEPOINTER_ARITH)
279 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=pointer-arith")
281 # MSVC only supports C99 variadic macros. It doesn't support the
282 # non-standard GNU named variadic macro syntax that's documented in
283 # https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
285 # XXX: on older GCC version this option has no effect unless -Wpedantic
286 # is set, but this should be fixed on future GCC versions, per
287 # https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01459.html
288 check_c_compiler_flag ("-Werror=variadic-macros" C_COMPILER_FLAG_WVARIADIC_MACROS)
289 if (C_COMPILER_FLAG_WVARIADIC_MACROS)
290 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=variadic-macros")
293 CHECK_CXX_COMPILER_FLAG("-Wno-narrowing" CXX_COMPILER_FLAG_WNO_NARROWING)
294 IF (CXX_COMPILER_FLAG_WNO_NARROWING)
295 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
296 ENDIF (CXX_COMPILER_FLAG_WNO_NARROWING)
299 add_definitions (-W3)
300 add_definitions (-wd4018) # signed/unsigned mismatch
301 add_definitions (-wd4244) # conversion from 'type1' to 'type2', possible loss of data
302 add_definitions (-wd4305) # truncation from 'type1' to 'type2'
303 add_definitions (-wd4800) # forcing value to bool 'true' or 'false' (performance warning)
305 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
306 add_definitions (-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
310 # Match MSVC default stack size
311 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,1048576")
314 if (${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
315 # Use C++ to link C files.
316 # http://developers.sun.com/solaris/articles/mixing.html#linking
317 # Modified rule from Modules/CMakeCInformation.cmake.
318 set (CMAKE_C_LINK_EXECUTABLE
319 "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
322 # Always enable GNU C extensions. Non-GNU platforms will need to
323 # define wrappers for them.
324 add_definitions(-D_GNU_SOURCE)
327 # MSVC & MinGW only define & use APIENTRY
328 add_definitions (-DGLAPIENTRY=__stdcall)
330 # Avoid namespace pollution when including windows.h
331 # http://support.microsoft.com/kb/166474
332 add_definitions (-DWIN32_LEAN_AND_MEAN=1)
334 # Don't define min/max macros
335 add_definitions (-DNOMINMAX)
337 # Even more no min/max macros
338 add_definitions (-D_CRT_DECLARE_NONSTDC_NAMES=0)
340 # Define M_PI and others
341 add_definitions (-D_USE_MATH_DEFINES)
345 # Don't warn about using deprecated OpenGL/GLUT functions.
346 # TODO: It would be nice to silence just the deprecation macros from
347 # OpenGLAvailability.h as opposed to all deprecated functions.
348 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
349 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
354 find_path(GLEXT_INCLUDE_DIR
356 PATHS ${OPENGL_INCLUDE_DIR}
357 DOC "Include for OpenGL/glext.h on OSX"
360 find_path(GLEXT_INCLUDE_DIR
362 PATHS ${OPENGL_INCLUDE_DIR}
363 DOC "Include for GL/glext.h"
368 if(CMAKE_USE_PTHREADS_INIT)
369 set(PIGLIT_HAS_PTHREADS true)
370 add_definitions(-DPIGLIT_HAS_PTHREADS)
373 FIND_LIBRARY(HAVE_LIBRT NAMES rt)
375 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
378 check_c_source_compiles(
380 #define _POSIX_C_SOURCE 199309L
382 int main() { return clock_gettime(CLOCK_MONOTONIC, NULL); }
384 PIGLIT_HAS_POSIX_CLOCK_MONOTONIC
387 if(PIGLIT_HAS_PTHREADS AND PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
388 check_c_source_compiles(
392 static void timeout(union sigval val) { }
394 struct sigevent sev = {
395 .sigev_notify = SIGEV_THREAD,
396 .sigev_notify_function = timeout,
399 return timer_create(CLOCK_MONOTONIC, &sev, &timerid);
402 PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD
406 set(CMAKE_REQUIRED_LIBRARIES)
408 if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
409 add_definitions(-DPIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
412 if(PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
413 add_definitions(-DPIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
417 FIND_LIBRARY(HAVE_LIBCACA NAMES caca)
419 set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} caca)
420 add_definitions(-DPIGLIT_HAS_LIBCACA)
424 if(PIGLIT_USE_WAFFLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
425 pkg_check_modules(EGL egl)
429 set(PIGLIT_HAS_EGL True)
430 add_definitions(-DPIGLIT_HAS_EGL)
431 include_directories(${EGL_INCLUDE_DIRS})
432 add_definitions (${EGL_CFLAGS_OTHER})
435 if(PIGLIT_BUILD_GLES1_TESTS AND NOT EGL_FOUND)
436 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires EGL. "
437 "Failed to find EGL library.")
440 if(PIGLIT_BUILD_GLES2_TESTS AND NOT EGL_FOUND)
441 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES2_TESTS requires EGL. "
442 "Failed to find EGL library.")
445 if(PIGLIT_BUILD_GLES3_TESTS AND NOT EGL_FOUND)
446 message(FATAL_ERROR "Option PIGLIT_BUILD_GLES3_TESTS requires EGL. "
447 "Failed to find EGL library.")
450 # Put all executables into the bin subdirectory
451 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/bin)
452 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${piglit_BINARY_DIR}/lib)
454 # Do the same for MSVC, regardless of the build type. This only works correctly
455 # for CMake 2.8.1 and above.
456 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${piglit_BINARY_DIR}/bin)
457 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${piglit_BINARY_DIR}/bin)
458 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${piglit_BINARY_DIR}/bin)
459 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${piglit_BINARY_DIR}/bin)
461 check_function_exists(asprintf HAVE_ASPRINTF)
462 check_function_exists(ffs HAVE_FFS)
463 check_function_exists(strchrnul HAVE_STRCHRNUL)
464 check_function_exists(strndup HAVE_STRNDUP)
466 check_function_exists(fopen_s HAVE_FOPEN_S)
468 check_function_exists(setrlimit HAVE_SETRLIMIT)
470 check_symbol_exists(htobe32 "endian.h" HAVE_HTOBE32)
471 check_symbol_exists(htole16 "endian.h" HAVE_HTOLE16)
472 check_symbol_exists(htole32 "endian.h" HAVE_HTOLE32)
473 check_symbol_exists(htole64 "endian.h" HAVE_HTOLE64)
475 check_include_file(sys/time.h HAVE_SYS_TIME_H)
476 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
477 check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
478 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
479 check_include_file(unistd.h HAVE_UNISTD_H)
480 check_include_file(fcntl.h HAVE_FCNTL_H)
481 check_include_file(linux/sync_file.h HAVE_LINUX_SYNC_FILE_H)
482 check_include_file(endian.h HAVE_ENDIAN_H)
484 if(DEFINED PIGLIT_INSTALL_VERSION)
485 set(PIGLIT_INSTALL_VERSION_SUFFIX
486 "-${PIGLIT_INSTALL_VERSION}")
488 set(PIGLIT_INSTALL_VERSION_SUFFIX "")
490 set(PIGLIT_INSTALL_LIBDIR
491 "${CMAKE_INSTALL_LIBDIR}/piglit${PIGLIT_INSTALL_VERSION_SUFFIX}")
492 if(NOT IS_ABSOLUTE ${PIGLIT_INSTALL_LIBDIR})
493 set(PIGLIT_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${PIGLIT_INSTALL_LIBDIR}")
495 set(PIGLIT_INSTALL_FULL_LIBDIR "${PIGLIT_INSTALL_LIBDIR}")
498 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
499 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-new-dtags")
500 endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
502 SET(CMAKE_INSTALL_RPATH "${PIGLIT_INSTALL_FULL_LIBDIR}/lib")
505 "${piglit_SOURCE_DIR}/tests/util/config.h.in"
506 "${piglit_BINARY_DIR}/tests/util/config.h"
509 include(cmake/piglit_util.cmake)
510 include(cmake/piglit_dispatch.cmake)
512 include_directories(src)
513 add_subdirectory(cmake/target_api)
514 add_subdirectory(generated_tests)
515 add_subdirectory(replayer)
518 ##############################################################################
526 DESTINATION share/doc/piglit${PIGLIT_INSTALL_VERSION_SUFFIX}
531 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
532 FILES_MATCHING PATTERN "*.py"
537 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
542 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
543 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)$"
544 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
548 DIRECTORY ${CMAKE_BINARY_DIR}/tests
549 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
550 FILES_MATCHING REGEX ".*\\.xml.gz"
554 DIRECTORY ${CMAKE_BINARY_DIR}/generated_tests
555 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
556 FILES_MATCHING REGEX ".*\\.(shader_test|program_test|frag|vert|geom|tesc|tese|comp|cl|txt|vk_shader_test)$"
557 REGEX "CMakeFiles|CMakeLists" EXCLUDE
561 DIRECTORY generated_tests
562 DESTINATION ${PIGLIT_INSTALL_LIBDIR}
563 FILES_MATCHING REGEX ".*\\.inc$"
564 REGEX "CMakeFiles|CMakeLists" EXCLUDE
567 if (BASH_COMPLETION_FOUND)
569 FILES completions/bash/piglit
570 DESTINATION ${CMAKE_INSTALL_PREFIX}/${BASH_COMPLETION_COMPLETIONSDIR}/
572 endif (BASH_COMPLETION_FOUND)
575 set (PYTHON_SUFFIX ".py")
577 set (PYTHON_SUFFIX "")
580 PROGRAMS piglit RENAME piglit${PIGLIT_INSTALL_VERSION_SUFFIX}${PYTHON_SUFFIX}
581 DESTINATION ${CMAKE_INSTALL_BINDIR}
584 # Install MinGW runtime DLLs
586 if (CMAKE_SIZEOF_VOID_P EQUAL 8)
587 set (LIBGCC_DLL_NAME libgcc_s_seh-1.dll)
589 set (LIBGCC_DLL_NAME libgcc_s_sjlj-1.dll)
592 COMMAND ${CMAKE_C_COMPILER} -print-file-name=${LIBGCC_DLL_NAME}
593 OUTPUT_STRIP_TRAILING_WHITESPACE
594 OUTPUT_VARIABLE LIBGCC_DLL
597 COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++-6.dll
598 OUTPUT_STRIP_TRAILING_WHITESPACE
599 OUTPUT_VARIABLE LIBSTDCXX_DLL
601 if (EXISTS ${LIBGCC_DLL})
602 message (STATUS "Found libgcc DLL: ${LIBGCC_DLL}")
603 install (FILES ${LIBGCC_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
605 if (EXISTS ${LIBSTDCXX_DLL})
606 message (STATUS "Found libstdc++ DLL: ${LIBSTDCXX_DLL}")
607 install (FILES ${LIBSTDCXX_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
611 # Install Waffle DLL if specified
612 if (WIN32 AND Waffle_DLL)
613 install (FILES ${Waffle_DLL} DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin)
617 set (CPACK_PACKAGE_VERSION_MAJOR "1")
618 set (CPACK_PACKAGE_VERSION_MINOR "0")
620 # Use current date in YYYYMMDD format as patch number
622 COMMAND ${PYTHON_EXECUTABLE} -c "import time, sys; sys.stdout.write(time.strftime('%Y%m%d'))"
623 OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
626 # cpack mistakenly detects Mingw-w64 as win32
628 if (CMAKE_SIZEOF_VOID_P EQUAL 8)
629 set (CPACK_SYSTEM_NAME win64)
633 # See http://www.vtk.org/Wiki/CMake:CPackPackageGenerators
635 set (CPACK_GENERATOR "7Z")
636 set (CPACK_STRIP_FILES ON)
638 set (CPACK_GENERATOR "TBZ2")