summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-08-21 04:09:15 +0800
committerGitHub <noreply@github.com>2024-08-20 13:09:15 -0700
commit579d59c761cb0460701e0e820eb066275fe357b3 (patch)
tree821f0cd3a23ce6e164b7f676e35ff6b4913124b6 /CMakeLists.txt
parentd286ff53c101e471a4a07ee50d277c99d18632b0 (diff)
Fetch slang-llvm.so from correct release (#4847)
* Fetch slang-llvm.so from correct release Closes https://github.com/shader-slang/slang/issues/4648 Should close https://github.com/shader-slang/slang/issues/4812 * Update docs * Correct documentation on cmake option * Neaten cmake script * Fix fetching on windows --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 14 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54eae379b..fce9f78ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,7 @@ include(Glob)
include(LLVM)
include(SlangTarget)
include(AutoOption)
+include(GitHubRelease)
#
# Options
@@ -125,25 +126,26 @@ enum_option(
"How to get or build slang-llvm:"
# Options
FETCH_BINARY
- "Use a binary distribution of the slang-llvm library instead of building or using LLVM (default for Windows)"
+ "Use a binary distribution of the slang-llvm library instead of building or using LLVM (default)"
USE_SYSTEM_LLVM
- "Build slang-llvm using system-provided LLVM and Clang binaries (default for non-Windows hosts)"
+ "Build slang-llvm using system-provided LLVM and Clang binaries"
DISABLE
"Do not build llvm or fetch slang-llvm"
)
-macro(slang_llvm_binary_url_option version filename)
+
+if(SLANG_SLANG_LLVM_FLAVOR MATCHES FETCH_BINARY)
+ # If the user didn't specify a URL, find the best one now
+ if(NOT SLANG_SLANG_LLVM_BINARY_URL)
+ get_best_slang_binary_release_url(url)
+ if(NOT url)
+ message(FATAL_ERROR "Unable to find binary release for slang-llvm, please set a different SLANG_SLANG_LLVM_FLAVOR or set SLANG_SLANG_LLVM_BINARY_URL manually")
+ endif()
+ endif()
set(SLANG_SLANG_LLVM_BINARY_URL
- "https://github.com/shader-slang/slang-llvm/releases/download/${version}/${filename}"
+ ${url}
CACHE STRING
"URL specifying the location of the slang-llvm prebuilt library"
)
-endmacro()
-if(CMAKE_SYSTEM_NAME MATCHES "Windows")
- slang_llvm_binary_url_option("v13.x-43" "slang-llvm-13.x-43-win64.zip")
-elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
- slang_llvm_binary_url_option("v13.x-43" "slang-llvm-v13.x-43-macosx-x86_64-release.zip")
-else()
- slang_llvm_binary_url_option("v13.x-43" "slang-llvm-v13.x-43-linux-x86_64-release.zip")
endif()
#
@@ -392,7 +394,7 @@ if(SLANG_SLANG_LLVM_FLAVOR STREQUAL "FETCH_BINARY")
endif()
set(slang_llvm_dest_object
- ${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}/${slang_llvm_filename}
+ ${CMAKE_BINARY_DIR}/$<CONFIG>/${module_subdir}/${slang_llvm_filename}
)
add_custom_command(
OUTPUT ${slang_llvm_dest_object}