diff options
Diffstat (limited to 'vcpkg/ports/dstorage')
| -rw-r--r-- | vcpkg/ports/dstorage/dstorage-config.cmake.in | 33 | ||||
| -rw-r--r-- | vcpkg/ports/dstorage/portfile.cmake | 37 | ||||
| -rw-r--r-- | vcpkg/ports/dstorage/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/dstorage/vcpkg.json | 9 |
4 files changed, 83 insertions, 0 deletions
diff --git a/vcpkg/ports/dstorage/dstorage-config.cmake.in b/vcpkg/ports/dstorage/dstorage-config.cmake.in new file mode 100644 index 0000000..a84ba21 --- /dev/null +++ b/vcpkg/ports/dstorage/dstorage-config.cmake.in @@ -0,0 +1,33 @@ + +get_filename_component(_dstorage_root "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_dstorage_root "${_dstorage_root}" PATH) +get_filename_component(_dstorage_root "${_dstorage_root}" PATH) + +set(_dstorage_root_lib "${_dstorage_root}/lib/dstorage.lib") +if (EXISTS "${_dstorage_root_lib}") + + add_library(Microsoft::DirectStorage SHARED IMPORTED) + set_target_properties(Microsoft::DirectStorage PROPERTIES + IMPORTED_LOCATION "${_dstorage_root}/bin/dstorage.dll" + IMPORTED_IMPLIB "${_dstorage_root_lib}" + INTERFACE_INCLUDE_DIRECTORIES "${_dstorage_root}/include" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + + add_library(Microsoft::DirectStorageCore SHARED IMPORTED) + set_target_properties(Microsoft::DirectStorageCore PROPERTIES + IMPORTED_LOCATION "${_dstorage_root}/bin/dstoragecore.dll" + IMPORTED_IMPLIB "${_dstorage_root_lib}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C") + + target_link_libraries(Microsoft::DirectStorage INTERFACE Microsoft::DirectStorageCore) + + set(dstorage_FOUND TRUE) + +else() + + set(dstorage_FOUND FALSE) + +endif() + +unset(_dstorage_root_lib) +unset(_dstorage_root) diff --git a/vcpkg/ports/dstorage/portfile.cmake b/vcpkg/ports/dstorage/portfile.cmake new file mode 100644 index 0000000..053e092 --- /dev/null +++ b/vcpkg/ports/dstorage/portfile.cmake @@ -0,0 +1,37 @@ +# Set VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY instead of using `vcpkg_check_linkage` because
+# these DLLs don't link with a CRT.
+set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled)
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.DirectStorage/${VERSION}"
+ FILENAME "directstorage.${VERSION}.zip"
+ SHA512 589a83194e9e05654523b9ca10401982d235dbaa991c8535807d5b9f851d877281417d79a0210f77b46c0f65114f805f4a12f04b7bdb3de8a00fe20c78def791
+)
+
+vcpkg_extract_source_archive(
+ PACKAGE_PATH
+ ARCHIVE ${ARCHIVE}
+ NO_REMOVE_ONE_LEVEL
+)
+
+if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64|arm64ec")
+ set(DS_ARCH arm64)
+else()
+ set(DS_ARCH ${VCPKG_TARGET_ARCHITECTURE})
+endif()
+
+file(INSTALL "${PACKAGE_PATH}/native/include/dstorage.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
+file(INSTALL "${PACKAGE_PATH}/native/include/dstorageerr.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
+
+file(INSTALL "${PACKAGE_PATH}/native/lib/${DS_ARCH}/dstorage.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+
+file(COPY "${PACKAGE_PATH}/native/bin/${DS_ARCH}/dstorage.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
+file(COPY "${PACKAGE_PATH}/native/bin/${DS_ARCH}/dstoragecore.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
+
+file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug")
+file(COPY "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug")
+
+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}/dstorage-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" COPYONLY)
diff --git a/vcpkg/ports/dstorage/usage b/vcpkg/ports/dstorage/usage new file mode 100644 index 0000000..259ccf4 --- /dev/null +++ b/vcpkg/ports/dstorage/usage @@ -0,0 +1,4 @@ +The DirectStorage package provides CMake targets:
+
+ find_package(dstorage CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE Microsoft::DirectStorage)
diff --git a/vcpkg/ports/dstorage/vcpkg.json b/vcpkg/ports/dstorage/vcpkg.json new file mode 100644 index 0000000..6172b2c --- /dev/null +++ b/vcpkg/ports/dstorage/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "dstorage", + "version": "1.3.0", + "description": "DirectStorage for Windows", + "homepage": "https://aka.ms/directstorage/", + "documentation": "https://github.com/microsoft/DirectStorage", + "license": null, + "supports": "windows & !arm32 & !uwp & !xbox" +} |