FindVulkan: Add components for `shaderc`, `SPIRV-Tools` and `glslang`
This MR fixes #23438 (closed) by improving FindVulkan.cmake
CMake modules allowing to reference more of the Vulkan SDK content.
Namely, it exposes as Vulkan package components:
-
shaderc_combined static library, exposed with Vulkan::shaderc-combined
target -
SPIRV-Tools static library, exposed with Vulkan::SPIRV-Tools
target -
glslang static library, exposed with Vulkan::glslang
target
Code also deal with a couple of requirement for those to work properly:
- Handle the debug library for some targets if they exists
- Handle intermediate libraries required for linking
- Handle dependent package when necessary (e.g. shaderc-combined depends on pthread)
Fixes: #23438 (closed)
EDIT:
glslang
is not included anymore as it can lead to linker error on Windows due to incompatible MSRC Runtime Library.
glslang
installed by default with the Vulkan SDK has been compiled with MultiThreadedDLL, whereas the default behavior when compiling code with CMake in Debug config uses MultiThreadedDLLDebug leading to the linker error.
It is possible to optionally install a debug glslang
library with the Vulkan SDK but as it is not done by default, users may run into this error often and without a clear clue on how to solve it.