diff options
author | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-13 22:34:27 (GMT) |
---|---|---|
committer | MACHIZAUD Andréa <andrea.machizaud@gmail.com> | 2022-05-18 21:16:11 (GMT) |
commit | acdb5fe0e842cfd667c00d8f24d37479aa05304f (patch) | |
tree | c19916bab06c8fff3be8a1a86e72defd1b61876e /Modules/FindVulkan.cmake | |
parent | 998ee49779147372f58b66464860bc0cd159a7ce (diff) | |
download | CMake-acdb5fe0e842cfd667c00d8f24d37479aa05304f.zip CMake-acdb5fe0e842cfd667c00d8f24d37479aa05304f.tar.gz CMake-acdb5fe0e842cfd667c00d8f24d37479aa05304f.tar.bz2 |
FindVulkan: Add component for `glslc` and `glslangValidator`
For backward compatibility with previous CMake versions they are implicitly added to the list of components
Diffstat (limited to 'Modules/FindVulkan.cmake')
-rw-r--r-- | Modules/FindVulkan.cmake | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake index d72dc30..7a32c2f 100644 --- a/Modules/FindVulkan.cmake +++ b/Modules/FindVulkan.cmake @@ -15,9 +15,9 @@ Optional COMPONENTS .. versionadded:: 3.24 -This module respects several optional COMPONENTS: ``glslang`` ``shaderc_combined`` and -``SPIRV-Tools``. There are corresponding import targets for each of these -flags. +This module respects several optional COMPONENTS: ``glslc``, +``glslangValidator``, ``glslang``, ``shaderc_combined`` and ``SPIRV-Tools``. +There are corresponding import targets for each of these flags. IMPORTED Targets ^^^^^^^^^^^^^^^^ @@ -78,6 +78,14 @@ This module defines the following variables: .. versionadded:: 3.23 value from ``vulkan/vulkan_core.h`` +``Vulkan_glslc_FOUND`` + .. versionadded:: 3.24 + + True, if the SDK has the glslc executable. +``Vulkan_glslangValidator_FOUND`` + .. versionadded:: 3.24 + + True, if the SDK has the glslangValidator executable. ``Vulkan_glslang_FOUND`` .. versionadded:: 3.24 @@ -130,6 +138,15 @@ environment. cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) +# For backward compatibility as `FindVulkan` in previous CMake versions allow to retrieve `glslc` +# and `glslangValidator` without requesting the corresponding component. +if(NOT glslc IN_LIST Vulkan_FIND_COMPONENTS) + list(APPEND Vulkan_FIND_COMPONENTS glslc) +endif() +if(NOT glslangValidator IN_LIST Vulkan_FIND_COMPONENTS) + list(APPEND Vulkan_FIND_COMPONENTS glslangValidator) +endif() + if(WIN32) set(_Vulkan_library_name vulkan-1) set(_Vulkan_hint_include_search_paths @@ -179,20 +196,22 @@ find_library(Vulkan_LIBRARY ) mark_as_advanced(Vulkan_LIBRARY) -find_program(Vulkan_GLSLC_EXECUTABLE - NAMES glslc - HINTS - ${_Vulkan_hint_executable_search_paths} - ) -mark_as_advanced(Vulkan_GLSLC_EXECUTABLE) - -find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE - NAMES glslangValidator - HINTS - ${_Vulkan_hint_executable_search_paths} - ) -mark_as_advanced(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) - +if(glslc IN_LIST Vulkan_FIND_COMPONENTS) + find_program(Vulkan_GLSLC_EXECUTABLE + NAMES glslc + HINTS + ${_Vulkan_hint_executable_search_paths} + ) + mark_as_advanced(Vulkan_GLSLC_EXECUTABLE) +endif() +if(glslangValidator IN_LIST Vulkan_FIND_COMPONENTS) + find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE + NAMES glslangValidator + HINTS + ${_Vulkan_hint_executable_search_paths} + ) + mark_as_advanced(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) +endif() if(glslang IN_LIST Vulkan_FIND_COMPONENTS) find_library(Vulkan_glslang-spirv_LIBRARY NAMES SPIRV @@ -305,6 +324,18 @@ if(SPIRV-Tools IN_LIST Vulkan_FIND_COMPONENTS) mark_as_advanced(Vulkan_SPIRV-Tools_DEBUG_LIBRARY) endif() +if(Vulkan_GLSLC_EXECUTABLE) + set(Vulkan_glslc_FOUND TRUE) +else() + set(Vulkan_glslc_FOUND FALSE) +endif() + +if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE) + set(Vulkan_glslangValidator_FOUND TRUE) +else() + set(Vulkan_glslangValidator_FOUND FALSE) +endif() + function(_Vulkan_set_library_component_found component) cmake_parse_arguments(PARSE_ARGV 1 _ARG "NO_WARNING" |