diff --git a/ports/directx-dxc/directx-dxc-config.cmake.in b/ports/directx-dxc/directx-dxc-config.cmake.in index 881ae26b6bd737..93b687fce46889 100644 --- a/ports/directx-dxc/directx-dxc-config.cmake.in +++ b/ports/directx-dxc/directx-dxc-config.cmake.in @@ -1,44 +1,28 @@ - get_filename_component(_dxc_root "${CMAKE_CURRENT_LIST_DIR}" PATH) get_filename_component(_dxc_root "${_dxc_root}" PATH) -set(_dxc_exe "${_dxc_root}/@tool_path@") -if (EXISTS "${_dxc_exe}") - - add_library(Microsoft::DirectXShaderCompiler SHARED IMPORTED) - set_target_properties(Microsoft::DirectXShaderCompiler PROPERTIES - IMPORTED_LOCATION_RELEASE "${_dxc_root}/@dll_dir@/@dll_name_dxc@" - IMPORTED_LOCATION_DEBUG "${_dxc_root}/@dll_dir@/@dll_name_dxc@" - IMPORTED_IMPLIB_RELEASE "${_dxc_root}/lib/@lib_name@" - IMPORTED_IMPLIB_DEBUG "${_dxc_root}/lib/@lib_name@" - IMPORTED_SONAME_RELEASE "@lib_name@" - IMPORTED_SONAME_DEBUG "@lib_name@" - INTERFACE_INCLUDE_DIRECTORIES "${_dxc_root}/include/directx-dxc" - IMPORTED_CONFIGURATIONS "Debug;Release" - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - - add_library(Microsoft::DXIL SHARED IMPORTED) - set_target_properties(Microsoft::DXIL PROPERTIES - IMPORTED_LOCATION_RELEASE "${_dxc_root}/@dll_dir@/@dll_name_dxil@" - IMPORTED_LOCATION_DEBUG "${_dxc_root}/@dll_dir@/@dll_name_dxil@" - IMPORTED_IMPLIB_RELEASE "${_dxc_root}/lib/@lib_name@" - IMPORTED_IMPLIB_DEBUG "${_dxc_root}/lib/@lib_name@" - IMPORTED_SONAME_RELEASE "@lib_name@" - IMPORTED_SONAME_DEBUG "@lib_name@" - INTERFACE_INCLUDE_DIRECTORIES "${_dxc_root}/include/directx-dxc" - IMPORTED_CONFIGURATIONS "Debug;Release" - IMPORTED_LINK_INTERFACE_LANGUAGES "C") - - target_link_libraries(Microsoft::DirectXShaderCompiler INTERFACE Microsoft::DXIL) - - set(directx-dxc_FOUND TRUE) - set(DIRECTX_DXC_TOOL ${_dxc_exe}) - -else() - - set(directx-dxc_FOUND FALSE) - -endif() +set(DIRECTX_DXC_TOOL "${_dxc_root}/@tool_path@" CACHE PATH "Location of the dxc tool") +mark_as_advanced(DIRECTX_DXC_TOOL) + +add_library(Microsoft::DirectXShaderCompiler SHARED IMPORTED) +set_target_properties(Microsoft::DirectXShaderCompiler PROPERTIES + IMPORTED_LOCATION "${_dxc_root}/@dll_dir@/@dll_name_dxc@" + IMPORTED_IMPLIB "${_dxc_root}/lib/@lib_name@" + IMPORTED_SONAME "@lib_name@" + INTERFACE_INCLUDE_DIRECTORIES "${_dxc_root}/include/directx-dxc" + INTERFACE_LINK_LIBRARIES "Microsoft::DXIL" + MAP_IMPORTED_CONFIG_MINSIZEREL "" + MAP_IMPORTED_CONFIG_RELWITHDEBINFO "" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + +add_library(Microsoft::DXIL SHARED IMPORTED) +set_target_properties(Microsoft::DXIL PROPERTIES + IMPORTED_LOCATION "${_dxc_root}/@dll_dir@/@dll_name_dxil@" + IMPORTED_IMPLIB "${_dxc_root}/lib/@lib_name@" + IMPORTED_SONAME "@lib_name@" + INTERFACE_INCLUDE_DIRECTORIES "${_dxc_root}/include/directx-dxc" + MAP_IMPORTED_CONFIG_MINSIZEREL "" + MAP_IMPORTED_CONFIG_RELWITHDEBINFO "" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") -unset(_dxc_exe) unset(_dxc_root) diff --git a/ports/directx-dxc/portfile.cmake b/ports/directx-dxc/portfile.cmake index 5149540ab7623d..14423908c90f49 100644 --- a/ports/directx-dxc/portfile.cmake +++ b/ports/directx-dxc/portfile.cmake @@ -1,11 +1,7 @@ -set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) - set(DIRECTX_DXC_TAG v1.8.2403) set(DIRECTX_DXC_VERSION 2024_03_07) -if (NOT VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - message(STATUS "Note: ${PORT} always requires dynamic library linkage at runtime.") -endif() +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) if (VCPKG_TARGET_IS_LINUX) vcpkg_download_distfile(ARCHIVE @@ -56,13 +52,13 @@ if (VCPKG_TARGET_IS_LINUX) file(INSTALL "${PACKAGE_PATH}/bin/dxc" - DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/") set(dll_name_dxc "libdxcompiler.so") set(dll_name_dxil "libdxil.so") set(dll_dir "lib") set(lib_name "libdxcompiler.so") - set(tool_path "bin/dxc") + set(tool_path "tools/${PORT}/dxc") else() # VCPKG_TARGET_IS_WINDOWS if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") @@ -109,14 +105,14 @@ else() set(dll_name_dxil "dxil.dll") set(dll_dir "bin") set(lib_name "dxcompiler.lib") - set(tool_path "tools/directx-dxc/dxc.exe") + set(tool_path "tools/${PORT}/dxc.exe") endif() +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") + configure_file("${CMAKE_CURRENT_LIST_DIR}/directx-dxc-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" @ONLY) -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") - file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${LICENSE_TXT}") diff --git a/ports/directx-dxc/vcpkg.json b/ports/directx-dxc/vcpkg.json index 4896f7225141bb..28aa7ba70f0ed2 100644 --- a/ports/directx-dxc/vcpkg.json +++ b/ports/directx-dxc/vcpkg.json @@ -15,6 +15,10 @@ { "name": "vcpkg-cmake-config", "host": true + }, + { + "name": "zlib", + "platform": "!static" } ] } diff --git a/versions/d-/directx-dxc.json b/versions/d-/directx-dxc.json index 0d235ec147d75a..69a5d1cc8fec04 100644 --- a/versions/d-/directx-dxc.json +++ b/versions/d-/directx-dxc.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "bb359aa2753ed65f6158846e29a0b9d127f29a49", + "git-tree": "4567b5dacc64424288773483ef92b48a72147f2c", "version-date": "2024-03-07", "port-version": 1 },