From 619de903b70e08a7ca8471419e8eb7e4dd43ca9d Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Wed, 20 Aug 2025 21:52:42 +0200 Subject: Add more system dependency options to CMake (#7987) Allows opt-in for sourcing the following dependencies from the system, instead of using the vendored ones: - miniz - lz4 - vulkan-headers - spirv-tools - glslang (some of these already had options that weren't working, as either it expected them to be static libraries or it was expecting to be embedded in another CMakeList that should provide the package, instead of finding the package itself) This is based on a patch we currently maintain inside nixpkgs, but as it frequently conflicts with new slang releases, it would be nice to see get this upstream. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Sam Estep --- external/CMakeLists.txt | 59 +++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'external') diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d8b4c2bca..faa8a5730 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -142,35 +142,40 @@ if(SLANG_ENABLE_SLANG_GLSLANG) ) endif() - # SPIRV-Tools - set(SPIRV_TOOLS_BUILD_STATIC ON) - set(SPIRV_WERROR OFF) - set(SPIRV_SKIP_TESTS ON) - # Tools - if(NOT SLANG_OVERRIDE_SPIRV_TOOLS_PATH) - add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system}) - else() - add_subdirectory( - ${SLANG_OVERRIDE_SPIRV_TOOLS_PATH}/spirv-tools - spirv-tools - EXCLUDE_FROM_ALL - ${system} - ) + if(NOT ${SLANG_USE_SYSTEM_SPIRV_TOOLS}) + # SPIRV-Tools + set(SPIRV_TOOLS_BUILD_STATIC ON) + set(SPIRV_WERROR OFF) + set(SPIRV_SKIP_TESTS ON) + # Tools + if(NOT SLANG_OVERRIDE_SPIRV_TOOLS_PATH) + add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_SPIRV_TOOLS_PATH}/spirv-tools + spirv-tools + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() - # glslang - set(SKIP_GLSLANG_INSTALL ON) - set(ENABLE_OPT ON) - set(ENABLE_PCH OFF) - if(NOT SLANG_OVERRIDE_GLSLANG_PATH) - add_subdirectory(glslang EXCLUDE_FROM_ALL ${system}) - else() - add_subdirectory( - ${SLANG_OVERRIDE_GLSLANG_PATH}/glslang - glslang - EXCLUDE_FROM_ALL - ${system} - ) + if(NOT ${SLANG_USE_SYSTEM_GLSLANG}) + # glslang + set(SKIP_GLSLANG_INSTALL ON) + set(ENABLE_OPT ON) + set(ENABLE_PCH OFF) + set(ALLOW_EXTERNAL_SPIRV_TOOLS ${SLANG_USE_SYSTEM_SPIRV_TOOLS}) + if(NOT SLANG_OVERRIDE_GLSLANG_PATH) + add_subdirectory(glslang EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_GLSLANG_PATH}/glslang + glslang + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() endif() -- cgit v1.2.3