mirror of
https://github.com/overte-org/overte.git
synced 2025-08-12 14:34:43 +02:00
🔧 Added OpenXR conan pkg
This commit is contained in:
parent
f3590d1a41
commit
881a0ce999
8 changed files with 16 additions and 175 deletions
11
cmake/macros/TargetOpenXR.cmake
Normal file
11
cmake/macros/TargetOpenXR.cmake
Normal file
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# Created by Bradley Austin Davis on 2018/10/24
|
||||
# Copyright 2013-2018 High Fidelity, Inc.
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_OPENXR)
|
||||
find_package(OpenXR REQUIRED)
|
||||
target_link_libraries(${TARGET_NAME} OpenXR::openxr_loader)
|
||||
endmacro()
|
|
@ -1,34 +0,0 @@
|
|||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO open-source-parsers/jsoncpp
|
||||
REF "${VERSION}"
|
||||
SHA512 1d06e044759b1e1a4cc4960189dd7e001a0a4389d7239a6d59295af995a553518e4e0337b4b4b817e70da5d9731a4c98655af90791b6287870b5ff8d73ad8873
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" JSONCPP_STATIC)
|
||||
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DJSONCPP_WITH_CMAKE_PACKAGE=ON
|
||||
-DBUILD_STATIC_LIBS=${JSONCPP_STATIC}
|
||||
-DJSONCPP_STATIC_WINDOWS_RUNTIME=${STATIC_CRT}
|
||||
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=ON
|
||||
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
|
||||
-DJSONCPP_WITH_TESTS=OFF
|
||||
-DJSONCPP_WITH_EXAMPLE=OFF
|
||||
-DBUILD_OBJECT_LIBS=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/jsoncpp)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "jsoncpp",
|
||||
"version": "1.9.5",
|
||||
"port-version": 4,
|
||||
"description": "JsonCpp is a C++ library that allows manipulating JSON values, including serialization and deserialization to and from strings. It can also preserve existing comment in unserialization/serialization steps, making it a convenient format to store user input files.",
|
||||
"homepage": "https://github.com/open-source-parsers/jsoncpp",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index c2e53cf..2c195de 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -122,7 +122,7 @@ if(NOT METAL_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 28aff53..6ee58f4 100644
|
||||
--- a/src/loader/CMakeLists.txt
|
||||
+++ b/src/loader/CMakeLists.txt
|
||||
@@ -101,7 +101,11 @@ endif()
|
||||
|
||||
# Get jsoncpp externally or internally
|
||||
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()
|
||||
if(NOT BUILD_LOADER_WITH_EXCEPTION_HANDLING)
|
||||
target_compile_definitions(openxr_loader PRIVATE JSON_USE_EXCEPTION=0)
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO KhronosGroup/OpenXR-SDK
|
||||
REF "release-${VERSION}"
|
||||
SHA512 f5f02857036d14c3894bee979bf108c4066ff5551393bc9bdde85dced5c5007148880c6174174dfe3b844e00baeb66106afbf18be069958128404d6a9bdc96ce
|
||||
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 29155f5cd6104a479ce25ea090020001a01652ce42823ddad3e2569d7d2d513a0339c084d90acd3a00b220f7ba1cf68af1ac4b4c01f0a949aa9d919a1914d6c9
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-openxr-sdk-jsoncpp.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()
|
||||
|
||||
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)
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "openxr-loader",
|
||||
"version": "1.1.46",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@ class Overte(ConanFile):
|
|||
self.requires("onetbb/2021.10.0")
|
||||
self.requires("openexr/3.1.9")
|
||||
self.requires("openvr/2.2.3@overte/stable")
|
||||
self.requires("openxr/1.1.46@overte/stable")
|
||||
self.requires("opus/1.4")
|
||||
self.requires("polyvox/0.2.1@overte/stable")
|
||||
self.requires("quazip/1.4")
|
||||
|
@ -77,6 +78,7 @@ class Overte(ConanFile):
|
|||
self.requires("vulkan-memory-allocator/3.0.1")
|
||||
self.requires("zlib/1.2.13")
|
||||
self.requires("glm/0.9.9.5", force=True)
|
||||
self.requires("jsoncpp/1.9.6", force=True)
|
||||
openssl = "openssl/1.1.1q"
|
||||
|
||||
if self.options.qt_source == "system":
|
||||
|
|
|
@ -5,21 +5,18 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
find_package(OpenXR REQUIRED)
|
||||
if (NOT OpenXR_FOUND)
|
||||
MESSAGE(FATAL_ERROR "OpenXR not found!")
|
||||
endif()
|
||||
|
||||
set(TARGET_NAME openxr)
|
||||
setup_hifi_plugin(Gui Qml Multimedia)
|
||||
link_hifi_libraries(shared task gl qml networking controllers ui
|
||||
plugins display-plugins ui-plugins input-plugins
|
||||
audio-client render-utils graphics shaders gpu render
|
||||
material-networking model-networking model-baker hfm
|
||||
model-serializers ktx image procedural ${PLATFORM_GL_BACKEND} OpenXR::openxr_loader)
|
||||
model-serializers ktx image procedural ${PLATFORM_GL_BACKEND})
|
||||
include_hifi_library_headers(octree)
|
||||
include_hifi_library_headers(script-engine)
|
||||
|
||||
target_openxr()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
# Silence GCC warnings
|
||||
target_compile_options(openxr PRIVATE -Wno-missing-field-initializers)
|
||||
|
|
Loading…
Reference in a new issue