From 48cbbcfeb3531a819edd74e072ca3c4b4379c5a3 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Fri, 19 Sep 2025 08:45:30 -0700 Subject: Fix SPIRV headers precedence (#8481) Remove SYSTEM flag from SPIRV-Headers to fix MacOS header precedence. When the path is registered as SYSTEM, it is used with `-isystem` option not `-I` option and it gets less searching order on MacOS. When spirv.h is installed on the system directory, it will end up using the system installed spirv.h, which is most likely an older version than we should use. --- external/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index e0dcdfb40..6b8b5a527 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -105,6 +105,8 @@ target_include_directories( ) # SPIRV-Headers +# Avoid using ${system} intentionally in `add_subdirectory`, because if we do, it will end up using +# spirv.h installed in the system directory on MacOS. if(NOT TARGET SPIRV-Headers) if(SLANG_USE_SYSTEM_SPIRV_HEADERS) if(SLANG_OVERRIDE_SPIRV_HEADERS_PATH) @@ -118,10 +120,9 @@ if(NOT TARGET SPIRV-Headers) ${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}/spirv-headers spirv-headers EXCLUDE_FROM_ALL - ${system} ) else() - add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system}) + add_subdirectory(spirv-headers EXCLUDE_FROM_ALL) endif() endif() @@ -205,13 +206,12 @@ if(SLANG_ENABLE_SLANG_GLSLANG) # Tools if(NOT SLANG_OVERRIDE_SPIRV_TOOLS_PATH) - add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system}) + add_subdirectory(spirv-tools EXCLUDE_FROM_ALL) else() add_subdirectory( ${SLANG_OVERRIDE_SPIRV_TOOLS_PATH}/spirv-tools spirv-tools EXCLUDE_FROM_ALL - ${system} ) endif() endif() -- cgit v1.2.3