Modernise CMake
* Use `GNUInstallDirs` in order to respect GNU conventions. This is especially important for multi-arch/multi-lib setups. * Specify position independent mode building properly, without using the historic hack of adding `-fPIC` as a definition. This makes the build system more portable. * Only detect C++ (and not C) to slightly speed up configuring. * Specify C++11 mode using modern CMake idioms. * Fix some whitespace issues.
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
if (TARGET gmock)
|
||||
message(STATUS "Google Mock found - building tests")
|
||||
message(STATUS "Google Mock found - building tests")
|
||||
|
||||
set(TEST_SOURCES
|
||||
# Framework related source files
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Settings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h
|
||||
set(TEST_SOURCES
|
||||
# Framework related source files
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Settings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h
|
||||
|
||||
# Test related source files
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp
|
||||
# -- Remapper tests
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp
|
||||
)
|
||||
# Test related source files
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp
|
||||
|
||||
add_executable(glslangtests ${TEST_SOURCES})
|
||||
set_property(TARGET glslangtests PROPERTY FOLDER tests)
|
||||
glslang_set_link_args(glslangtests)
|
||||
install(TARGETS glslangtests
|
||||
RUNTIME DESTINATION bin)
|
||||
# -- Remapper tests
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp)
|
||||
|
||||
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
|
||||
# Supply a default test root directory, so that manual testing
|
||||
# doesn't have to specify the --test-root option in the normal
|
||||
# case that you want to use the tests from the same source tree.
|
||||
target_compile_definitions(glslangtests
|
||||
PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}")
|
||||
target_include_directories(glslangtests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${gmock_SOURCE_DIR}/include
|
||||
${gtest_SOURCE_DIR}/include)
|
||||
add_executable(glslangtests ${TEST_SOURCES})
|
||||
set_property(TARGET glslangtests PROPERTY FOLDER tests)
|
||||
glslang_set_link_args(glslangtests)
|
||||
install(TARGETS glslangtests
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
set(LIBRARIES
|
||||
SPVRemapper glslang OSDependent OGLCompiler glslang
|
||||
SPIRV glslang-default-resource-limits)
|
||||
if(ENABLE_HLSL)
|
||||
set(LIBRARIES ${LIBRARIES} HLSL)
|
||||
endif(ENABLE_HLSL)
|
||||
target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock)
|
||||
set(GLSLANG_TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Test")
|
||||
# Supply a default test root directory, so that manual testing
|
||||
# doesn't have to specify the --test-root option in the normal
|
||||
# case that you want to use the tests from the same source tree.
|
||||
target_compile_definitions(glslangtests
|
||||
PRIVATE GLSLANG_TEST_DIRECTORY="${GLSLANG_TEST_DIRECTORY}")
|
||||
target_include_directories(glslangtests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${gmock_SOURCE_DIR}/include
|
||||
${gtest_SOURCE_DIR}/include)
|
||||
|
||||
add_test(NAME glslang-gtests
|
||||
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
|
||||
set(LIBRARIES
|
||||
SPVRemapper glslang OSDependent OGLCompiler glslang
|
||||
SPIRV glslang-default-resource-limits)
|
||||
if(ENABLE_HLSL)
|
||||
set(LIBRARIES ${LIBRARIES} HLSL)
|
||||
endif(ENABLE_HLSL)
|
||||
target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock)
|
||||
|
||||
add_test(NAME glslang-gtests
|
||||
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user