diff --git a/ports/openxr-loader/001-fix-array-decl.patch b/ports/openxr-loader/001-fix-array-decl.patch new file mode 100644 index 00000000000000..9bd25eb319cf92 --- /dev/null +++ b/ports/openxr-loader/001-fix-array-decl.patch @@ -0,0 +1,26 @@ +--- openxr.hpp 2020-08-16 14:42:30.845279600 -0700 ++++ openxr.hpp 2020-08-16 14:45:19.707229200 -0700 +@@ -18249,9 +18249,9 @@ + public: + // ctor + SpatialGraphNodeSpaceCreateInfoMSFT ( +- const SpatialGraphNodeTypeMSFT& nodeType_ = {}, +- uint8_t nodeId[16]_ = 0, +- const Posef& pose_ = {} ++ const SpatialGraphNodeTypeMSFT& nodeType_, ++ uint8_t nodeId_[16], ++ const Posef& pose_ + ) + : + +@@ -18259,9 +18259,9 @@ + ) , + + nodeType {nodeType_} , +- nodeId {nodeId_} , + pose {pose_} + { ++ memcpy(nodeId, nodeId_, 16); + } + operator const XrSpatialGraphNodeSpaceCreateInfoMSFT&() const { return *reinterpret_cast(this); } + operator XrSpatialGraphNodeSpaceCreateInfoMSFT &() { diff --git a/ports/openxr-loader/CONTROL b/ports/openxr-loader/CONTROL index 632fadab740b55..451ffe0da5a649 100644 --- a/ports/openxr-loader/CONTROL +++ b/ports/openxr-loader/CONTROL @@ -1,5 +1,5 @@ Source: openxr-loader -Version: 1.0.3.0 +Version: 1.0.11 Description: Khronos API for abstracting VR/MR/AR hardware Supports: !(arm|uwp) diff --git a/ports/openxr-loader/portfile.cmake b/ports/openxr-loader/portfile.cmake index 19e2cda6ce419f..25c2dcbb81c7d9 100644 --- a/ports/openxr-loader/portfile.cmake +++ b/ports/openxr-loader/portfile.cmake @@ -1,25 +1,32 @@ -if (VCPKG_TARGET_ARCHITECTURE MATCHES "^arm*") - message(FATAL_ERROR "OpenXR does not support arm") -endif() +vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "uwp") -if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - # Due to UWP restricting the usage of static CRT OpenXR cannot be built. - message(FATAL_ERROR "OpenXR does not support UWP") -endif() +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO KhronosGroup/OpenXR-SDK + REF e3a4e41d61544d8e2eba73f00da99b6818ec472b + SHA512 26c6b547aa30d89895efcc835dddc3b58ab57f0e450a4ae82655a990a816dd57c70e43267a10da75b1c2bd160189942e443c8e27367d6648417d1c9c134e7694 + HEAD_REF master +) -include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SDK_SOURCE_PATH + REPO KhronosGroup/OpenXR-SDK-Source + REF 6dee6e228f47857adf5d7673eb90c64f04d33c60 + SHA512 0c522eef95b4d8bdc8e4f1ca852cd9798ff2bca9ef8511446d9cdf80bc314b0da454ab5c203658bbe43d3e7ff3d757b9427c3f75829b2a022a25041d1a2d2b12 + HEAD_REF master +) vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO jherico/OpenXR-SDK - REF e3dcdb820fae01fb8d25dfd32e15d14caa14b411 - SHA512 421eb3651e388b69d70d3200a1c40d363c0ac9eb1d35c89a53430ea764dd3dd0e864b756dfff0e0f98ac574309331782c95a1cadcfe84eb5a6c34434737d7a38 + OUT_SOURCE_PATH HPP_SOURCE_PATH + REPO KhronosGroup/OpenXR-hpp + REF 097a7535563fc84bb7648ea9c5a4531a1e909458 + SHA512 fe953405724e9c4a8218cd269a23317ebc8164330a519eb82de75e832bc05e2c51d24bca24e4ce13724bf275c33b26f6646e25f29eeffe6840ffc552f3351ad0 HEAD_REF master ) # Weird behavior inside the OpenXR loader. On Windows they force shared libraries to use static crt, and # vice-versa. Might be better in future iterations to patch the CMakeLists.txt for OpenXR -if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if (VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_WINDOWS) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) set(DYNAMIC_LOADER OFF) set(VCPKG_CRT_LINKAGE dynamic) @@ -44,11 +51,29 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +set(ENV{OPENXR_REPO} ${SDK_SOURCE_PATH}) + +vcpkg_execute_required_process( + COMMAND ${PYTHON3} ${HPP_SOURCE_PATH}/scripts/hpp_genxr.py -registry ${SDK_SOURCE_PATH}/specification/registry/xr.xml -o ${CURRENT_PACKAGES_DIR}/include/openxr openxr.hpp + WORKING_DIRECTORY ${HPP_SOURCE_PATH} + LOGFILE openxrhpp +) + +vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include/openxr + PATCHES + 001-fix-array-decl.patch +) + +if(VCPKG_TARGET_IS_WINDOWS) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/OpenXR) +else(VCPKG_TARGET_IS_WINDOWS) + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/openxr TARGET_PATH share/OpenXR) +endif() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -# No CMake files are contained in /share only docs -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share) -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openxr-loader RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_copy_pdbs()