From fc886ab184e90d1739d7a94a589f330183607fb3 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Fri, 22 Mar 2024 16:32:54 -0700 Subject: [PATCH] [dxsdk-d3dx] port update to support static crt scenarios (#37605) --- ports/dxsdk-d3dx/dxsdk-d3dx-config.cmake.in | 3 +-- ports/dxsdk-d3dx/portfile.cmake | 18 ++++++++++-------- ports/dxsdk-d3dx/usage | 6 ++++++ ports/dxsdk-d3dx/vcpkg.json | 4 ++-- versions/baseline.json | 2 +- versions/d-/dxsdk-d3dx.json | 5 +++++ 6 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 ports/dxsdk-d3dx/usage diff --git a/ports/dxsdk-d3dx/dxsdk-d3dx-config.cmake.in b/ports/dxsdk-d3dx/dxsdk-d3dx-config.cmake.in index 039d0a3b0a..95cd1c2e18 100644 --- a/ports/dxsdk-d3dx/dxsdk-d3dx-config.cmake.in +++ b/ports/dxsdk-d3dx/dxsdk-d3dx-config.cmake.in @@ -1,6 +1,5 @@ -get_filename_component(_d3dx_root "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(_d3dx_root "${_d3dx_root}" PATH) +get_filename_component(_d3dx_root "${CMAKE_CURRENT_LIST_DIR}" PATH) get_filename_component(_d3dx_root "${_d3dx_root}" PATH) set(_d3dx_root_lib "${_d3dx_root}/lib/d3dx9.lib") diff --git a/ports/dxsdk-d3dx/portfile.cmake b/ports/dxsdk-d3dx/portfile.cmake index b406a6735f..143bc9e51f 100644 --- a/ports/dxsdk-d3dx/portfile.cmake +++ b/ports/dxsdk-d3dx/portfile.cmake @@ -4,8 +4,7 @@ endif() message(WARNING "Use of ${PORT} is not recommended for new projects. See https://aka.ms/dxsdk for more information.") -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) - +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled) vcpkg_download_distfile(ARCHIVE @@ -26,15 +25,18 @@ file(INSTALL ${HEADER_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT file(GLOB RELEASE_LIB_FILES "${PACKAGE_PATH}/build/native/release/lib/${VCPKG_TARGET_ARCHITECTURE}/*.lib") file(INSTALL ${RELEASE_LIB_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/lib/") -file(GLOB DEBUG_LIB_FILES "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/*.lib") -file(INSTALL ${DEBUG_LIB_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/") - file(GLOB RELEASE_DLL_FILES "${PACKAGE_PATH}/build/native/release/bin/${VCPKG_TARGET_ARCHITECTURE}/*.dll") file(INSTALL ${RELEASE_DLL_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/bin/") -file(GLOB DEBUG_DLL_FILES "${PACKAGE_PATH}/build/native/debug/bin/${VCPKG_TARGET_ARCHITECTURE}/*.dll") -file(INSTALL ${DEBUG_DLL_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin/") +if(NOT DEFINED VCPKG_BUILD_TYPE) + file(GLOB DEBUG_LIB_FILES "${PACKAGE_PATH}/build/native/debug/lib/${VCPKG_TARGET_ARCHITECTURE}/*.lib") + file(INSTALL ${DEBUG_LIB_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/") -file(INSTALL "${PACKAGE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + file(GLOB DEBUG_DLL_FILES "${PACKAGE_PATH}/build/native/debug/bin/${VCPKG_TARGET_ARCHITECTURE}/*.dll") + file(INSTALL ${DEBUG_DLL_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin/") +endif() + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${PACKAGE_PATH}/LICENSE.txt") configure_file("${CMAKE_CURRENT_LIST_DIR}/dxsdk-d3dx-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" COPYONLY) diff --git a/ports/dxsdk-d3dx/usage b/ports/dxsdk-d3dx/usage new file mode 100644 index 0000000000..da585a2c45 --- /dev/null +++ b/ports/dxsdk-d3dx/usage @@ -0,0 +1,6 @@ +The legacy DirectX SDK D3DX package provides CMake targets: + + find_package(dxsdk-d3dx CONFIG REQUIRED) + target_link_libraries(main PRIVATE Microsoft::D3DX9 Microsoft::D3DX10 Microsoft::D3DX11) + +NOTE: This port is not recommended for use in new projects and is incompatible with the deprecated directxsdk port. diff --git a/ports/dxsdk-d3dx/vcpkg.json b/ports/dxsdk-d3dx/vcpkg.json index 6664186147..1b9a2171fe 100644 --- a/ports/dxsdk-d3dx/vcpkg.json +++ b/ports/dxsdk-d3dx/vcpkg.json @@ -1,9 +1,9 @@ { "name": "dxsdk-d3dx", "version": "9.29.952.8", - "port-version": 6, + "port-version": 7, "description": "Redistributable package for the legacy DirectX SDK's D3DX9, D3DX10, and/or D3DX11 utility libraries.", "homepage": "https://walbourn.github.io/legacy-d3dx-on-nuget/", "license": null, - "supports": "windows & !arm & !uwp & !xbox & !staticcrt" + "supports": "windows & !arm & !uwp & !xbox" } diff --git a/versions/baseline.json b/versions/baseline.json index 87a68481eb..a9404120c1 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2366,7 +2366,7 @@ }, "dxsdk-d3dx": { "baseline": "9.29.952.8", - "port-version": 6 + "port-version": 7 }, "dxut": { "baseline": "11.31", diff --git a/versions/d-/dxsdk-d3dx.json b/versions/d-/dxsdk-d3dx.json index d396180944..6494cb3638 100644 --- a/versions/d-/dxsdk-d3dx.json +++ b/versions/d-/dxsdk-d3dx.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e71fae4b2d12e35a21d5963aa8c59c8ebf5d6586", + "version": "9.29.952.8", + "port-version": 7 + }, { "git-tree": "bca406e04cfde4f63d430a5f2f10273701747f31", "version": "9.29.952.8",