vcpkg/ports/directxmesh/portfile.cmake
Chuck Walbourn c1d764a742
[community triplet] adds triplets for building for the Xbox platform (#29210)
* Try adding xbox triplets

* Update for Gaming Command Prompt usage

* Fix directxtk12 shaders for xbox

* Add toolchain for xbox

* Fix ports for feature builds

* Code review feedback

* More code review

* Code review

* WIN32_LEAN_AND_MEAN is too aggressive for many libs

* Normalize GDK variable paths

* Need to leave oldnames.lib as many libs use POSIX names

* More code review feedback

* Remove extra file

* Use of /DEFAULTLIB fixed 41 ports

* Code review feedback

* Added basic xbox supports expression

* Updates for xbox-aware ports

* Update for CMake fixes upstream

* Minor synatx fix

* Fix up merge issues

* Need directx-headers for linux

* Missed one port revision

* Removed VCPKG_TARGET_IS_XBOX from project scope after upstream fixes

* Update baseline

* License updates per github-actions bot

* Update baseline

* Update toolchain to support try_compile for GDK headers

* Update port numbers

* Update baseline

* Don't need directx-dxc for Xbox builds

* Update baseline

* Update hashes

* Code review

* Update baseline

* Refresh hashes for upstream fixes

* Update baseline

* Add ms-gdkx stub port

* Update baseline

* updated ms-gdkx with user-friendly output

* Update baseline

* Code review for the toolchain file

* Update directxkt12 hash

* Refresh baseline

* Update MSBuild integration to select proper triplet for GDK custom platforms

* Update CMake integration to select proper xbox triplet from XBOX_CONSOLE_TARGET

* vcpkg.targets update

* Code review feedback

* Update baseline

* Refresh baseline

* Code review for MSBuild

* Code review for xbox toolchain

* vcpkg.cmake codereview

---------

Co-authored-by: walbourn <chuckw_walbourn@yahoo.com>
2023-03-08 14:06:20 -08:00

68 lines
2.1 KiB
CMake

set(DIRECTXMESH_TAG dec2022)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/DirectXMesh
REF dec2022b
SHA512 8e7b757b311223b6ea10fcd6ca9729a4fed51526966239da7d9c3c22f09bc50bbae80b2f8f899badbcc0bfcabc62dcd8d7a662c5881118cce97d3198c014c51e
HEAD_REF main
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
dx12 BUILD_DX12
spectre ENABLE_SPECTRE_MITIGATION
)
if (VCPKG_HOST_IS_LINUX)
message(WARNING "Build ${PORT} requires GCC version 9 or later")
endif()
set(EXTRA_OPTIONS -DBUILD_TESTING=OFF)
if(VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_XBOX)
list(APPEND EXTRA_OPTIONS -DBUILD_TOOLS=OFF)
else()
list(APPEND EXTRA_OPTIONS -DBUILD_TOOLS=ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS ${FEATURE_OPTIONS} ${EXTRA_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/directxmesh)
if((VCPKG_HOST_IS_WINDOWS) AND (VCPKG_TARGET_ARCHITECTURE MATCHES x64))
vcpkg_download_distfile(
MESHCONVERT_EXE
URLS "https://github.com/Microsoft/DirectXMesh/releases/download/${DIRECTXMESH_TAG}/meshconvert.exe"
FILENAME "meshconvert-${DIRECTXMESH_TAG}.exe"
SHA512 46b5fc3dcf58a7c03075927511de5ae4c62c09ceb22076125d3be29044d7da1cc32225a43500ed53ddf0c30d969091b705345a5eb3bb49cc07233dba988357c8
)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/directxmesh/")
file(INSTALL
${MESHCONVERT_EXE}
DESTINATION ${CURRENT_PACKAGES_DIR}/tools/directxmesh/)
file(RENAME ${CURRENT_PACKAGES_DIR}/tools/directxmesh/meshconvert-${DIRECTXMESH_TAG}.exe ${CURRENT_PACKAGES_DIR}/tools/directxmesh/meshconvert.exe)
elseif(VCPKG_TARGET_IS_WINDOWS AND (NOT VCPKG_TARGET_IS_UWP) AND (NOT VCPKG_TARGET_IS_XBOX))
vcpkg_copy_tools(
TOOL_NAMES meshconvert
SEARCH_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin/CMake
)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)