diff options
| author | jarcherNV <jarcher@nvidia.com> | 2025-03-06 19:16:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-07 03:16:27 +0000 |
| commit | 9d7d943db47dd7805a710431cf7eedc0bec8ecc7 (patch) | |
| tree | 851f51e2087f76b39ea19a8ca4ec8cf4555a4bb2 /external | |
| parent | 2aaa91007a9f91674033dcb9d88eb9ad7bacae96 (diff) | |
Update build to allow setting external paths (#6528)
* Update build to allow setting external paths
Update the build to allow setting user-specific paths for the external modules.
This allows building Slang without also fetching the external modules, assuming
they are already present elsewhere locally.
Diffstat (limited to 'external')
| -rw-r--r-- | external/CMakeLists.txt | 86 |
1 files changed, 78 insertions, 8 deletions
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index f23027f68..a590fe538 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -27,13 +27,32 @@ if(NOT SLANG_ENABLE_EXTERNAL_COMPILER_WARNINGS) endif() endif() +# Unordered dense if(NOT ${SLANG_USE_SYSTEM_UNORDERED_DENSE}) - add_subdirectory(unordered_dense EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_UNORDERED_DENSE_PATH) + add_subdirectory(unordered_dense EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_UNORDERED_DENSE_PATH} + unordered_dense + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() # Miniz if(NOT ${SLANG_USE_SYSTEM_MINIZ}) - add_subdirectory(miniz EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_MINIZ_PATH) + add_subdirectory(miniz EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_MINIZ_PATH} + miniz + EXCLUDE_FROM_ALL + ${system} + ) + endif() set_property(TARGET miniz PROPERTY POSITION_INDEPENDENT_CODE ON) # Work around https://github.com/richgel999/miniz/pull/292 get_target_property(miniz_c_launcher miniz C_COMPILER_LAUNCHER) @@ -46,7 +65,16 @@ endif() # LZ4 if(NOT ${SLANG_USE_SYSTEM_LZ4}) set(LZ4_BUNDLED_MODE ON) - add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_LZ4_PATH) + add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_LZ4_PATH}/build/cmake + lz4/build/cmake + EXCLUDE_FROM_ALL + ${system} + ) + endif() if(MSVC) target_compile_options( lz4_static @@ -57,7 +85,16 @@ endif() # Vulkan headers if(NOT ${SLANG_USE_SYSTEM_VULKAN_HEADERS}) - add_subdirectory(vulkan EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_VULKAN_HEADERS_PATH) + add_subdirectory(vulkan EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_VULKAN_HEADERS_PATH} + vulkan + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() # metal-cpp headers @@ -69,22 +106,55 @@ target_include_directories( # SPIRV-Headers if(NOT ${SLANG_USE_SYSTEM_SPIRV_HEADERS}) - add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_SPIRV_HEADERS_PATH) + add_subdirectory(spirv-headers EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_SPIRV_HEADERS_PATH} + spirv-headers + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() if(SLANG_ENABLE_SLANG_GLSLANG) # SPIRV-Tools set(SPIRV_TOOLS_BUILD_STATIC ON) set(SPIRV_WERROR OFF) - set(SPIRV_HEADER_DIR "${CMAKE_CURRENT_LIST_DIR}/spirv-headers/") + # Headers + if(NOT SLANG_OVERRIDE_SPIRV_HEADERS_PATH) + set(SPIRV_HEADER_DIR "${CMAKE_CURRENT_LIST_DIR}/spirv-headers/") + else() + set(SPIRV_HEADER_DIR ${SLANG_OVERRIDE_SPIRV_HEADERS_PATH}) + endif() set(SPIRV_SKIP_TESTS ON) - add_subdirectory(spirv-tools EXCLUDE_FROM_ALL ${system}) + # 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 + EXCLUDE_FROM_ALL + ${system} + ) + endif() # glslang set(SKIP_GLSLANG_INSTALL ON) set(ENABLE_OPT ON) set(ENABLE_PCH OFF) - add_subdirectory(glslang EXCLUDE_FROM_ALL ${system}) + if(NOT SLANG_OVERRIDE_GLSLANG_PATH) + add_subdirectory(glslang EXCLUDE_FROM_ALL ${system}) + else() + add_subdirectory( + ${SLANG_OVERRIDE_GLSLANG_PATH} + glslang + EXCLUDE_FROM_ALL + ${system} + ) + endif() endif() # imgui |
