aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/directx12-agility
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/directx12-agility')
-rw-r--r--vcpkg/ports/directx12-agility/directx12-config.cmake.in41
-rw-r--r--vcpkg/ports/directx12-agility/portfile.cmake47
-rw-r--r--vcpkg/ports/directx12-agility/usage14
-rw-r--r--vcpkg/ports/directx12-agility/vcpkg.json20
4 files changed, 122 insertions, 0 deletions
diff --git a/vcpkg/ports/directx12-agility/directx12-config.cmake.in b/vcpkg/ports/directx12-agility/directx12-config.cmake.in
new file mode 100644
index 0000000..413d2f0
--- /dev/null
+++ b/vcpkg/ports/directx12-agility/directx12-config.cmake.in
@@ -0,0 +1,41 @@
+get_filename_component(_dx12_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_dx12_root "${_dx12_root}" PATH)
+get_filename_component(_dx12_root "${_dx12_root}" PATH)
+
+if (EXISTS "${_dx12_root}/bin/D3D12Core.dll")
+
+ find_library(D3D12_LIB NAMES d3d12)
+
+ if("${D3D12_LIB}" STREQUAL "D3D12_LIB-NOTFOUND")
+ message(FATAL_ERROR "D3D12.LIB import library from the Windows SDK is required")
+ endif()
+
+ add_library(Microsoft::DirectX12-Core SHARED IMPORTED)
+ set_target_properties(Microsoft::DirectX12-Core PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${_dx12_root}/bin/D3D12Core.dll"
+ IMPORTED_LOCATION_DEBUG "${_dx12_root}/debug/bin/D3D12Core.dll"
+ IMPORTED_IMPLIB "${D3D12_LIB}"
+ IMPORTED_CONFIGURATIONS "Debug;Release"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+ add_library(Microsoft::DirectX12-Layers SHARED IMPORTED)
+ set_target_properties(Microsoft::DirectX12-Layers PROPERTIES
+ IMPORTED_LOCATION_RELEASE "${_dx12_root}/debug/bin/d3d12SDKLayers.dll"
+ IMPORTED_LOCATION_DEBUG "${_dx12_root}/debug/bin/d3d12SDKLayers.dll"
+ IMPORTED_IMPLIB "${D3D12_LIB}"
+ IMPORTED_CONFIGURATIONS "Debug;Release"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C")
+
+ add_library(Microsoft::DirectX12-Agility INTERFACE IMPORTED)
+ set_target_properties(Microsoft::DirectX12-Agility PROPERTIES
+ INTERFACE_LINK_LIBRARIES "Microsoft::DirectX12-Core;Microsoft::DirectX12-Layers")
+
+ set(directx12-agility_FOUND TRUE)
+
+else()
+
+ set(directx12-agility_FOUND FALSE)
+
+endif()
+
+unset(_dx12_root)
diff --git a/vcpkg/ports/directx12-agility/portfile.cmake b/vcpkg/ports/directx12-agility/portfile.cmake
new file mode 100644
index 0000000..2cb890f
--- /dev/null
+++ b/vcpkg/ports/directx12-agility/portfile.cmake
@@ -0,0 +1,47 @@
+set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)
+set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) # headers are provided by the directx-headers port
+set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled)
+set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) # DX12 SDK Debug Layer is an extra DLL
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/${VERSION}"
+ FILENAME "Microsoft.Direct3D.D3D12.${VERSION}.zip"
+ SHA512 0e76fe8d4e756dfdda86e458f0f05425741344c87d7dabb43eddb4d11ec5c2ab27cb5377d0cf490414a2961150000bd7c546ef2748af71832d6b800bfe8778b1
+)
+
+vcpkg_extract_source_archive(
+ PACKAGE_PATH
+ ARCHIVE ${ARCHIVE}
+ NO_REMOVE_ONE_LEVEL
+)
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ set(REDIST_ARCH arm64)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(REDIST_ARCH win32)
+else()
+ set(REDIST_ARCH x64)
+endif()
+
+file(COPY "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/D3D12Core.dll" "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/D3D12Core.pdb"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
+
+file(COPY "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/D3D12Core.dll" "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/D3D12Core.pdb"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
+file(COPY "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/d3d12SDKLayers.dll" "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/d3d12SDKLayers.pdb"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
+
+file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+
+file(COPY "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/d3dconfig.exe" "${PACKAGE_PATH}/build/native/bin/${REDIST_ARCH}/d3dconfig.pdb"
+ DESTINATION "${CURRENT_PACKAGES_DIR}/tools//${PORT}")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include")
+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 "${PACKAGE_PATH}/LICENSE.txt")
+
+message(STATUS "BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS: https://www.nuget.org/packages/Microsoft.Direct3D.D3D12/${VERSION}/License")
+
+configure_file("${CMAKE_CURRENT_LIST_DIR}/directx12-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" @ONLY)
diff --git a/vcpkg/ports/directx12-agility/usage b/vcpkg/ports/directx12-agility/usage
new file mode 100644
index 0000000..4ba0348
--- /dev/null
+++ b/vcpkg/ports/directx12-agility/usage
@@ -0,0 +1,14 @@
+The DirectX 12 Agility SDK package provides CMake targets:
+
+ find_package(directx-headers CONFIG REQUIRED)
+ find_package(directx12-agility CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE Microsoft::DirectX-Headers Microsoft::DirectX-Guids Microsoft::DirectX12-Agility)
+
+ if(TARGET Microsoft::DirectX12-Agility)
+ file(MAKE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12")
+ add_custom_command(TARGET main POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:Microsoft::DirectX12-Core,IMPORTED_LOCATION_RELEASE> $<TARGET_FILE_DIR:main>/D3D12
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:Microsoft::DirectX12-Layers,IMPORTED_LOCATION_DEBUG> $<TARGET_FILE_DIR:main>/D3D12
+ COMMAND_EXPAND_LISTS
+ )
+ endif()
diff --git a/vcpkg/ports/directx12-agility/vcpkg.json b/vcpkg/ports/directx12-agility/vcpkg.json
new file mode 100644
index 0000000..acd0ebc
--- /dev/null
+++ b/vcpkg/ports/directx12-agility/vcpkg.json
@@ -0,0 +1,20 @@
+{
+ "name": "directx12-agility",
+ "version": "1.618.3",
+ "description": "DirectX 12 Agility SDK",
+ "homepage": "https://aka.ms/directx12agility",
+ "documentation": "https://devblogs.microsoft.com/directx/gettingstarted-dx12agility/",
+ "license": null,
+ "supports": "windows & !uwp & !xbox & !arm32",
+ "dependencies": [
+ "directx-headers",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}