diff options
Diffstat (limited to 'Modules/FindVulkan.cmake')
-rw-r--r-- | Modules/FindVulkan.cmake | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index 4b999b62a0..0ec60133ce 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -5,6 +5,8 @@ FindVulkan ---------- +.. versionadded:: 3.7 + Find Vulkan, which is a low-overhead, cross-platform 3D graphics and computing API. @@ -14,6 +16,9 @@ IMPORTED Targets This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if Vulkan has been found. +This module defines :prop_tgt:`IMPORTED` target ``Vulkan::glslc``, if +Vulkan and the GLSLC SPIR-V compiler has been found. + Result Variables ^^^^^^^^^^^^^^^^ @@ -23,10 +28,11 @@ This module defines the following variables:: Vulkan_INCLUDE_DIRS - include directories for Vulkan Vulkan_LIBRARIES - link against this library to use Vulkan -The module will also define two cache variables:: +The module will also define three cache variables:: - Vulkan_INCLUDE_DIR - the Vulkan include directory - Vulkan_LIBRARY - the path to the Vulkan library + Vulkan_INCLUDE_DIR - the Vulkan include directory + Vulkan_LIBRARY - the path to the Vulkan library + Vulkan_GLSLC_EXECUTABLE - the path to the GLSL SPIR-V compiler Hints ^^^^^ @@ -53,6 +59,11 @@ if(WIN32) "$ENV{VULKAN_SDK}/Lib" "$ENV{VULKAN_SDK}/Bin" ) + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS + "$ENV{VULKAN_SDK}/Bin" + ) elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(Vulkan_LIBRARY NAMES vulkan-1 @@ -60,6 +71,11 @@ if(WIN32) "$ENV{VULKAN_SDK}/Lib32" "$ENV{VULKAN_SDK}/Bin32" ) + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS + "$ENV{VULKAN_SDK}/Bin32" + ) endif() else() find_path(Vulkan_INCLUDE_DIR @@ -68,6 +84,9 @@ else() find_library(Vulkan_LIBRARY NAMES vulkan HINTS "$ENV{VULKAN_SDK}/lib") + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS "$ENV{VULKAN_SDK}/bin") endif() set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) @@ -78,7 +97,7 @@ find_package_handle_standard_args(Vulkan DEFAULT_MSG Vulkan_LIBRARY Vulkan_INCLUDE_DIR) -mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) +mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY Vulkan_GLSLC_EXECUTABLE) if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) add_library(Vulkan::Vulkan UNKNOWN IMPORTED) @@ -86,3 +105,8 @@ if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) IMPORTED_LOCATION "${Vulkan_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") endif() + +if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc) + add_executable(Vulkan::glslc IMPORTED) + set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}") +endif() |