blob: 5db4f616f255162936f65162a36b513d8ca3067a [file] [log] [blame]
Courtney Goeltzenleuchterf21d32d2014-09-01 13:57:15 -06001include (FindPkgConfig)
2
Tony Barbour96db8822015-02-25 12:28:39 -07003if(NOT WIN32)
4 find_package(XCB REQUIRED)
5endif()
6
Chia-I Wuec664fa2014-12-02 11:54:24 +08007find_package(ImageMagick COMPONENTS MagickWand)
8
Courtney Goeltzenleuchterfdcfb9f2014-10-10 18:04:39 -06009if(NOT EXISTS /usr/include/glm/glm.hpp)
10 message(FATAL_ERROR "Necessary libglm-dev headers cannot be found: sudo apt-get install libglm-dev")
11endif()
Courtney Goeltzenleuchterf21d32d2014-09-01 13:57:15 -060012
Chia-I Wuec664fa2014-12-02 11:54:24 +080013if(NOT ImageMagick_FOUND)
14 message(FATAL_ERROR "Missing ImageMagick library: sudo apt-get install libmagickwand-dev")
15endif()
16
Ian Elliott661dc372015-02-13 14:04:01 -070017set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DXGL_PROTOTYPES -Wno-sign-compare")
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060018
Courtney Goeltzenleuchter24cec9b2014-08-11 13:15:04 -060019SET(COMMON_CPP
Courtney Goeltzenleuchtera4b278b2014-10-08 08:50:49 -060020 xglrenderframework.cpp
Chia-I Wua9a506a2014-12-27 22:04:00 +080021 xgltestbinding.cpp
Courtney Goeltzenleuchter54119a32014-09-04 16:26:02 -060022 xgltestframework.cpp
Tony Barbour92400bb2015-03-02 16:38:52 -070023 test_environment.cpp
Courtney Goeltzenleuchter24cec9b2014-08-11 13:15:04 -060024 )
25
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060026# Expect libraries to be in either the build (release build) or dbuild (debug) directories
27if(EXISTS ${GLSLANG_PREFIX}/build/install/lib)
28 set(GLSLANG_BUILD ${GLSLANG_PREFIX}/build)
29elseif(EXISTS ${GLSLANG_PREFIX}/dbuild/install/lib)
30 set(GLSLANG_BUILD ${GLSLANG_PREFIX}/dbuild)
31else()
32 message(FATAL_ERROR "Necessary glslang libraries cannot be found: " ${GLSLANG_PREFIX})
33endif()
34
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060035link_directories(
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060036 "${GLSLANG_BUILD}/install/lib"
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060037 )
38
39
40set(TEST_LIBRARIES
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060041 glslang
42 OGLCompiler
43 OSDependent
Steve Kc1638cc2015-03-17 09:40:23 -060044 SPIRV
Tony Barbour96db8822015-02-25 12:28:39 -070045 ${XCB_LIBRARIES}
Chia-I Wuec664fa2014-12-02 11:54:24 +080046 ${ImageMagick_LIBRARIES}
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060047 )
48
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -060049include_directories(
50 "${PROJECT_SOURCE_DIR}/tests/gtest-1.7.0/include"
51 "${PROJECT_SOURCE_DIR}/icd/common"
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060052 "${GLSLANG_PREFIX}/glslang/Include"
53 "${GLSLANG_PREFIX}/glslang/Public"
Steve Kc1638cc2015-03-17 09:40:23 -060054 "${GLSLANG_PREFIX}/SPIRV"
Tony Barbour96db8822015-02-25 12:28:39 -070055 ${XCB_INCLUDE_DIRS}
Chia-I Wuec664fa2014-12-02 11:54:24 +080056 ${ImageMagick_INCLUDE_DIRS}
Courtney Goeltzenleuchter6863ff42014-08-19 13:34:28 -060057 )
Courtney Goeltzenleuchter24cec9b2014-08-11 13:15:04 -060058
Chia-I Wuec664fa2014-12-02 11:54:24 +080059add_definitions(
60 -DMAGICKCORE_QUANTUM_DEPTH=16
61 -DMAGICKCORE_HDRI_ENABLE=0
62 )
Courtney Goeltzenleuchter24cec9b2014-08-11 13:15:04 -060063
Courtney Goeltzenleuchter2953ed32014-12-08 13:17:04 -070064# extra setup for out-of-tree builds
Chia-I Wu05c71812014-12-06 10:22:40 +080065if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR))
Courtney Goeltzenleuchter2953ed32014-12-08 13:17:04 -070066 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 Ehlisd22e3ff2015-03-27 11:47:10 -060069 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 Wu05c71812014-12-06 10:22:40 +080071 VERBATIM
72 )
73endif()
74
Courtney Goeltzenleuchtercc9da542014-08-12 14:12:22 -060075add_executable(xglbase init.cpp ${COMMON_CPP})
76set_target_properties(xglbase
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060077 PROPERTIES
78 COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060079target_link_libraries(xglbase XGL gtest gtest_main ${TEST_LIBRARIES})
Courtney Goeltzenleuchter447ed582014-08-11 18:19:35 -060080
Courtney Goeltzenleuchter80ea59a2014-08-14 17:41:57 -060081add_executable(xgl_image_tests image_tests.cpp ${COMMON_CPP})
82set_target_properties(xgl_image_tests
83 PROPERTIES
84 COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060085target_link_libraries(xgl_image_tests XGL gtest gtest_main ${TEST_LIBRARIES})
Courtney Goeltzenleuchter80ea59a2014-08-14 17:41:57 -060086
Chia-I Wue34256d2014-12-16 13:37:18 +080087add_executable(xgl_render_tests render_tests.cpp ${COMMON_CPP})
Courtney Goeltzenleuchtercc5eb3a2014-08-19 18:35:50 -060088set_target_properties(xgl_render_tests
89 PROPERTIES
90 COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
Courtney Goeltzenleuchter9818f782014-10-03 09:53:32 -060091target_link_libraries(xgl_render_tests XGL gtest gtest_main ${TEST_LIBRARIES})
Courtney Goeltzenleuchtercc5eb3a2014-08-19 18:35:50 -060092
Chia-I Wue34256d2014-12-16 13:37:18 +080093add_executable(xgl_blit_tests blit_tests.cpp ${COMMON_CPP})
Chia-I Wud7414b02014-10-21 11:06:26 +080094set_target_properties(xgl_blit_tests
95 PROPERTIES
96 COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
97target_link_libraries(xgl_blit_tests XGL gtest gtest_main ${TEST_LIBRARIES})
98
Courtney Goeltzenleuchter24cec9b2014-08-11 13:15:04 -060099add_subdirectory(gtest-1.7.0)