diff options
author | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-18 15:19:20 (GMT) |
---|---|---|
committer | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-18 21:16:09 (GMT) |
commit | 9f8720e74c01f209126a036d13aaccf15a1b4f07 (patch) | |
tree | 5346b3f5c41e37e08f3223ec0bebb14621437d64 /Tests | |
parent | 8d133f49e31d049b782dffaf2d444486f9461702 (diff) | |
download | CMake-9f8720e74c01f209126a036d13aaccf15a1b4f07.zip CMake-9f8720e74c01f209126a036d13aaccf15a1b4f07.tar.gz CMake-9f8720e74c01f209126a036d13aaccf15a1b4f07.tar.bz2 |
FindVulkan: Add component for `glslang`
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindVulkan/Test/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/FindVulkan/Test/main-glslang.cxx | 24 |
2 files changed, 36 insertions, 0 deletions
diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt index be407c5..99cf427 100644 --- a/Tests/FindVulkan/Test/CMakeLists.txt +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -6,6 +6,7 @@ include(CTest) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../Modules) find_package(Vulkan REQUIRED COMPONENTS + glslang shaderc_combined SPIRV-Tools) @@ -27,6 +28,17 @@ target_include_directories(test_var_dl PRIVATE ${Vulkan_INCLUDE_DIRS}) target_link_libraries(test_var_dl ${CMAKE_DL_LIBS}) add_test(NAME test_var_dl COMMAND test_var_dl) +add_executable(test_tgt_glslang main-glslang.cxx) +target_link_libraries(test_tgt_glslang Vulkan::glslang) +add_test(NAME test_tgt_glslang COMMAND test_tgt_glslang) + +get_property(glslang_debug_location TARGET Vulkan::glslang PROPERTY IMPORTED_LOCATION_DEBUG) +if(NOT glslang_debug_location) + set_property(TARGET test_tgt_glslang + PROPERTY + MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +endif() + add_executable(test_tgt_shaderc_combined main-shaderc_combined.cxx) target_link_libraries(test_tgt_shaderc_combined Vulkan::shaderc_combined) add_test(NAME test_tgt_shaderc_combined COMMAND test_tgt_shaderc_combined) diff --git a/Tests/FindVulkan/Test/main-glslang.cxx b/Tests/FindVulkan/Test/main-glslang.cxx new file mode 100644 index 0000000..81b18d6 --- /dev/null +++ b/Tests/FindVulkan/Test/main-glslang.cxx @@ -0,0 +1,24 @@ +#include <cassert> +#include <iostream> + +#include <glslang/Public/ShaderLang.h> + +int main() +{ + const glslang::Version glslang_version = glslang::GetVersion(); + const char* glslang_essl_version = glslang::GetEsslVersionString(); + const char* glslang_glsl_version = glslang::GetGlslVersionString(); + const int glslang_khronos_tool_id = glslang::GetKhronosToolId(); + + std::cout << "glslang Version: " << glslang_version.major << '.' + << glslang_version.minor << '.' << glslang_version.patch + << " (glsl version: " << glslang_glsl_version + << ", essl version:" << glslang_essl_version + << ", khronos tool:" << glslang_khronos_tool_id << ')' + << std::endl; + + assert(glslang_essl_version); + assert(glslang_glsl_version); + + return 0; +} |