vcpkg/ports/shader-slang/portfile.cmake

106 lines
5.2 KiB
CMake
Raw Normal View History

vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
if (VCPKG_TARGET_IS_WINDOWS)
set(SLANG_EXE_SUFFIX ".exe")
set(SLANG_LIB_PREFIX "")
set(SLANG_LIB_SUFFIX ".lib")
set(SLANG_DYNLIB_SUFFIX ".dll")
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 db8404de1e1aa7b4deac258f1d3aed4287d6babc37538c76914da87e1bfcc5919d8013cf9054ae1c0aa32a5a14a25a668fd7f6fb23b8b2e1275bcfc9fe256eac
)
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 1045f37b02ae93c2b8a7b9a7b8c98cd5b7c2d1a86704888c778ae12bc5bd701284d356685010ba4405893c9c0bfec2e117b329c00d8c218e08df578d607a9f80
)
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 627d77d83eef56e25815c30d0e99ae472c9189c760d1a620daebf49407c97e5e4da4b7880781c7788e85c5ccfba3a9e938e50ede2be0e93c0635050b11ad22a0
)
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 e898c20c60b4f3e8bbb262fef4cad88fba35b66dafb4784eec8b1603d8ee0293a71faeac1f84a9df96f33e206503ed717f7a068370e40a49bac90c009bbe4336
)
set(SLANG_BIN_PATH "bin/macos-aarch64/release")
else()
message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif()
elseif(VCPKG_TARGET_IS_LINUX)
set(SLANG_EXE_SUFFIX "")
set(SLANG_LIB_PREFIX "lib")
set(SLANG_LIB_SUFFIX ".a")
set(SLANG_DYNLIB_SUFFIX ".so")
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
vcpkg_download_distfile(
ARCHIVE
URLS "https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-linux-x86_64.tar.gz"
FILENAME "slang-${VERSION}-linux-x86_64.tar.gz"
SHA512 2291e7ee0e1998eb8cf3725154bade4ebd2873f18ba2dc04e598ffee63298780e6906a6257762a84ba4d81f32b1fb4548b1aaea4a79852f4fc6827faeba4426f
)
set(SLANG_BIN_PATH "bin/linux-x64/release")
else()
message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif()
else()
message(FATAL_ERROR "Unsupported platform. Please implement me!")
endif()
vcpkg_extract_source_archive(
BINDIST_PATH
ARCHIVE "${ARCHIVE}"
NO_REMOVE_ONE_LEVEL
)
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-llvm${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-llvm${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-glslang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang-glslang${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/slangc${SLANG_EXE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
if (VCPKG_TARGET_IS_WINDOWS)
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/${SLANG_LIB_PREFIX}slang${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_LIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
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(INSTALL "${BINDIST_PATH}/${SLANG_BIN_PATH}/gfx${SLANG_DYNLIB_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(GLOB HEADERS "${BINDIST_PATH}/*.h")
file(INSTALL ${HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO shader-slang/slang
REF v${VERSION}
SHA512 cc89a8a8eeab494c2558d2699bad75520cb44640d17881b0e35f618df68090a7fcee03e812e77998fe953206790d284fdfa084a0d30d0b4fca33991fe9ec8775
HEAD_REF master
)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)