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