set(DIRECTXTEX_TAG mar2024) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Microsoft/DirectXTex REF ${DIRECTXTEX_TAG} SHA512 313e66597a101675c9c32032577421ae574229d27defe718a94690446e9c562507209b5912ac48c6dc4d84124b059c9c061e094f44b0b9dbc90ede50d8a2c230 HEAD_REF main ) vcpkg_check_features( OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES dx11 BUILD_DX11 dx12 BUILD_DX12 jpeg ENABLE_LIBJPEG_SUPPORT openexr ENABLE_OPENEXR_SUPPORT png ENABLE_LIBPNG_SUPPORT spectre ENABLE_SPECTRE_MITIGATION tools BUILD_TOOLS ) set(EXTRA_OPTIONS -DBUILD_SAMPLE=OFF) if(VCPKG_TARGET_IS_WINDOWS AND NOT (VCPKG_TARGET_IS_XBOX OR VCPKG_TARGET_IS_MINGW) AND NOT "dx12" IN_LIST FEATURES) list(APPEND EXTRA_OPTIONS "-DCMAKE_DISABLE_FIND_PACKAGE_directx-headers=TRUE") endif() 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("xbox" IN_LIST FEATURES) if((NOT (DEFINED DIRECTXTEX_XBOX_CONSOLE_TARGET)) OR (DIRECTXTEX_XBOX_CONSOLE_TARGET STREQUAL "scarlett")) list(APPEND FEATURE_OPTIONS "-DBUILD_XBOX_EXTS_SCARLETT=ON") message(NOTICE "Building ${PORT} with Xbox Series X|S extensions") elseif(DIRECTXTEX_XBOX_CONSOLE_TARGET STREQUAL "xboxone") list(APPEND FEATURE_OPTIONS "-DBUILD_XBOX_EXTS_XBOXONE=ON") message(NOTICE "Building ${PORT} with Xbox One extensions") else() message(FATAL_ERROR "The triplet variable DIRECTXTEX_XBOX_CONSOLE_TARGET should be set to 'xboxone' or 'scarlett'.") endif() 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} ${EXTRA_OPTIONS} ) vcpkg_cmake_install() vcpkg_fixup_pkgconfig() 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) OR ("xbox" 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 6baaa5274dce853234716ede4960052e55d5354a454c6786db20ec22aa6e4efa2376506ba6c20523f62071d368830321ad77516600652c1925782ea343efd8d3 ) vcpkg_download_distfile( TEXCONV_EXE URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texconv.exe" FILENAME "texconv-${DIRECTXTEX_TAG}.exe" SHA512 fc5aafe02f060cc550a8e11e28039bb1ec7521c3cb03ccc894055c831e38a9fc356ef9557e31a333c618e00b50bd303e567a2a5f0dd9c25f5111248caeea3fe8 ) vcpkg_download_distfile( TEXDIAG_EXE URLS "https://github.com/Microsoft/DirectXTex/releases/download/${DIRECTXTEX_TAG}/texdiag.exe" FILENAME "texdiag-${DIRECTXTEX_TAG}.exe" SHA512 cf6adb1cc31dd969222e67820374e6e4f841098af462f1b88d91da521b479dd7632b7486c74f7e1df4852739281bc25a3557dd0809988b7efd095904c93acb68 ) 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 72c80e40d7fbdb3ddd8d349981aa076a064913f0c1e05d9e6f0df70e054123ccaf9d2aac905fefba51d3d7d223336ff1c6875039f79d97e4f511f69cbabb7b36 ) 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 1f712890135c1112b8229f905dae06201144527beea9b5fecb11c57b55290f7fac8a2725533a807404a1ceb1486c18c4a9b82b0bbaf2baff097fff5cd7b39cbf ) 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 012eb9b5b97d6e707d0e64b3509363f181bac2d23196baead6a4da5a58565241e12e1f30ded82dea76d60814433d530c9f146e560cef8fbc231881e49c00a8f3 ) 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" ) endif() endif() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")