Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.11) |
Courtney Goeltzenleuchter | f21d32d | 2014-09-01 13:57:15 -0600 | [diff] [blame] | 2 | include (FindPkgConfig) |
| 3 | |
Tony Barbour | 96db882 | 2015-02-25 12:28:39 -0700 | [diff] [blame] | 4 | if(NOT WIN32) |
| 5 | find_package(XCB REQUIRED) |
| 6 | endif() |
| 7 | |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 8 | find_package(ImageMagick COMPONENTS MagickWand) |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 9 | if(NOT ImageMagick_FOUND) |
Tony Barbour | 76411ba | 2015-06-10 16:53:00 -0600 | [diff] [blame] | 10 | if(NOT WIN32) |
| 11 | message(FATAL_ERROR "Missing ImageMagick library: sudo apt-get install libmagickwand-dev") |
| 12 | else() |
| 13 | message(FATAL_ERROR "Missing ImageMagick library: Get from http://www.imagemagick.org/script/binary-releases.php. Be sure to check box to 'Install development headers and libraries'") |
| 14 | endif() |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 15 | endif() |
| 16 | |
Tony Barbour | 7ea6aa2 | 2015-05-22 09:44:58 -0600 | [diff] [blame] | 17 | if(WIN32) |
Mike Stroyan | 00a5d36 | 2015-08-10 16:47:15 -0600 | [diff] [blame] | 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES /wd4267 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16") |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 19 | else() |
Mike Stroyan | 00a5d36 | 2015-08-10 16:47:15 -0600 | [diff] [blame] | 20 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES -Wno-sign-compare -std=c++11 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16") |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 21 | endif() |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 22 | |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 23 | set (LIBGLM_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/libs) |
| 24 | |
| 25 | set(COMMON_CPP |
Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 26 | vkrenderframework.cpp |
| 27 | vktestbinding.cpp |
| 28 | vktestframework.cpp |
Tony Barbour | 92400bb | 2015-03-02 16:38:52 -0700 | [diff] [blame] | 29 | test_environment.cpp |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 30 | ) |
| 31 | |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 32 | set(TEST_LIBRARIES |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 33 | glslang |
| 34 | OGLCompiler |
| 35 | OSDependent |
| 36 | SPIRV |
| 37 | ${XCB_LIBRARIES} |
| 38 | ${ImageMagick_LIBRARIES} |
| 39 | ) |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 40 | |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 41 | add_library(glslang STATIC IMPORTED) |
| 42 | add_library(OGLCompiler STATIC IMPORTED) |
| 43 | add_library(OSDependent STATIC IMPORTED) |
| 44 | add_library(SPIRV STATIC IMPORTED) |
| 45 | |
| 46 | # On Windows, we must pair Debug and Release appropriately |
| 47 | if (WIN32) |
| 48 | set_target_properties(glslang PROPERTIES |
| 49 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/glslang/Release/glslang.lib" |
| 50 | IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/glslang/Debug/glslang.lib") |
| 51 | set_target_properties(OGLCompiler PROPERTIES |
| 52 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/OGLCompilersDLL/Release/OGLCompiler.lib" |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 53 | IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/OGLCompilersDLL/Debug/OGLCompiler.lib") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 54 | set_target_properties(OSDependent PROPERTIES |
| 55 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/glslang/OSDependent/Windows/Release/OSDependent.lib" |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 56 | IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/glslang/OSDependent/Windows/Debug/OSDependent.lib") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 57 | set_target_properties(SPIRV PROPERTIES |
| 58 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/SPIRV/Release/SPIRV.lib" |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 59 | IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/SPIRV/Debug/SPIRV.lib") |
| 60 | else () |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 61 | set_target_properties(glslang PROPERTIES |
| 62 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/install/lib/libglslang.a") |
| 63 | set_target_properties(OGLCompiler PROPERTIES |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 64 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/install/lib/libOGLCompiler.a") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 65 | set_target_properties(OSDependent PROPERTIES |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 66 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/install/lib/libOSDependent.a") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 67 | set_target_properties(SPIRV PROPERTIES |
David Pinedo | a08771e | 2015-06-09 16:04:36 -0600 | [diff] [blame] | 68 | IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/install/lib/libSPIRV.a") |
| 69 | endif() |
| 70 | |
Courtney Goeltzenleuchter | 6863ff4 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 71 | include_directories( |
| 72 | "${PROJECT_SOURCE_DIR}/tests/gtest-1.7.0/include" |
| 73 | "${PROJECT_SOURCE_DIR}/icd/common" |
Mark Lobodzinski | 159ffe0 | 2015-05-14 14:30:48 -0500 | [diff] [blame] | 74 | "${PROJECT_SOURCE_DIR}/layers" |
Cody Northrop | 5a95b47 | 2015-06-03 13:01:54 -0600 | [diff] [blame] | 75 | ${GLSLANG_PREFIX} |
Tony Barbour | 96db882 | 2015-02-25 12:28:39 -0700 | [diff] [blame] | 76 | ${XCB_INCLUDE_DIRS} |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 77 | ${LIBGLM_INCLUDE_DIR} |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 78 | ${ImageMagick_INCLUDE_DIRS} |
Courtney Goeltzenleuchter | 6863ff4 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 79 | ) |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 80 | |
Tony Barbour | 7ea6aa2 | 2015-05-22 09:44:58 -0600 | [diff] [blame] | 81 | if (NOT WIN32) |
| 82 | # extra setup for out-of-tree builds |
| 83 | if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) |
| 84 | add_custom_target(binary-dir-symlinks ALL |
| 85 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/golden |
| 86 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/run_all_tests.sh |
| 87 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/run_all_tests_with_layers.sh |
| 88 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/layer_test_suite.py |
Mark Lobodzinski | 3a77cbc | 2015-08-14 14:24:50 -0600 | [diff] [blame] | 89 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/vktracereplay.sh |
Tobin Ehlis | 12d4c6a | 2015-08-31 12:42:38 -0600 | [diff] [blame] | 90 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/vkvalidatelayerdoc.sh |
Tony Barbour | 7ea6aa2 | 2015-05-22 09:44:58 -0600 | [diff] [blame] | 91 | VERBATIM |
| 92 | ) |
| 93 | endif() |
Tony Barbour | 856aba3 | 2015-06-08 16:11:29 -0600 | [diff] [blame] | 94 | else() |
| 95 | if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) |
| 96 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/golden GOLDEN) |
Cody Northrop | 95cb689 | 2015-08-14 10:55:56 -0600 | [diff] [blame] | 97 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/_run_all_tests.ps1 RUN_ALL) |
| 98 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/_run_all_tests_with_layers.ps1 RUN_ALL_WITH_LAYERS) |
Mark Lobodzinski | 28b8f02 | 2015-08-27 15:30:29 -0600 | [diff] [blame] | 99 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/_vktracereplay.ps1 VKTRACEREPLAY) |
Tobin Ehlis | 12d4c6a | 2015-08-31 12:42:38 -0600 | [diff] [blame] | 100 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/_vkvalidatelayerdoc.ps1 VKVALIDATELAYERDOC) |
Tony Barbour | 856aba3 | 2015-06-08 16:11:29 -0600 | [diff] [blame] | 101 | add_custom_target(binary-dir-symlinks ALL |
Tony Barbour | 6fb266c | 2015-07-01 12:33:07 -0600 | [diff] [blame] | 102 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RUN_ALL} run_all_tests.ps1 |
| 103 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RUN_ALL_WITH_LAYERS} run_all_tests_with_layers.ps1 |
Mark Lobodzinski | 28b8f02 | 2015-08-27 15:30:29 -0600 | [diff] [blame] | 104 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VKTRACEREPLAY} vktracereplay.ps1 |
Tobin Ehlis | 12d4c6a | 2015-08-31 12:42:38 -0600 | [diff] [blame] | 105 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VKVALIDATELAYERDOC} vkvalidatelayerdoc.ps1 |
Tony Barbour | 6fb266c | 2015-07-01 12:33:07 -0600 | [diff] [blame] | 106 | COMMAND IF NOT EXIST golden mklink /J golden ${GOLDEN} |
Tony Barbour | 856aba3 | 2015-06-08 16:11:29 -0600 | [diff] [blame] | 107 | VERBATIM |
| 108 | ) |
| 109 | endif() |
Chia-I Wu | 05c7181 | 2014-12-06 10:22:40 +0800 | [diff] [blame] | 110 | endif() |
| 111 | |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 112 | if (WIN32) |
David Pinedo | 4bb0d30 | 2015-09-08 11:07:46 -0600 | [diff] [blame] | 113 | set (LIBVK "vulkan-${MAJOR}") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 114 | else () |
| 115 | set (LIBVK "vulkan") |
| 116 | endif() |
| 117 | |
Courtney Goeltzenleuchter | d365eeb | 2015-04-08 21:19:57 -0600 | [diff] [blame] | 118 | add_executable(vkbase init.cpp ${COMMON_CPP}) |
| 119 | set_target_properties(vkbase |
Courtney Goeltzenleuchter | 447ed58 | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 120 | PROPERTIES |
| 121 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 122 | target_link_libraries(vkbase ${LIBVK} gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | 447ed58 | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 123 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 124 | add_executable(vk_image_tests image_tests.cpp ${COMMON_CPP}) |
| 125 | set_target_properties(vk_image_tests |
Courtney Goeltzenleuchter | 80ea59a | 2014-08-14 17:41:57 -0600 | [diff] [blame] | 126 | PROPERTIES |
| 127 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 128 | target_link_libraries(vk_image_tests ${LIBVK} gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | 80ea59a | 2014-08-14 17:41:57 -0600 | [diff] [blame] | 129 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 130 | add_executable(vk_render_tests render_tests.cpp ${COMMON_CPP}) |
| 131 | set_target_properties(vk_render_tests |
Courtney Goeltzenleuchter | cc5eb3a | 2014-08-19 18:35:50 -0600 | [diff] [blame] | 132 | PROPERTIES |
| 133 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 134 | target_link_libraries(vk_render_tests ${LIBVK} gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | cc5eb3a | 2014-08-19 18:35:50 -0600 | [diff] [blame] | 135 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 136 | add_executable(vk_blit_tests blit_tests.cpp ${COMMON_CPP}) |
| 137 | set_target_properties(vk_blit_tests |
Chia-I Wu | d7414b0 | 2014-10-21 11:06:26 +0800 | [diff] [blame] | 138 | PROPERTIES |
| 139 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 140 | target_link_libraries(vk_blit_tests ${LIBVK} gtest gtest_main ${TEST_LIBRARIES}) |
Chia-I Wu | d7414b0 | 2014-10-21 11:06:26 +0800 | [diff] [blame] | 141 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 142 | add_executable(vk_layer_validation_tests layer_validation_tests.cpp ${COMMON_CPP}) |
| 143 | set_target_properties(vk_layer_validation_tests |
Tony Barbour | 300a608 | 2015-04-07 13:44:53 -0600 | [diff] [blame] | 144 | PROPERTIES |
| 145 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Tony Barbour | bcf05fd | 2015-07-13 12:32:00 -0600 | [diff] [blame] | 146 | target_link_libraries(vk_layer_validation_tests ${LIBVK} gtest gtest_main layer_utils ${TEST_LIBRARIES}) |
Tony Barbour | 300a608 | 2015-04-07 13:44:53 -0600 | [diff] [blame] | 147 | |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 148 | add_subdirectory(gtest-1.7.0) |