blob: 787dfb7c450c644c53a63a8615b95e16b9216f49 [file] [log] [blame]
add_subdirectory(gmock-1.7.0)
set(OLD_PLATFORM_TOOLSET ${CMAKE_GENERATOR_TOOLSET})
# Configure third party projects.
add_subdirectory(glslang)
if(WIN32)
# This is unfortunate but glslang forces our
# platform toolset to be v110, which we may not even have
# installed, undo anything glslang has done to it.
set(CMAKE_GENERATOR_TOOLSET "${OLD_PLATFORM_TOOLSET}" CACHE STRING
"Platform Toolset" FORCE)
endif()
# Configure out-of-source-directory tests for glslang.
# The glslang project uses a bash script called "runtests" to run tests.
# The runtests script assumes the glslangValidator executable exists in
# a location inside the source tree, but we build it elsewhere.
# We need to copy the test files, fix the path references, and then run tests.
set(GLSLANG_TEST_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/glslang/Test)
set(GLSLANG_TEST_BIN_DIR
${CMAKE_CURRENT_BINARY_DIR}/test-glslang/${CMAKE_CFG_INTDIR})
# If we are building in a multi-configuration setting we have
# to put the glslang tests into their respective subdirectories.
if (CMAKE_CONFIGURATION_TYPES)
set(GLSLANG_CONFIGURATION_DIR ${CMAKE_CFG_INTDIR})
endif()
find_program(PYTHON python REQUIRED)
add_custom_target(copy-tests-if-necessary ALL
COMMAND ${PYTHON} ${shaderc_SOURCE_DIR}/utils/copy-tests-if-necessary.py
${GLSLANG_TEST_SRC_DIR} ${GLSLANG_TEST_BIN_DIR} ${GLSLANG_CONFIGURATION_DIR}
COMMENT "Copying and patching glslang tests if needed")
if (CMAKE_CONFIGURATION_TYPES)
# If we are running a multi-configuration project,
# the tests will be in test-glslang/${Configuration}
add_test(NAME glslang-testsuite
COMMAND bash runtests
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test-glslang/$<CONFIGURATION>
)
else()
add_test(NAME glslang-testsuite
COMMAND bash runtests
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test-glslang/
)
endif()