diff --git a/ports/xaudio2redist/portfile.cmake b/ports/xaudio2redist/portfile.cmake index 9c8151904d..5d7be988b7 100644 --- a/ports/xaudio2redist/portfile.cmake +++ b/ports/xaudio2redist/portfile.cmake @@ -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") diff --git a/ports/xaudio2redist/usage b/ports/xaudio2redist/usage new file mode 100644 index 0000000000..6c0f1c23f7 --- /dev/null +++ b/ports/xaudio2redist/usage @@ -0,0 +1,4 @@ +The XAudio2 redistributable package provides CMake targets + + find_package(xaudio2redist CONFIG REQUIRED) + target_link_libraries(main PRIVATE Microsoft::XAudio2Redist) diff --git a/ports/xaudio2redist/vcpkg.json b/ports/xaudio2redist/vcpkg.json index 6e703249c2..73ff55325c 100644 --- a/ports/xaudio2redist/vcpkg.json +++ b/ports/xaudio2redist/vcpkg.json @@ -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", diff --git a/ports/xaudio2redist/xaudio2redist-config.cmake.in b/ports/xaudio2redist/xaudio2redist-config.cmake.in index 033e2f6b01..4829ec4947 100644 --- a/ports/xaudio2redist/xaudio2redist-config.cmake.in +++ b/ports/xaudio2redist/xaudio2redist-config.cmake.in @@ -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") diff --git a/versions/baseline.json b/versions/baseline.json index 25cb5f10fb..fec7f00abd 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9358,7 +9358,7 @@ }, "xaudio2redist": { "baseline": "1.2.11", - "port-version": 1 + "port-version": 2 }, "xbitmaps": { "baseline": "1.1.2", diff --git a/versions/x-/xaudio2redist.json b/versions/x-/xaudio2redist.json index 1200b508cd..eac07c946d 100644 --- a/versions/x-/xaudio2redist.json +++ b/versions/x-/xaudio2redist.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f6cb8fa89efa0d50385ddfb245b02ea67197b0d6", + "version": "1.2.11", + "port-version": 2 + }, { "git-tree": "ea44b309cb33ba705034f328310347d43680d0ee", "version": "1.2.11",