[directxmesh] Use CMake build system and add dx12 feature (#13976)

Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
This commit is contained in:
Rémy Tassoux 2020-10-23 20:50:19 +02:00 коммит произвёл GitHub
Родитель 70f380e802
Коммит 9b4daabad5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 31 добавлений и 58 удалений

Просмотреть файл

@ -1,4 +1,9 @@
Source: directxmesh
Version: aug2020
Port-Version: 1
Homepage: https://walbourn.github.io/directxmesh
Description: DirectXMesh geometry processing library
Description: DirectXMesh geometry processing library
Build-Depends: directxmesh[core,dx12](arm64|uwp)
Feature: dx12
Description: Build with DirectX12 support for Windows 10

Просмотреть файл

@ -8,68 +8,36 @@ vcpkg_from_github(
HEAD_REF master
)
IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
set(VS_VERSION "2015")
elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
set(VS_VERSION "2017")
elseif (VCPKG_PLATFORM_TOOLSET STREQUAL "v142")
set(VS_VERSION "2019")
else()
message(FATAL_ERROR "Unsupported platform toolset.")
endif()
if(VCPKG_TARGET_IS_UWP)
set(SLN_NAME "Windows10_${VS_VERSION}")
else()
if(TRIPLET_SYSTEM_ARCH STREQUAL "arm64")
set(SLN_NAME "Desktop_${VS_VERSION}_Win10")
else()
set(SLN_NAME "Desktop_${VS_VERSION}")
# fix solution file to include DirectX 12 in build
file(READ ${SOURCE_PATH}/DirectXMesh/DirectXMesh_${SLN_NAME}.vcxproj _contents)
string(REPLACE "_WIN32_WINNT=0x0601" "_WIN32_WINNT=0x0A00" _contents "${_contents}")
file(WRITE ${SOURCE_PATH}/DirectXMesh/DirectXMesh_${SLN_NAME}.vcxproj "${_contents}")
# fix solution file to include DirectX 12 in build
file(READ ${SOURCE_PATH}/Meshconvert/Meshconvert_${SLN_NAME}.vcxproj _contents)
string(REPLACE "_WIN32_WINNT=0x0601" "_WIN32_WINNT=0x0A00" _contents "${_contents}")
file(WRITE ${SOURCE_PATH}/Meshconvert/Meshconvert_${SLN_NAME}.vcxproj "${_contents}")
endif()
endif()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/DirectXMesh_${SLN_NAME}.sln
PLATFORM ${TRIPLET_SYSTEM_ARCH}
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
dx12 BUILD_DX12
)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/DirectXMesh.h
${SOURCE_PATH}/DirectXMesh/DirectXMesh.inl
DESTINATION ${CURRENT_PACKAGES_DIR}/include
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXMesh.lib
${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXMesh.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXMesh.lib
${SOURCE_PATH}/DirectXMesh/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXMesh.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
if(NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
vcpkg_build_cmake()
else()
vcpkg_build_cmake(TARGET DirectXMesh)
endif()
if(NOT VCPKG_TARGET_IS_UWP AND NOT TRIPLET_SYSTEM_ARCH STREQUAL "arm64")
set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxmesh)
file(MAKE_DIRECTORY ${TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/Meshconvert/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/Meshconvert.exe
DESTINATION ${TOOL_PATH})
file(INSTALL ${SOURCE_PATH}/DirectXMesh/DirectXMesh.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SOURCE_PATH}/DirectXMesh/DirectXMesh.inl DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(GLOB_RECURSE DEBUG_LIB ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/bin/CMake/*.lib)
file(GLOB_RECURSE RELEASE_LIB ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin/CMake/*.lib)
file(INSTALL ${DEBUG_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL ${RELEASE_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
if(NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
vcpkg_copy_tools(
TOOL_NAMES Meshconvert
SEARCH_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin/CMake
)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)