David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 1 | if(BUILD_TESTING) |
| 2 | if(TARGET gmock) |
| 3 | message(STATUS "Google Mock found - building tests") |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 4 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 5 | set(TEST_SOURCES |
| 6 | # Framework related source files |
| 7 | ${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h |
| 8 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp |
| 9 | ${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp |
| 10 | ${CMAKE_CURRENT_SOURCE_DIR}/Settings.h |
| 11 | ${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp |
| 12 | ${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 13 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 14 | # Test related source files |
| 15 | ${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp |
| 16 | ${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp |
| 17 | ${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp |
| 18 | ${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp |
| 19 | ${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp |
| 20 | ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp |
| 21 | ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp |
| 22 | ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp |
| 23 | ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 24 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 25 | # -- Remapper tests |
| 26 | ${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp) |
Andrew Woloszyn | 0b887d0 | 2016-05-05 14:58:26 -0400 | [diff] [blame] | 27 | |
Jeff Bolz | 02ed310 | 2018-11-07 09:35:20 -0600 | [diff] [blame^] | 28 | glslang_pch(TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/pch.cpp) |
Jeff Bolz | 22d0b7c | 2018-10-31 15:38:08 -0500 | [diff] [blame] | 29 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 30 | add_executable(glslangtests ${TEST_SOURCES}) |
| 31 | set_property(TARGET glslangtests PROPERTY FOLDER tests) |
| 32 | glslang_set_link_args(glslangtests) |
d3x0r | 57a2b22 | 2017-07-04 05:59:03 -0700 | [diff] [blame] | 33 | if(ENABLE_GLSLANG_INSTALL) |
| 34 | install(TARGETS glslangtests |
| 35 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
| 36 | endif(ENABLE_GLSLANG_INSTALL) |
John Kessenich | dc1a819 | 2017-01-11 14:50:16 -0700 | [diff] [blame] | 37 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 38 | set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test") |
| 39 | # Supply a default test root directory, so that manual testing |
| 40 | # doesn't have to specify the --test-root option in the normal |
| 41 | # case that you want to use the tests from the same source tree. |
| 42 | target_compile_definitions(glslangtests |
| 43 | PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}") |
| 44 | target_include_directories(glslangtests PRIVATE |
| 45 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 46 | ${PROJECT_SOURCE_DIR} |
| 47 | ${gmock_SOURCE_DIR}/include |
| 48 | ${gtest_SOURCE_DIR}/include) |
John Kessenich | dc1a819 | 2017-01-11 14:50:16 -0700 | [diff] [blame] | 49 | |
David Seifert | 22afc38 | 2017-04-29 10:57:36 +0200 | [diff] [blame] | 50 | set(LIBRARIES |
| 51 | SPVRemapper glslang OSDependent OGLCompiler glslang |
| 52 | SPIRV glslang-default-resource-limits) |
| 53 | if(ENABLE_HLSL) |
| 54 | set(LIBRARIES ${LIBRARIES} HLSL) |
| 55 | endif(ENABLE_HLSL) |
| 56 | target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock) |
| 57 | |
| 58 | add_test(NAME glslang-gtests |
| 59 | COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}") |
| 60 | endif() |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 61 | endif() |