mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
ports: Add openxr-loader.
Copy from vcpkg repository. Add OpenXR to hifi-client-deps.
This commit is contained in:
parent
80c7b8f993
commit
1ceeb39306
6 changed files with 173 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
Source: hifi-client-deps
|
Source: hifi-client-deps
|
||||||
Version: 0.1
|
Version: 0.1
|
||||||
Description: Collected dependencies for High Fidelity applications
|
Description: Collected dependencies for High Fidelity applications
|
||||||
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android)
|
Build-Depends: hifi-deps, aristo (windows), glslang, liblo (windows), nlohmann-json, openvr ((linux&!arm)|windows), openxr-loader, quazip (!android), sdl2 (!android), spirv-cross (!android), spirv-tools (!android), sranipal (windows), vulkanmemoryallocator, discord-rpc (!android)
|
||||||
|
|
23
cmake/ports/openxr-loader/fix-jinja2.patch
Normal file
23
cmake/ports/openxr-loader/fix-jinja2.patch
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
From d80c7dc3f4810fc49e4444590d39ef71e8a9b01c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Adam Johnson <AdamJohnso@gmail.com>
|
||||||
|
Date: Sat, 19 Feb 2022 19:42:31 -0500
|
||||||
|
Subject: [PATCH] Fix bad import in jinja2
|
||||||
|
|
||||||
|
---
|
||||||
|
external/python/jinja2/utils.py | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/external/python/jinja2/utils.py b/external/python/jinja2/utils.py
|
||||||
|
index db9c5d06..f198e3ef 100644
|
||||||
|
--- a/external/python/jinja2/utils.py
|
||||||
|
+++ b/external/python/jinja2/utils.py
|
||||||
|
@@ -639,4 +639,8 @@ def __repr__(self):
|
||||||
|
|
||||||
|
|
||||||
|
# Imported here because that's where it was in the past
|
||||||
|
-from markupsafe import Markup, escape, soft_unicode
|
||||||
|
+from markupsafe import Markup, escape
|
||||||
|
+try:
|
||||||
|
+ from markupsafe import soft_unicode
|
||||||
|
+except ImportError:
|
||||||
|
+ from markupsafe import soft_str as soft_unicode
|
30
cmake/ports/openxr-loader/fix-openxr-sdk-jsoncpp.patch
Normal file
30
cmake/ports/openxr-loader/fix-openxr-sdk-jsoncpp.patch
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||||
|
index c75b145..386494c 100644
|
||||||
|
--- a/src/CMakeLists.txt
|
||||||
|
+++ b/src/CMakeLists.txt
|
||||||
|
@@ -89,7 +89,7 @@ if(NOT VULKAN_INCOMPATIBLE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
-find_package(JsonCpp)
|
||||||
|
+find_package(jsoncpp CONFIG REQUIRED)
|
||||||
|
|
||||||
|
### All options defined here
|
||||||
|
option(BUILD_LOADER "Build loader" ON)
|
||||||
|
diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt
|
||||||
|
index 6a88cf4..0821a3d 100644
|
||||||
|
--- a/src/loader/CMakeLists.txt
|
||||||
|
+++ b/src/loader/CMakeLists.txt
|
||||||
|
@@ -68,7 +68,11 @@ add_library(openxr_loader ${LIBRARY_TYPE}
|
||||||
|
${openxr_loader_RESOURCE_FILE}
|
||||||
|
)
|
||||||
|
if(BUILD_WITH_SYSTEM_JSONCPP)
|
||||||
|
- target_link_libraries(openxr_loader PRIVATE JsonCpp::JsonCpp)
|
||||||
|
+ if(BUILD_SHARED_LIBS)
|
||||||
|
+ target_link_libraries(openxr_loader PRIVATE jsoncpp_lib)
|
||||||
|
+ else()
|
||||||
|
+ target_link_libraries(openxr_loader PRIVATE jsoncpp_static)
|
||||||
|
+ endif()
|
||||||
|
else()
|
||||||
|
target_sources(openxr_loader
|
||||||
|
PRIVATE
|
79
cmake/ports/openxr-loader/portfile.cmake
Normal file
79
cmake/ports/openxr-loader/portfile.cmake
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
vcpkg_from_github(
|
||||||
|
OUT_SOURCE_PATH SOURCE_PATH
|
||||||
|
REPO KhronosGroup/OpenXR-SDK
|
||||||
|
REF "release-${VERSION}"
|
||||||
|
SHA512 6efc7596e707f95366dbcdbac9bd7d0c20735a2175b4edf56a9e8a112cf0ab8b664069fe942313164a37119032ddbf5671bc88ab5f276005dd36e4a4dabba1c7
|
||||||
|
HEAD_REF master
|
||||||
|
PATCHES
|
||||||
|
fix-openxr-sdk-jsoncpp.patch
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_from_github(
|
||||||
|
OUT_SOURCE_PATH SDK_SOURCE_PATH
|
||||||
|
REPO KhronosGroup/OpenXR-SDK-Source
|
||||||
|
REF "release-${VERSION}"
|
||||||
|
SHA512 04bdb0f16078209b5edd175a3396f70e1ceb8cfa382c65b8fda388e565480e3844daf68e0d987e72ed8c21d3148af0b41a2170911ec1660565887e0e5ae6d2bf
|
||||||
|
HEAD_REF master
|
||||||
|
PATCHES
|
||||||
|
fix-openxr-sdk-jsoncpp.patch
|
||||||
|
fix-jinja2.patch
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_from_github(
|
||||||
|
OUT_SOURCE_PATH HPP_SOURCE_PATH
|
||||||
|
REPO KhronosGroup/OpenXR-hpp
|
||||||
|
REF 63db9919822f8af6f7bf7416ba6a015d4617202e
|
||||||
|
SHA512 9e768f485d1631f8e74f35f028a64e2d64e33d362c53ae1c54427a10786e3befdd24089927319aa1a4b4c3e010247bd6cb3394bcee460c467c637ab6bc7bec90
|
||||||
|
HEAD_REF master
|
||||||
|
PATCHES
|
||||||
|
python3_8_compatibility.patch
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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 (VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_WINDOWS)
|
||||||
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||||
|
set(DYNAMIC_LOADER OFF)
|
||||||
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
|
else()
|
||||||
|
set(DYNAMIC_LOADER ON)
|
||||||
|
set(VCPKG_CRT_LINKAGE static)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
vcpkg_find_acquire_program(PYTHON3)
|
||||||
|
|
||||||
|
vcpkg_cmake_configure(
|
||||||
|
SOURCE_PATH "${SOURCE_PATH}"
|
||||||
|
OPTIONS
|
||||||
|
-DBUILD_API_LAYERS=OFF
|
||||||
|
-DBUILD_TESTS=OFF
|
||||||
|
-DBUILD_CONFORMANCE_TESTS=OFF
|
||||||
|
-DDYNAMIC_LOADER=${DYNAMIC_LOADER}
|
||||||
|
-DPYTHON_EXECUTABLE="${PYTHON3}"
|
||||||
|
-DBUILD_WITH_SYSTEM_JSONCPP=ON
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_cmake_install()
|
||||||
|
|
||||||
|
# Generate the OpenXR C++ bindings
|
||||||
|
set(ENV{OPENXR_REPO} "${SDK_SOURCE_PATH}")
|
||||||
|
vcpkg_execute_required_process(
|
||||||
|
COMMAND ${PYTHON3} "${HPP_SOURCE_PATH}/scripts/hpp_genxr.py" -quiet -registry "${SDK_SOURCE_PATH}/specification/registry/xr.xml" -o "${CURRENT_PACKAGES_DIR}/include/openxr"
|
||||||
|
WORKING_DIRECTORY "${HPP_SOURCE_PATH}"
|
||||||
|
LOGNAME "openxr-hpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(VCPKG_TARGET_IS_WINDOWS)
|
||||||
|
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenXR CONFIG_PATH cmake)
|
||||||
|
else()
|
||||||
|
vcpkg_cmake_config_fixup(PACKAGE_NAME OpenXR CONFIG_PATH lib/cmake/openxr)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||||
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||||
|
|
||||||
|
vcpkg_fixup_pkgconfig()
|
||||||
|
vcpkg_copy_pdbs()
|
||||||
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
13
cmake/ports/openxr-loader/python3_8_compatibility.patch
Normal file
13
cmake/ports/openxr-loader/python3_8_compatibility.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/scripts/hpp_genxr.py b/scripts/hpp_genxr.py
|
||||||
|
index ce419b0..23e1d3d 100644
|
||||||
|
--- a/scripts/hpp_genxr.py
|
||||||
|
+++ b/scripts/hpp_genxr.py
|
||||||
|
@@ -36,7 +36,7 @@ from xrconventions import OpenXRConventions
|
||||||
|
from data import EXCLUDED_EXTENSIONS
|
||||||
|
|
||||||
|
|
||||||
|
-def makeREstring(strings: Iterable[str], default: typing.Optional[str] = None) -> str:
|
||||||
|
+def makeREstring(strings, default: typing.Optional[str] = None) -> str:
|
||||||
|
"""Turn a list of strings into a regexp string matching exactly those strings."""
|
||||||
|
if strings or default is None:
|
||||||
|
return f"^({'|'.join(re.escape(s) for s in strings)})$"
|
27
cmake/ports/openxr-loader/vcpkg.json
Normal file
27
cmake/ports/openxr-loader/vcpkg.json
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "openxr-loader",
|
||||||
|
"version": "1.0.31",
|
||||||
|
"description": "A royalty-free, open standard that provides high-performance access to Augmented Reality (AR) and Virtual Reality (VR)—collectively known as XR—platforms and devices",
|
||||||
|
"homepage": "https://github.com/KhronosGroup/OpenXR-SDK",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"supports": "!uwp & !osx",
|
||||||
|
"dependencies": [
|
||||||
|
"jsoncpp",
|
||||||
|
{
|
||||||
|
"name": "vcpkg-cmake",
|
||||||
|
"host": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vcpkg-cmake-config",
|
||||||
|
"host": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"features": {
|
||||||
|
"vulkan": {
|
||||||
|
"description": "Vulkan functionality for OpenXR",
|
||||||
|
"dependencies": [
|
||||||
|
"vulkan"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue