Courtney Goeltzenleuchter | f21d32d | 2014-09-01 13:57:15 -0600 | [diff] [blame] | 1 | include (FindPkgConfig) |
| 2 | |
Tony Barbour | 96db882 | 2015-02-25 12:28:39 -0700 | [diff] [blame] | 3 | if(NOT WIN32) |
| 4 | find_package(XCB REQUIRED) |
| 5 | endif() |
| 6 | |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 7 | find_package(ImageMagick COMPONENTS MagickWand) |
| 8 | |
Courtney Goeltzenleuchter | fdcfb9f | 2014-10-10 18:04:39 -0600 | [diff] [blame] | 9 | if(NOT EXISTS /usr/include/glm/glm.hpp) |
| 10 | message(FATAL_ERROR "Necessary libglm-dev headers cannot be found: sudo apt-get install libglm-dev") |
| 11 | endif() |
Courtney Goeltzenleuchter | f21d32d | 2014-09-01 13:57:15 -0600 | [diff] [blame] | 12 | |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 13 | if(NOT ImageMagick_FOUND) |
| 14 | message(FATAL_ERROR "Missing ImageMagick library: sudo apt-get install libmagickwand-dev") |
| 15 | endif() |
| 16 | |
Ian Elliott | 661dc37 | 2015-02-13 14:04:01 -0700 | [diff] [blame] | 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXGL_PROTOTYPES -Wno-sign-compare") |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 18 | |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 19 | SET(COMMON_CPP |
Courtney Goeltzenleuchter | a4b278b | 2014-10-08 08:50:49 -0600 | [diff] [blame] | 20 | xglrenderframework.cpp |
Chia-I Wu | a9a506a | 2014-12-27 22:04:00 +0800 | [diff] [blame] | 21 | xgltestbinding.cpp |
Courtney Goeltzenleuchter | 54119a3 | 2014-09-04 16:26:02 -0600 | [diff] [blame] | 22 | xgltestframework.cpp |
Tony Barbour | 92400bb | 2015-03-02 16:38:52 -0700 | [diff] [blame] | 23 | test_environment.cpp |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 24 | ) |
| 25 | |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 26 | # Expect libraries to be in either the build (release build) or dbuild (debug) directories |
| 27 | if(EXISTS ${GLSLANG_PREFIX}/build/install/lib) |
| 28 | set(GLSLANG_BUILD ${GLSLANG_PREFIX}/build) |
| 29 | elseif(EXISTS ${GLSLANG_PREFIX}/dbuild/install/lib) |
| 30 | set(GLSLANG_BUILD ${GLSLANG_PREFIX}/dbuild) |
| 31 | else() |
| 32 | message(FATAL_ERROR "Necessary glslang libraries cannot be found: " ${GLSLANG_PREFIX}) |
| 33 | endif() |
| 34 | |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 35 | link_directories( |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 36 | "${GLSLANG_BUILD}/install/lib" |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 37 | ) |
| 38 | |
| 39 | |
| 40 | set(TEST_LIBRARIES |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 41 | glslang |
| 42 | OGLCompiler |
| 43 | OSDependent |
Steve K | c1638cc | 2015-03-17 09:40:23 -0600 | [diff] [blame] | 44 | SPIRV |
Tony Barbour | 96db882 | 2015-02-25 12:28:39 -0700 | [diff] [blame] | 45 | ${XCB_LIBRARIES} |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 46 | ${ImageMagick_LIBRARIES} |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 47 | ) |
| 48 | |
Courtney Goeltzenleuchter | 6863ff4 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 49 | include_directories( |
| 50 | "${PROJECT_SOURCE_DIR}/tests/gtest-1.7.0/include" |
| 51 | "${PROJECT_SOURCE_DIR}/icd/common" |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 52 | "${GLSLANG_PREFIX}/glslang/Include" |
| 53 | "${GLSLANG_PREFIX}/glslang/Public" |
Steve K | c1638cc | 2015-03-17 09:40:23 -0600 | [diff] [blame] | 54 | "${GLSLANG_PREFIX}/SPIRV" |
Tony Barbour | 96db882 | 2015-02-25 12:28:39 -0700 | [diff] [blame] | 55 | ${XCB_INCLUDE_DIRS} |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 56 | ${ImageMagick_INCLUDE_DIRS} |
Courtney Goeltzenleuchter | 6863ff4 | 2014-08-19 13:34:28 -0600 | [diff] [blame] | 57 | ) |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 58 | |
Chia-I Wu | ec664fa | 2014-12-02 11:54:24 +0800 | [diff] [blame] | 59 | add_definitions( |
| 60 | -DMAGICKCORE_QUANTUM_DEPTH=16 |
| 61 | -DMAGICKCORE_HDRI_ENABLE=0 |
| 62 | ) |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 63 | |
Courtney Goeltzenleuchter | 2953ed3 | 2014-12-08 13:17:04 -0700 | [diff] [blame] | 64 | # extra setup for out-of-tree builds |
Chia-I Wu | 05c7181 | 2014-12-06 10:22:40 +0800 | [diff] [blame] | 65 | if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) |
Courtney Goeltzenleuchter | 2953ed3 | 2014-12-08 13:17:04 -0700 | [diff] [blame] | 66 | add_custom_target(binary-dir-symlinks ALL |
| 67 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/golden |
| 68 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/run_all_tests.sh |
Tobin Ehlis | d22e3ff | 2015-03-27 11:47:10 -0600 | [diff] [blame] | 69 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/run_all_tests_with_layers.sh |
| 70 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/layer_test_suite.py |
Chia-I Wu | 05c7181 | 2014-12-06 10:22:40 +0800 | [diff] [blame] | 71 | VERBATIM |
| 72 | ) |
| 73 | endif() |
| 74 | |
Courtney Goeltzenleuchter | cc9da54 | 2014-08-12 14:12:22 -0600 | [diff] [blame] | 75 | add_executable(xglbase init.cpp ${COMMON_CPP}) |
| 76 | set_target_properties(xglbase |
Courtney Goeltzenleuchter | 447ed58 | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 77 | PROPERTIES |
| 78 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 79 | target_link_libraries(xglbase XGL gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | 447ed58 | 2014-08-11 18:19:35 -0600 | [diff] [blame] | 80 | |
Courtney Goeltzenleuchter | 80ea59a | 2014-08-14 17:41:57 -0600 | [diff] [blame] | 81 | add_executable(xgl_image_tests image_tests.cpp ${COMMON_CPP}) |
| 82 | set_target_properties(xgl_image_tests |
| 83 | PROPERTIES |
| 84 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 85 | target_link_libraries(xgl_image_tests XGL gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | 80ea59a | 2014-08-14 17:41:57 -0600 | [diff] [blame] | 86 | |
Chia-I Wu | e34256d | 2014-12-16 13:37:18 +0800 | [diff] [blame] | 87 | add_executable(xgl_render_tests render_tests.cpp ${COMMON_CPP}) |
Courtney Goeltzenleuchter | cc5eb3a | 2014-08-19 18:35:50 -0600 | [diff] [blame] | 88 | set_target_properties(xgl_render_tests |
| 89 | PROPERTIES |
| 90 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
Courtney Goeltzenleuchter | 9818f78 | 2014-10-03 09:53:32 -0600 | [diff] [blame] | 91 | target_link_libraries(xgl_render_tests XGL gtest gtest_main ${TEST_LIBRARIES}) |
Courtney Goeltzenleuchter | cc5eb3a | 2014-08-19 18:35:50 -0600 | [diff] [blame] | 92 | |
Chia-I Wu | e34256d | 2014-12-16 13:37:18 +0800 | [diff] [blame] | 93 | add_executable(xgl_blit_tests blit_tests.cpp ${COMMON_CPP}) |
Chia-I Wu | d7414b0 | 2014-10-21 11:06:26 +0800 | [diff] [blame] | 94 | set_target_properties(xgl_blit_tests |
| 95 | PROPERTIES |
| 96 | COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") |
| 97 | target_link_libraries(xgl_blit_tests XGL gtest gtest_main ${TEST_LIBRARIES}) |
| 98 | |
Courtney Goeltzenleuchter | 24cec9b | 2014-08-11 13:15:04 -0600 | [diff] [blame] | 99 | add_subdirectory(gtest-1.7.0) |