[xaudio2redist] Code cleanup for port (#37455)

* Updated portfile for modern best practices
* Fixed behavior with VCPKG_BUILD_TYPE set to "release"
* Added specific usage help
* Minor CMake cleanup
This commit is contained in:
Chuck Walbourn 2024-03-15 18:38:47 -07:00 committed by GitHub
parent de18cd9b33
commit c679ba3ccc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 12 deletions

View File

@ -1,4 +1,4 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)
vcpkg_download_distfile(ARCHIVE
@ -17,21 +17,32 @@ file(GLOB HEADER_FILES "${PACKAGE_PATH}/build/native/include/*.h")
file(INSTALL ${HEADER_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}")
file(INSTALL "${PACKAGE_PATH}/build/native/release/lib/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist_md.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(INSTALL "${PACKAGE_PATH}/build/native/release/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist_md.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
set(lib_suffix "_md")
else()
file(INSTALL "${PACKAGE_PATH}/build/native/release/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
set(lib_suffix "")
endif()
file(COPY "${PACKAGE_PATH}/build/native/release/bin/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(COPY "${PACKAGE_PATH}/build/native/debug/bin/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(INSTALL "${PACKAGE_PATH}/build/native/release/bin/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL "${PACKAGE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
if(NOT DEFINED VCPKG_BUILD_TYPE)
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
configure_file("${CMAKE_CURRENT_LIST_DIR}/xaudio2redist-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" @ONLY)
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist_md.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
else()
file(INSTALL "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/xapobaseredist.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
file(INSTALL "${PACKAGE_PATH}/build/native/debug/bin/${VCPKG_TARGET_ARCHITECTURE}/xaudio2_9redist.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/xaudio2redist-config.cmake.in"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake"
@ONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${PACKAGE_PATH}/LICENSE.txt")

View File

@ -0,0 +1,4 @@
The XAudio2 redistributable package provides CMake targets
find_package(xaudio2redist CONFIG REQUIRED)
target_link_libraries(main PRIVATE Microsoft::XAudio2Redist)

View File

@ -1,7 +1,7 @@
{
"name": "xaudio2redist",
"version": "1.2.11",
"port-version": 1,
"port-version": 2,
"description": "Redistributable version of XAudio 2.9 for Windows 7 SP1 or later",
"homepage": "https://aka.ms/XAudio2Redist",
"documentation": "https://aka.ms/XAudio2Redist",

View File

@ -1,6 +1,5 @@
get_filename_component(_xaudio2_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_xaudio2_root "${_xaudio2_root}" PATH)
get_filename_component(_xaudio2_root "${CMAKE_CURRENT_LIST_DIR}" PATH)
get_filename_component(_xaudio2_root "${_xaudio2_root}" PATH)
set(_xaudio2_root_lib "${_xaudio2_root}/lib/xaudio2_9redist.lib")

View File

@ -9358,7 +9358,7 @@
},
"xaudio2redist": {
"baseline": "1.2.11",
"port-version": 1
"port-version": 2
},
"xbitmaps": {
"baseline": "1.1.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f6cb8fa89efa0d50385ddfb245b02ea67197b0d6",
"version": "1.2.11",
"port-version": 2
},
{
"git-tree": "ea44b309cb33ba705034f328310347d43680d0ee",
"version": "1.2.11",