2022-11-01 04:48:20 +08:00
|
|
|
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
|
|
|
|
2024-05-11 04:16:48 +08:00
|
|
|
set(key NOTFOUND)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
|
|
set(key "windows-${VCPKG_TARGET_ARCHITECTURE}")
|
|
|
|
elseif(VCPKG_TARGET_IS_OSX)
|
|
|
|
set(key "macosx-${VCPKG_TARGET_ARCHITECTURE}")
|
2022-11-01 04:48:20 +08:00
|
|
|
elseif(VCPKG_TARGET_IS_LINUX)
|
2024-05-11 04:16:48 +08:00
|
|
|
set(key "linux-${VCPKG_TARGET_ARCHITECTURE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ARCHIVE NOTFOUND)
|
|
|
|
# For convenient updates, use
|
|
|
|
# vcpkg install shader-slang --cmake-args=-DVCPKG_SHADER_SLANG_UPDATE=1
|
|
|
|
if(key STREQUAL "windows-x64" OR VCPKG_SHADER_SLANG_UPDATE)
|
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
2024-07-31 05:42:13 +08:00
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-windows-x86_64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-windows-x86_64.zip"
|
2024-11-27 04:27:06 +08:00
|
|
|
SHA512 9db0740a329c0bc55940229da064adff7c73d88774fc9d803556ba5ca1c283757021161a4fbd14d98dcd20918905950e35ed5961302da31021abcd4e5a3d9d6a
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
|
|
|
endif()
|
2024-07-31 05:42:13 +08:00
|
|
|
if(key STREQUAL "windows-arm64" OR VCPKG_SHADER_SLANG_UPDATE)
|
2024-05-11 04:16:48 +08:00
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
2024-07-31 05:42:13 +08:00
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-windows-aarch64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-windows-aarch64.zip"
|
2024-11-27 10:18:30 +08:00
|
|
|
SHA512 8832564b301227a19bab2ae18a93b0e97f6d93c1cf0adfdab71083d70a4ff05cef774eae7d109aa692d32da5dfc701015b5e672100dda33b7dcee5b53cf0a287
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(key STREQUAL "macosx-x64" OR VCPKG_SHADER_SLANG_UPDATE)
|
2024-11-27 10:18:30 +08:00
|
|
|
# https://github.com/shader-slang/slang/issues/5648
|
|
|
|
set(VERSION_BACKUP ${VERSION})
|
|
|
|
string(REPLACE "2024.14.6" "2024.14.4" VERSION "${VERSION}")
|
2024-05-11 04:16:48 +08:00
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
2024-07-31 05:42:13 +08:00
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-macos-x86_64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-macos-x86_64.zip"
|
2024-11-27 10:18:30 +08:00
|
|
|
SHA512 94bc9e6ce70966033cda5478ef10f811a84587e04cb193c2c7b75107240c4ea1917b3d0c4c625524a1883514ff42883ae12d33ed954254f09a5c2d2d08e51077
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
2024-11-27 10:18:30 +08:00
|
|
|
set(VERSION ${VERSION_BACKUP})
|
2024-05-11 04:16:48 +08:00
|
|
|
endif()
|
2024-07-31 05:42:13 +08:00
|
|
|
if(key STREQUAL "macosx-arm64" OR VCPKG_SHADER_SLANG_UPDATE)
|
2024-11-27 10:18:30 +08:00
|
|
|
# https://github.com/shader-slang/slang/issues/5648
|
|
|
|
set(VERSION_BACKUP ${VERSION})
|
|
|
|
string(REPLACE "2024.14.6" "2024.14.4" VERSION "${VERSION}")
|
2024-05-11 04:16:48 +08:00
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-macos-aarch64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-macos-aarch64.zip"
|
2024-11-27 10:18:30 +08:00
|
|
|
SHA512 b298389dbc2d4e7c9054474bff09903aedc08d0b959dc6bdd052cf76ad78a10f7dc2c8b325b29a6aebbe0df0fdb639beb00d5d3480c614351e8259576f0936d5
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
2024-11-27 10:18:30 +08:00
|
|
|
set(VERSION ${VERSION_BACKUP})
|
2024-05-11 04:16:48 +08:00
|
|
|
endif()
|
|
|
|
if(key STREQUAL "linux-x64" OR VCPKG_SHADER_SLANG_UPDATE)
|
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-linux-x86_64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-linux-x86_64.zip"
|
2024-11-27 10:18:30 +08:00
|
|
|
SHA512 38921820796717531bcc419fb0e56eedaaaee240ec55feb69bb8c08a8e2e0dcc6be38e0874f0515cc02f7854d825cf9b68506fe50e2073f358bf438376761b1f
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
|
|
|
endif()
|
2024-07-31 05:42:13 +08:00
|
|
|
if(key STREQUAL "linux-arm64" OR VCPKG_SHADER_SLANG_UPDATE)
|
2024-05-11 04:16:48 +08:00
|
|
|
vcpkg_download_distfile(
|
|
|
|
ARCHIVE
|
|
|
|
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-linux-aarch64.zip"
|
|
|
|
FILENAME "slang-${VERSION}-linux-aarch64.zip"
|
2024-11-27 10:18:30 +08:00
|
|
|
SHA512 3218a276ee48349c6ed11735cd2bb3aa207ee33c4bbd1d4a04eff5addbe9a4733f7ac5dee47bbfc5c4731733708555c2dd7de6de3e7ad873c84e330867110289
|
2024-05-11 04:16:48 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT ARCHIVE)
|
2022-11-01 04:48:20 +08:00
|
|
|
message(FATAL_ERROR "Unsupported platform. Please implement me!")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_extract_source_archive(
|
|
|
|
BINDIST_PATH
|
|
|
|
ARCHIVE "${ARCHIVE}"
|
|
|
|
NO_REMOVE_ONE_LEVEL
|
|
|
|
)
|
|
|
|
|
2024-05-11 04:16:48 +08:00
|
|
|
if(VCPKG_SHADER_SLANG_UPDATE)
|
|
|
|
message(STATUS "All downloads are up-to-date.")
|
|
|
|
message(FATAL_ERROR "Stopping due to VCPKG_SHADER_SLANG_UPDATE being enabled.")
|
|
|
|
endif()
|
2022-11-01 04:48:20 +08:00
|
|
|
|
2024-05-11 04:16:48 +08:00
|
|
|
file(GLOB libs
|
2024-07-31 05:42:13 +08:00
|
|
|
"${BINDIST_PATH}/lib/*.lib"
|
|
|
|
"${BINDIST_PATH}/lib/*.dylib"
|
|
|
|
"${BINDIST_PATH}/lib/*.so"
|
2022-11-01 04:48:20 +08:00
|
|
|
)
|
2024-05-11 04:16:48 +08:00
|
|
|
file(INSTALL ${libs} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
|
|
|
|
2024-09-05 13:35:42 +08:00
|
|
|
file(GLOB dyn_libs
|
|
|
|
"${BINDIST_PATH}/lib/*.dylib"
|
|
|
|
"${BINDIST_PATH}/lib/*.so"
|
|
|
|
)
|
|
|
|
|
2024-05-11 04:16:48 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
2024-09-10 11:35:55 +08:00
|
|
|
file(GLOB dlls "${BINDIST_PATH}/bin/*.dll")
|
|
|
|
list(APPEND dyn_libs ${dlls})
|
|
|
|
file(INSTALL ${dlls} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
|
2024-05-11 04:16:48 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
2024-10-31 17:33:23 +08:00
|
|
|
file(INSTALL "${CURRENT_PACKAGES_DIR}/lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
|
2024-09-10 11:35:55 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
2024-10-31 17:33:23 +08:00
|
|
|
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
|
2024-09-10 11:35:55 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# On macos, slang has signed their binaries
|
|
|
|
# vcpkg wants to be helpful and update the rpath as it moves binaries around but this
|
|
|
|
# breaks the code signature and makes the binaries useless
|
|
|
|
# Removing the signature is rude so instead we will disable rpath fixup
|
|
|
|
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
|
|
|
|
set(VCPKG_FIXUP_MACHO_RPATH OFF)
|
2024-05-11 04:16:48 +08:00
|
|
|
endif()
|
|
|
|
|
2024-09-05 13:35:42 +08:00
|
|
|
# Must manually copy some tool dependencies since vcpkg can't copy them automagically for us
|
2024-09-10 11:35:55 +08:00
|
|
|
file(INSTALL ${dyn_libs} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/shader-slang")
|
2024-07-31 05:42:13 +08:00
|
|
|
vcpkg_copy_tools(TOOL_NAMES slangc slangd SEARCH_DIR "${BINDIST_PATH}/bin")
|
2024-05-11 04:16:48 +08:00
|
|
|
|
2024-07-31 05:42:13 +08:00
|
|
|
file(GLOB headers "${BINDIST_PATH}/include/*.h")
|
2024-05-11 04:16:48 +08:00
|
|
|
file(INSTALL ${headers} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
|
|
|
|
|
|
|
|
vcpkg_install_copyright(
|
|
|
|
FILE_LIST "${BINDIST_PATH}/LICENSE"
|
|
|
|
COMMENT #[[ from README ]] [[
|
2024-11-27 10:18:30 +08:00
|
|
|
The Slang code itself is under the Apache 2.0 with LLVM Exception license.
|
2024-05-11 04:16:48 +08:00
|
|
|
|
|
|
|
Builds of the core Slang tools depend on the following projects, either automatically or optionally, which may have their own licenses:
|
|
|
|
|
|
|
|
* [`glslang`](https://github.com/KhronosGroup/glslang) (BSD)
|
|
|
|
* [`lz4`](https://github.com/lz4/lz4) (BSD)
|
|
|
|
* [`miniz`](https://github.com/richgel999/miniz) (MIT)
|
|
|
|
* [`spirv-headers`](https://github.com/KhronosGroup/SPIRV-Headers) (Modified MIT)
|
|
|
|
* [`spirv-tools`](https://github.com/KhronosGroup/SPIRV-Tools) (Apache 2.0)
|
|
|
|
* [`ankerl::unordered_dense::{map, set}`](https://github.com/martinus/unordered_dense) (MIT)
|
|
|
|
|
|
|
|
Slang releases may include [slang-llvm](https://github.com/shader-slang/slang-llvm) which includes [LLVM](https://github.com/llvm/llvm-project) under the license:
|
2022-11-01 04:48:20 +08:00
|
|
|
|
2024-05-11 04:16:48 +08:00
|
|
|
* [`llvm`](https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework) (Apache 2.0 License with LLVM exceptions)
|
|
|
|
]])
|