[directx-dxc] Fix port bug with TARGET_RUNTIME_DLLS (#37401)

This commit is contained in:
Chuck Walbourn 2024-03-20 13:47:48 -07:00 committed by GitHub
parent 46e4c4c78c
commit c039e36377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 51 additions and 40 deletions

View File

@ -1,31 +1,24 @@
get_filename_component(_dxc_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_dxc_root "${_dxc_root}" PATH)
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}")
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_RELEASE "${_dxc_root}/@dll_dir@/@dll_name_dxc@; ${_dxc_root}/@dll_dir@/@dll_name_dxil@"
IMPORTED_LOCATION_DEBUG "${_dxc_root}/@dll_dir@/@dll_name_dxc@; ${_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")
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"
IMPORTED_LINK_INTERFACE_LANGUAGES "C")
set(directx-dxc_FOUND TRUE)
set(DIRECTX_DXC_TOOL ${_dxc_exe})
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"
IMPORTED_LINK_INTERFACE_LANGUAGES "C")
else()
set(directx-dxc_FOUND FALSE)
endif()
unset(_dxc_exe)
unset(_dxc_root)

View File

@ -46,20 +46,23 @@ if (VCPKG_TARGET_IS_LINUX)
"${PACKAGE_PATH}/lib/libdxcompiler.so"
"${PACKAGE_PATH}/lib/libdxil.so"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL
"${PACKAGE_PATH}/lib/libdxcompiler.so"
"${PACKAGE_PATH}/lib/libdxil.so"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
if(NOT DEFINED VCPKG_BUILD_TYPE)
file(INSTALL
"${PACKAGE_PATH}/lib/libdxcompiler.so"
"${PACKAGE_PATH}/lib/libdxil.so"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
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")
@ -78,16 +81,21 @@ else()
DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}")
file(INSTALL "${PACKAGE_PATH}/lib/${DXC_ARCH}/dxcompiler.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL "${PACKAGE_PATH}/lib/${DXC_ARCH}/dxcompiler.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
if(NOT DEFINED VCPKG_BUILD_TYPE)
file(INSTALL "${PACKAGE_PATH}/lib/${DXC_ARCH}/dxcompiler.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
file(INSTALL
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxcompiler.dll"
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxil.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(INSTALL
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxcompiler.dll"
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxil.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
if(NOT DEFINED VCPKG_BUILD_TYPE)
file(INSTALL
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxcompiler.dll"
"${PACKAGE_PATH}/bin/${DXC_ARCH}/dxil.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}/")
@ -101,14 +109,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}")

View File

@ -1,6 +1,7 @@
{
"name": "directx-dxc",
"version-date": "2024-03-07",
"port-version": 1,
"description": "DirectX Shader Compiler (LLVM/Clang)",
"homepage": "https://github.com/microsoft/DirectXShaderCompiler",
"documentation": "https://github.com/microsoft/DirectXShaderCompiler/wiki",
@ -14,6 +15,10 @@
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "zlib",
"platform": "linux & !static"
}
]
}

View File

@ -2210,7 +2210,7 @@
},
"directx-dxc": {
"baseline": "2024-03-07",
"port-version": 0
"port-version": 1
},
"directx-headers": {
"baseline": "1.613.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bf2f80689d803678032f2a8d2b8c8deff4952bb9",
"version-date": "2024-03-07",
"port-version": 1
},
{
"git-tree": "353096a360b10503e2e749b99155ba4ed6751340",
"version-date": "2024-03-07",