vcpkg/ports/directxtex/portfile.cmake
Chuck Walbourn 0b57cc72ac
[directxmesh, directxtex, directxtk(12), uvatlas] April 2023 updates (#31196)
* [directxmesh, directxtex, directxtk(12), uvatalas] Update ports for April 2023 releases

* directxtex port updated upstream with better OpenMP support fix

* OpenMP hotfix for UVAtlas

* Update baseline

* Forgot to update the CMake config file for OpenMP

* CMake fixes made upstream

* Update baseline
2023-05-01 15:25:18 -07:00

122 lines
4.9 KiB
CMake

set(DIRECTXTEX_TAG apr2023)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/DirectXTex
REF ${DIRECTXTEX_TAG}
SHA512 112e25a61ff04dea82e0e6c695df8bf6a480008a2f6f68239b7393696f960b5fa5e42b93ba2043c652c34565f9b0ac9b3ac855204a0dc5f9b62e147ad5bacfbc
HEAD_REF main
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
dx11 BUILD_DX11
dx12 BUILD_DX12
openexr ENABLE_OPENEXR_SUPPORT
spectre ENABLE_SPECTRE_MITIGATION
tools BUILD_TOOLS
)
if(VCPKG_TARGET_IS_MINGW AND ("dx11" IN_LIST FEATURES))
message(NOTICE "Building ${PORT} for MinGW requires the HLSL Compiler fxc.exe also be in the PATH. See https://aka.ms/windowssdk.")
endif()
if (VCPKG_HOST_IS_LINUX)
message(WARNING "Build ${PORT} requires GCC version 9 or later")
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS} -DBUILD_SAMPLE=OFF -DBUILD_TESTING=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/directxtex)
if("tools" IN_LIST FEATURES)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/directxtex/")
if((VCPKG_TARGET_ARCHITECTURE STREQUAL x64) AND (NOT ("openexr" IN_LIST FEATURES)))
vcpkg_download_distfile(
TEXASSEMBLE_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texassemble.exe"
FILENAME "texassemble-${DIRECTXTEX_TAG}.exe"
SHA512 758c3a99befca251ad0f05e6d9467dffef75868e541c027960c007406e55d10dbf5b09d4c4cf4f013a8c188d7a6a6dafecfd146d19a12ad520bfd47378adc331
)
vcpkg_download_distfile(
TEXCONV_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texconv.exe"
FILENAME "texconv-${DIRECTXTEX_TAG}.exe"
SHA512 a652debd8b6204fdf35bac968e6fcc3815202b6a858f2999566c4c5151574b7bc5b0a190c172f91b2bdea75d4873423b089894c640928807ee43dac2ecaf7cfd
)
vcpkg_download_distfile(
TEXDIAG_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texdiag.exe"
FILENAME "texdiag-${DIRECTXTEX_TAG}.exe"
SHA512 60b5b2d07ca686964b39f21f6433cb11ac5da009dee18c8c0fee6cf60ccaa531056f2efafe14096eaaf530f7293fd395f46c7d9509013f4ff08f0b42a41dc69e
)
file(INSTALL
"${TEXASSEMBLE_EXE}"
"${TEXCONV_EXE}"
"${TEXDIAG_EXE}"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/directxtex/")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texassemble-${DIRECTXTEX_TAG}.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texassemble.exe")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texconv-${DIRECTXTEX_TAG}.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texconv.exe")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texdiag-${DIRECTXTEX_TAG}.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texadiag.exe")
elseif((VCPKG_TARGET_ARCHITECTURE STREQUAL arm64) AND (NOT ("openexr" IN_LIST FEATURES)))
vcpkg_download_distfile(
TEXASSEMBLE_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texassemble_arm64.exe"
FILENAME "texassemble-${DIRECTXTEX_TAG}-arm64.exe"
SHA512 9365a3b15a17ec42bac19bf48a2bfba524191347e845ca0d79adf94771cc6f3d608ac0c41654cf3eb76e32ccce4f5dc3fd309eb7d6420669dc2f8015a71555f7
)
vcpkg_download_distfile(
TEXCONV_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texconv_arm64.exe"
FILENAME "texconv-${DIRECTXTEX_TAG}-arm64.exe"
SHA512 b479b725b78f2acf5a22958af85ce04eeb62bc25ea5eaaa7c2bc10b7161d2be103e13112c2f55e8da13ce260f8a62e7cfb951d0c7cc08cb23f3aafe4ebe8fec7
)
vcpkg_download_distfile(
TEXDIAG_EXE
URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texdiag_arm64.exe"
FILENAME "texdiag-${DIRECTXTEX_TAG}-arm64.exe"
SHA512 9226643fd9ec57de8f7d57d225c0d07d6f250975c1e04c15cec078678e1a24c3cafa8483138b7966015e4fdc7a53bd53043376a9ae157e98876d842f2ede9d37
)
file(INSTALL
"${TEXASSEMBLE_EXE}"
"${TEXCONV_EXE}"
"${TEXDIAG_EXE}"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/directxtex/")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texassemble-${DIRECTXTEX_TAG}-arm64.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texassemble.exe")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texconv-${DIRECTXTEX_TAG}-arm64.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texconv.exe")
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/directxtex/texdiag-${DIRECTXTEX_TAG}-arm64.exe" "${CURRENT_PACKAGES_DIR}/tools/directxtex/texadiag.exe")
elseif("dx11" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES texassemble texconv texdiag
SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin/CMake"
)
endif()
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")