diff options
author | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-18 15:18:57 (GMT) |
---|---|---|
committer | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-18 21:15:50 (GMT) |
commit | 8d133f49e31d049b782dffaf2d444486f9461702 (patch) | |
tree | d86d921e5318721d167d16fd0170a222082ebbd8 /Tests/FindVulkan/Test | |
parent | 6e4d20921d92458890837859ad36d1783331abc8 (diff) | |
download | CMake-8d133f49e31d049b782dffaf2d444486f9461702.zip CMake-8d133f49e31d049b782dffaf2d444486f9461702.tar.gz CMake-8d133f49e31d049b782dffaf2d444486f9461702.tar.bz2 |
FindVulkan: Add component for `SPIRV-Tools`
Diffstat (limited to 'Tests/FindVulkan/Test')
-rw-r--r-- | Tests/FindVulkan/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindVulkan/Test/main-SPIRV-Tools.c | 15 |
2 files changed, 28 insertions, 1 deletions
diff --git a/Tests/FindVulkan/Test/CMakeLists.txt b/Tests/FindVulkan/Test/CMakeLists.txt index 005497c..be407c5 100644 --- a/Tests/FindVulkan/Test/CMakeLists.txt +++ b/Tests/FindVulkan/Test/CMakeLists.txt @@ -6,7 +6,8 @@ include(CTest) SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../Modules) find_package(Vulkan REQUIRED COMPONENTS - shaderc_combined) + shaderc_combined + SPIRV-Tools) add_executable(test_tgt main.c) target_link_libraries(test_tgt Vulkan::Vulkan) @@ -37,6 +38,17 @@ if(NOT shaderc_combined_debug_location) MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") endif() +add_executable(test_tgt_SPIRV-Tools main-SPIRV-Tools.c) +target_link_libraries(test_tgt_SPIRV-Tools Vulkan::SPIRV-Tools) +add_test(NAME test_tgt_SPIRV-Tools COMMAND test_tgt_SPIRV-Tools) + +get_property(SPIRV-Tools_debug_location TARGET Vulkan::SPIRV-Tools PROPERTY IMPORTED_LOCATION_DEBUG) +if(NOT SPIRV-Tools_debug_location) + set_property(TARGET test_tgt_SPIRV-Tools + PROPERTY + MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +endif() + if(Vulkan_GLSLC_EXECUTABLE) add_test(NAME test_glslc COMMAND ${CMAKE_COMMAND} diff --git a/Tests/FindVulkan/Test/main-SPIRV-Tools.c b/Tests/FindVulkan/Test/main-SPIRV-Tools.c new file mode 100644 index 0000000..097198d --- /dev/null +++ b/Tests/FindVulkan/Test/main-SPIRV-Tools.c @@ -0,0 +1,15 @@ +#include <assert.h> +#include <spirv-tools/libspirv.h> +#include <stdio.h> + +int main() +{ + const char* spv_version = spvSoftwareVersionString(); + const char* spv_details = spvSoftwareVersionDetailsString(); + assert(spv_version); + assert(spv_details); + + printf("SPIRV-Tools version: %s (details: %s)", spv_version, spv_details); + + return 0; +} |