[shader-slang] Update, fix (#38602)

Fix osx. Closes https://github.com/microsoft/vcpkg/issues/38595.
Enable install for static library linkage triplets. (osx and linux CI!)
Fixes #29445.
Enable arm64 linux and windows.
Install all binaries and headers from upstream's package.
Install non-DLL shared objects to `lib`.
Update. Simplify. Facilitate future updates.
This commit is contained in:
Kai Pastor 2024-05-10 22:16:48 +02:00 committed by GitHub
parent 8ad2a682dd
commit a1212c93ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 137 additions and 91 deletions

View File

@ -1,70 +1,75 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
if (VCPKG_TARGET_IS_WINDOWS) set(key NOTFOUND)
set(SLANG_EXE_SUFFIX ".exe") if(VCPKG_TARGET_IS_WINDOWS)
set(SLANG_LIB_PREFIX "") set(key "windows-${VCPKG_TARGET_ARCHITECTURE}")
set(SLANG_LIB_SUFFIX ".lib") elseif(VCPKG_TARGET_IS_OSX)
set(SLANG_DYNLIB_SUFFIX ".dll") set(key "macosx-${VCPKG_TARGET_ARCHITECTURE}")
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-win64.zip"
FILENAME "slang-${VERSION}-win64.zip"
SHA512 3d6153d9cd8234d68d91273b97cfd66167e55bf3c526490603c79797aea4f5af839cbfdce29532da8c0e77cb9e6451a5823d40b98162fb53fffcbc5d18b0f841
)
set(SLANG_BIN_PATH "bin/windows-x64/release")
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-win32.zip"
FILENAME "slang-${VERSION}-win32.zip"
SHA512 43992831be8f7fc954794482e947a20e421587cb999eebdd7ffb21c3fc477a660ae19c0e0a10df5331329ac46e7fdd6017fc416b6667127182ae6091b6431e6b
)
set(SLANG_BIN_PATH "bin/windows-x86/release")
else()
message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif()
elseif (VCPKG_TARGET_IS_OSX)
set(SLANG_EXE_SUFFIX "")
set(SLANG_LIB_PREFIX "lib")
set(SLANG_LIB_SUFFIX ".a")
set(SLANG_DYNLIB_SUFFIX ".dylib")
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-macos-x64.zip"
FILENAME "slang-${VERSION}-macos-x64.zip"
SHA512 dc3b3f18c8e80cfc12960e76978dc1acb18df6de0704c5a889713128491827e26c169a2965d598b4904647384da2eeceb63a391b62925573da5d77a060bdb890
)
set(SLANG_BIN_PATH "bin/macos-x64/release")
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
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"
SHA512 db613040ea31fa2ff8a60fec96a16704e0241774332333a704530bee309f5037d50570fc590348f22d3bc7f018a5bd3c9a10aae800a4f30f0f5e273552690863
)
set(SLANG_BIN_PATH "bin/macos-aarch64/release")
else()
message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif()
elseif(VCPKG_TARGET_IS_LINUX) elseif(VCPKG_TARGET_IS_LINUX)
set(SLANG_EXE_SUFFIX "") set(key "linux-${VCPKG_TARGET_ARCHITECTURE}")
set(SLANG_LIB_PREFIX "lib") endif()
set(SLANG_LIB_SUFFIX ".a") string(REPLACE "arm64" "aarch64" key "${key}")
set(SLANG_DYNLIB_SUFFIX ".so")
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x64") set(ARCHIVE NOTFOUND)
vcpkg_download_distfile( # For convenient updates, use
ARCHIVE # vcpkg install shader-slang --cmake-args=-DVCPKG_SHADER_SLANG_UPDATE=1
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-linux-x86_64.tar.gz" if(key STREQUAL "windows-x86" OR VCPKG_SHADER_SLANG_UPDATE)
FILENAME "slang-${VERSION}-linux-x86_64.tar.gz" vcpkg_download_distfile(
SHA512 817e3c5ae9fa249c54b1f411877f4742a019aa27b63bfb06b726b721cd86973b4ebe481bf62192bb7380d092c57cbd8e2abc932a7dbacd06811b6afb856c428d ARCHIVE
) URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-win32.zip"
set(SLANG_BIN_PATH "bin/linux-x64/release") FILENAME "slang-${VERSION}-win32.zip"
else() SHA512 b8fa6aed2fc4c7adb8c1810cfa5e655b317aebc4636e8d80e718aef25abf58bc9dc5c7c58dc9d0a375d61bed8000daa75e14d8bc11c1a7c4cd33350d698c8dd6
message(FATAL_ERROR "Unsupported platform. Please implement me!") )
endif() endif()
else() if(key STREQUAL "windows-x64" OR VCPKG_SHADER_SLANG_UPDATE)
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-win64.zip"
FILENAME "slang-${VERSION}-win64.zip"
SHA512 24d39f1f54230b7badc1e0e3b54b29a0fddbcf29c2370d2085870556529f8ee4d25d249b9dad9bead61079803061f6a7d7b126e136fcb8afe2a0ef61808f34ad
)
endif()
if(key STREQUAL "windows-aarch64" OR VCPKG_SHADER_SLANG_UPDATE)
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-win-arm64.zip"
FILENAME "slang-${VERSION}-win-arm64.zip"
SHA512 0971394479f4da56b6340c1bc9b415ac1de001607ba5af0d5e3e3e95ad9a4e2fd6185603bb95fdc98e152d0a6012a5af144ba812c3af0ec1d1eb50837caad3dd
)
endif()
if(key STREQUAL "macosx-x64" OR VCPKG_SHADER_SLANG_UPDATE)
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-macos-x64.zip"
FILENAME "slang-${VERSION}-macos-x64.zip"
SHA512 e546c4c3e68880f75678c061457369f2c075bdd428080c4af7fae6145be8359dff182902d412dad6c0ce3903004ca9613d791a04a209e6e16960e036585efdae
)
endif()
if(key STREQUAL "macosx-aarch64" OR VCPKG_SHADER_SLANG_UPDATE)
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"
SHA512 df287ec31d366d88196ce5e1a9d3fa0d0c6973ff948c8ab4e51a04d3f5af5b84a8703925a6a5b721335f2cbfcb0fb0e70eac5d084f72565fe65730ae54a758fa
)
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"
SHA512 6a2360936e8c3967ebbf6a1ea8143c6e2ddf188c3057f3ecafac28550f96ba83f7269a9ef5dadc76833c78954dca298b901f63f94cbf595fb68d1138fa361f62
)
endif()
if(key STREQUAL "linux-aarch64" OR VCPKG_SHADER_SLANG_UPDATE)
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"
SHA512 315a822d32093bbe133f399eb648301a3b0f3319aabe526371b8044b691e16aa826d9c81af59f1967e9d98e94d55fb5e4704cafb831fb518442755a4574d5498
)
endif()
if(NOT ARCHIVE)
message(FATAL_ERROR "Unsupported platform. Please implement me!") message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif() endif()
@ -74,32 +79,67 @@ vcpkg_extract_source_archive(
NO_REMOVE_ONE_LEVEL NO_REMOVE_ONE_LEVEL
) )
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") # https://github.com/shader-slang/slang/issues/4117
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") if(NOT EXISTS "${BINDIST_PATH}/LICENSE" OR VCPKG_SHADER_SLANG_UPDATE)
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-llvm${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") vcpkg_download_distfile(
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-llvm${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") LICENSE_ARCHIVE
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-glslang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-source.zip"
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-glslang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") FILENAME "slang-${VERSION}-source.zip"
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/slangc${SLANG_EXE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") SHA512 4c0888de421e070e8458b94e420df972c5b4fb5f3d3dc3c124b8f33f548aa47cd81d7c92c33786b492373b926263167f9ef63f8fe203e064f1f0795b38cf1570
)
if (VCPKG_TARGET_IS_WINDOWS) vcpkg_extract_source_archive(
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") SOURCE_PATH
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") ARCHIVE "${LICENSE_ARCHIVE}"
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib") NO_REMOVE_ONE_LEVEL
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib") )
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin") file(COPY "${SOURCE_PATH}/LICENSE" DESTINATION "${BINDIST_PATH}")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif() endif()
file(GLOB HEADERS "${BINDIST_PATH}/*.h") if(VCPKG_SHADER_SLANG_UPDATE)
file(INSTALL ${HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include") message(STATUS "All downloads are up-to-date.")
message(FATAL_ERROR "Stopping due to VCPKG_SHADER_SLANG_UPDATE being enabled.")
endif()
vcpkg_from_github( set(SLANG_BIN_PATH "bin/${key}/release")
OUT_SOURCE_PATH SOURCE_PATH file(GLOB libs
REPO shader-slang/slang "${BINDIST_PATH}/${SLANG_BIN_PATH}/*.lib"
REF "v${VERSION}" "${BINDIST_PATH}/${SLANG_BIN_PATH}/*.dylib"
SHA512 f7da1cd60418c9b0a4f302841154ac5b48f84b897f81359cbc52950dd5a2a0339a95b8cc13ad13d518a089aff3071bf52f60bcf86d29b07866c4e1c948f5ccfd "${BINDIST_PATH}/${SLANG_BIN_PATH}/*.so"
HEAD_REF master
) )
file(INSTALL ${libs} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") if(VCPKG_TARGET_IS_WINDOWS)
file(GLOB dlls "${BINDIST_PATH}/${SLANG_BIN_PATH}/*.dll")
file(INSTALL ${dlls} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
endif()
if(NOT VCPKG_BUILD_TYPE)
file(INSTALL "${CURRENT_PACKAGES_DIR}/lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
if(VCPKG_TARGET_IS_WINDOWS)
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
endif()
vcpkg_copy_tools(TOOL_NAMES slangc slangd SEARCH_DIR "${BINDIST_PATH}/${SLANG_BIN_PATH}")
file(GLOB headers "${BINDIST_PATH}/*.h" "${BINDIST_PATH}/prelude")
file(INSTALL ${headers} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
vcpkg_install_copyright(
FILE_LIST "${BINDIST_PATH}/LICENSE"
COMMENT #[[ from README ]] [[
The Slang code itself is under the MIT license.
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:
* [`llvm`](https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework) (Apache 2.0 License with LLVM exceptions)
]])

View File

@ -1,8 +1,8 @@
{ {
"name": "shader-slang", "name": "shader-slang",
"version": "2024.1.7", "version": "2024.1.12",
"description": "Slang is a shading language that makes it easier to build and maintain large shader codebases in a modular and extensible fashion, while also maintaining the highest possible performance on modern GPUs and graphics APIs. Slang is based on years of collaboration between researchers at NVIDIA, Carnegie Mellon University, and Stanford.", "description": "Slang is a shading language that makes it easier to build and maintain large shader codebases in a modular and extensible fashion, while also maintaining the highest possible performance on modern GPUs and graphics APIs. Slang is based on years of collaboration between researchers at NVIDIA, Carnegie Mellon University, and Stanford.",
"homepage": "https://github.com/shader-slang/slang", "homepage": "https://github.com/shader-slang/slang",
"license": "MIT", "license": "MIT",
"supports": "((x86 & windows) | (x64 & (windows | linux | osx)) | (arm64 & (linux | osx))) & !uwp & !static" "supports": "((x86 & windows) | (x64 & (linux | osx | windows)) | (arm64 & (linux | osx | windows))) & !uwp"
} }

View File

@ -1035,6 +1035,7 @@ septag-sx:x64-android=fail
sfml:arm-neon-android=fail sfml:arm-neon-android=fail
sfml:arm64-android=fail sfml:arm64-android=fail
sfml:x64-android=fail sfml:x64-android=fail
shader-slang:x64-windows-static=fail
shogun:arm64-windows = skip shogun:arm64-windows = skip
shogun:arm64-uwp = skip shogun:arm64-uwp = skip
shogun:x64-osx = skip shogun:x64-osx = skip

View File

@ -8057,7 +8057,7 @@
"port-version": 0 "port-version": 0
}, },
"shader-slang": { "shader-slang": {
"baseline": "2024.1.7", "baseline": "2024.1.12",
"port-version": 0 "port-version": 0
}, },
"shaderc": { "shaderc": {

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "5e7e8064e105e443d90fc10fb9dc05916107f489",
"version": "2024.1.12",
"port-version": 0
},
{ {
"git-tree": "c2c440cb10bb3987dbdf8b4332db8d34b8fc6cfc", "git-tree": "c2c440cb10bb3987dbdf8b4332db8d34b8fc6cfc",
"version": "2024.1.7", "version": "2024.1.7",