--- CMakeLists.txt 2025-12-02 11:10:01.000000000 +0800 +++ CMakeLists.txt 2025-12-26 07:56:13.000000000 +0800 @@ -277,27 +277,11 @@ add_subdirectory(External) endif() -option(ALLOW_EXTERNAL_SPIRV_TOOLS "Allows to build against installed SPIRV-Tools-opt. This is unsupported if the commit isn't the one in known_good.json") -if(NOT TARGET SPIRV-Tools-opt) - if(ALLOW_EXTERNAL_SPIRV_TOOLS) - # Look for external SPIR-V Tools build, if not building in-tree - message(STATUS "Trying to find local SPIR-V tools") - find_package(SPIRV-Tools-opt) - if(NOT TARGET SPIRV-Tools-opt) - if(ENABLE_OPT) - message(SEND_ERROR "ENABLE_OPT set but SPIR-V tools not found! Disabling SPIR-V optimization.") - endif() - set(ENABLE_OPT OFF) - endif() - else() - if(ENABLE_OPT) - message(SEND_ERROR "ENABLE_OPT set but SPIR-V tools not found. Please run update_glslang_sources.py, " - "set the ALLOW_EXTERNAL_SPIRV_TOOLS option to use a local install of SPIRV-Tools, or set ENABLE_OPT=0.") - endif() - endif() -endif() - if(ENABLE_OPT) + # Look for external SPIR-V Tools build, if not building in-tree + message(STATUS "Trying to find local SPIR-V tools") + find_package(PkgConfig REQUIRED) + pkg_check_modules(SPIRV-Tools-opt REQUIRED SPIRV-Tools) message(STATUS "optimizer enabled") add_compile_definitions(ENABLE_OPT=1) else() --- SPIRV/CMakeLists.txt 2025-12-02 11:10:01.000000000 +0800 +++ SPIRV/CMakeLists.txt 2025-12-26 07:53:53.000000000 +0800 @@ -90,7 +90,7 @@ endif() if(ENABLE_OPT) - target_link_libraries(SPIRV INTERFACE glslang PUBLIC SPIRV-Tools-opt) + target_link_libraries(SPIRV INTERFACE glslang PUBLIC SPIRV-Tools SPIRV-Tools-opt) target_include_directories(SPIRV PUBLIC $) else() --- glslang/CMakeLists.txt 2025-12-02 11:10:01.000000000 +0800 +++ glslang/CMakeLists.txt 2025-12-26 07:51:56.000000000 +0800 @@ -193,7 +193,7 @@ if(ENABLE_OPT) target_include_directories(glslang PUBLIC $) - target_link_libraries(glslang SPIRV-Tools-opt) + target_link_libraries(glslang SPIRV-Tools SPIRV-Tools-opt) endif() endif()