Commit 92c7c2c3 authored by Brad King's avatar Brad King 💬 Committed by Kitware Robot
Browse files

Merge topic 'findvulkan-improvements'

7974fcd1 FindVulkan: remove noop on CMAKE_MODULE_PATH in tests
acdb5fe0 FindVulkan: Add component for `glslc` and `glslangValidator`
998ee497 FindVulkan: ensure policy CMP0057 is NEW to use `IN_LIST` with `if()`
9f8720e7 FindVulkan: Add component for `glslang`
8d133f49 FindVulkan: Add component for `SPIRV-Tools`
6e4d2092 FindVulkan: Add component for `shaderc_combined`
2f46b8d7 FindVulkan: Move `mark_as_advanced` right after `find_*` calls.
08a420af

 FindVulkan: Factorize code for library/executable search
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !7225
parents 06314337 7974fcd1
This diff is collapsed.
cmake_minimum_required(VERSION 3.4)
cmake_policy(SET CMP0091 NEW)
project(TestFindVulkan C CXX)
include(CTest)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../)
find_package(Vulkan REQUIRED)
find_package(Vulkan REQUIRED
COMPONENTS
glslang
shaderc_combined
SPIRV-Tools)
add_executable(test_tgt main.c)
target_link_libraries(test_tgt Vulkan::Vulkan)
......@@ -23,6 +27,39 @@ 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)
get_property(shaderc_combined_debug_location TARGET Vulkan::shaderc_combined PROPERTY IMPORTED_LOCATION_DEBUG)
if(NOT shaderc_combined_debug_location)
set_property(TARGET test_tgt_shaderc_combined
PROPERTY
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}
......
#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;
}
#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;
}
#include <assert.h>
#include <shaderc/shaderc.h>
#include <stdio.h>
int main()
{
unsigned int shaderc_version, shaderc_revision;
shaderc_get_spv_version(&shaderc_version, &shaderc_revision);
printf("shaderc version: %u (revision: %u)", shaderc_version,
shaderc_revision);
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment