Skip to content

Commit

Permalink
[openxr-loader] Update to latest version, official repo (microsoft#12060
Browse files Browse the repository at this point in the history
)

Co-authored-by: NancyLi1013 <[email protected]>
  • Loading branch information
2 people authored and remz1337 committed Aug 23, 2020
1 parent c3f078e commit 091eb83
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 17 deletions.
26 changes: 26 additions & 0 deletions ports/openxr-loader/001-fix-array-decl.patch
Original file line number Diff line number Diff line change
@@ -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<const XrSpatialGraphNodeSpaceCreateInfoMSFT*>(this); }
operator XrSpatialGraphNodeSpaceCreateInfoMSFT &() {
2 changes: 1 addition & 1 deletion ports/openxr-loader/CONTROL
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
57 changes: 41 additions & 16 deletions ports/openxr-loader/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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()

0 comments on commit 091eb83

Please sign in to comment.