[directxtk] Use CMake build system and add xaudio2-8 and xaudio2-9 features (#13978)

This commit is contained in:
Rémy Tassoux 2020-10-28 04:32:43 +01:00 committed by GitHub
parent 83ff32536a
commit ff413776db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 50 deletions

View File

@ -1,4 +1,12 @@
Source: directxtk
Version: sept2020
Port-Version: 1
Homepage: https://walbourn.github.io/directxtk
Description: A collection of helper classes for writing DirectX 11.x code in C++.
Build-Depends: directxtk[core,xaudio2-9](arm64|uwp)
Feature: xaudio2-9
Description: Build with XAudio 2.9 support for Windows 10
Feature: xaudio2-8
Description: Build with XAudio 2.8 support for Windows 8.x or later

View File

@ -8,61 +8,41 @@ 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}")
endif()
endif()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/DirectXTK_${SLN_NAME}.sln
PLATFORM ${TRIPLET_SYSTEM_ARCH}
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
xaudio2-9 BUILD_XAUDIO_WIN10
xaudio2-8 BUILD_XAUDIO_WIN8
)
file(INSTALL
${SOURCE_PATH}/Inc/
DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
)
file(INSTALL
${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXTK.lib
${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Release/DirectXTK.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
file(INSTALL
${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXTK.lib
${SOURCE_PATH}/Bin/${SLN_NAME}/${BUILD_ARCH}/Debug/DirectXTK.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
if(NOT VCPKG_TARGET_IS_UWP)
set(DXTK_TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools/directxtk)
file(MAKE_DIRECTORY ${DXTK_TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/MakeSpriteFont/bin/Release/MakeSpriteFont.exe
DESTINATION ${DXTK_TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/XWBTool/Bin/Desktop_${VS_VERSION}/${BUILD_ARCH}/Release/XWBTool.exe
DESTINATION ${DXTK_TOOL_PATH})
vcpkg_build_cmake()
else()
vcpkg_build_cmake(TARGET DirectXTK)
endif()
file(INSTALL ${SOURCE_PATH}/Inc/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/DirectXTK)
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)
vcpkg_copy_tools(
TOOL_NAMES XWBTool
SEARCH_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin/CMake
)
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH MakeSpriteFont/MakeSpriteFont.csproj
PLATFORM AnyCPU
)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)