From 657db4c8fe46cf7d8f15155bc6b386581934d568 Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 22 Jan 2024 11:23:28 +0100 Subject: [PATCH] :bug: Fixed OpenVR failing to link on windows --- conan-recipes/openvr/all/conandata.yml | 10 +++++-- conan-recipes/openvr/all/conanfile.py | 33 ++++++++++++++++++++-- conanfile.py | 2 +- plugins/openvr/src/ViveControllerManager.h | 2 +- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/conan-recipes/openvr/all/conandata.yml b/conan-recipes/openvr/all/conandata.yml index 5d517862ac..193317e08f 100644 --- a/conan-recipes/openvr/all/conandata.yml +++ b/conan-recipes/openvr/all/conandata.yml @@ -1,4 +1,10 @@ sources: - "1.26.7": - url: https://github.com/ValveSoftware/openvr/archive/refs/tags/v1.26.7.tar.gz + 1.26.7: sha256: e7391f1129db777b2754f5b017cfa356d7811a7bcaf57f09805b47c2e630a725 + url: https://github.com/ValveSoftware/openvr/archive/refs/tags/v1.26.7.tar.gz + 2.0.10: + sha256: 22c9a3c5c2ed9ebf0423ab329ecc3b870b0c980abdfbaaa204e5b59313d8c7e3 + url: https://github.com/ValveSoftware/openvr/archive/refs/tags/v2.0.10.tar.gz + 2.2.3: + sha256: 4da20c2c33e7488703802eafd7f2e6c92dd0f324e887711e1e11e9b9d3dd3daa + url: https://github.com/ValveSoftware/openvr/archive/refs/tags/v2.2.3.tar.gz diff --git a/conan-recipes/openvr/all/conanfile.py b/conan-recipes/openvr/all/conanfile.py index f50cfd54b9..9061406327 100644 --- a/conan-recipes/openvr/all/conanfile.py +++ b/conan-recipes/openvr/all/conanfile.py @@ -16,21 +16,40 @@ class OpenvrConan(ConanFile): homepage = "https://github.com/ValveSoftware/openvr" license = "BSD-3-Clause" settings = "os", "compiler", "build_type", "arch" + implements = ["auto_shared_fpic"] + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} def layout(self): cmake_layout(self) def requirements(self): - self.requires("jsoncpp/1.9.4") + self.requires("jsoncpp/1.9.5") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) # Unvendor jsoncpp (we rely on our CMake wrapper for jsoncpp injection) - replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "jsoncpp.cpp", "") + rmdir(self, os.path.join(self.source_folder, "src", "json")) + replace_in_file( + self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "jsoncpp.cpp", + "", + ) + replace_in_file( + self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS})", + """ + find_package(jsoncpp) + target_link_libraries(${LIBNAME} JsonCpp::JsonCpp ${EXTRA_LIBS} ${CMAKE_DL_LIBS}) + """, + ) def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_UNIVERSAL"] = "OFF" + tc.variables["BUILD_SHARED"] = self.options.shared tc.variables["USE_LIBCXX"] = "OFF" tc.generate() deps = CMakeDeps(self) @@ -45,9 +64,17 @@ class OpenvrConan(ConanFile): copy(self, "LICENSE", src=self.source_folder, dst="licenses") cmake = CMake(self) cmake.install() - copy(self, pattern="openvr_api*.dll", dst="bin", src=os.path.join(self.source_folder, "bin"), keep_path=False) + copy( + self, + pattern="*.dll", + dst="bin", + src=os.path.join(self.build_folder, "bin", "win64"), + keep_path=False, + ) def package_info(self): + if not self.options.shared: + self.cpp_info.defines = ["OPENVR_BUILD_STATIC"] self.cpp_info.names["pkg_config"] = "openvr" self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs.append(os.path.join("include", "openvr")) diff --git a/conanfile.py b/conanfile.py index e0d42b68c3..95f20a7d2d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -54,7 +54,7 @@ class Overte(ConanFile): self.requires("nvidia-texture-tools/2023.01@overte/stable") self.requires("openexr/3.1.9") self.requires("openssl/1.1.1w") - self.requires("openvr/1.26.7@overte/stable") + self.requires("openvr/2.2.3@overte/stable") self.requires("opus/1.4") self.requires("polyvox/0.2.1@overte/stable") self.requires("quazip/1.4@overte/stable") diff --git a/plugins/openvr/src/ViveControllerManager.h b/plugins/openvr/src/ViveControllerManager.h index 1615c5c24e..95cc457ebb 100644 --- a/plugins/openvr/src/ViveControllerManager.h +++ b/plugins/openvr/src/ViveControllerManager.h @@ -26,7 +26,7 @@ #include "OpenVrHelpers.h" #ifdef Q_OS_WIN -#define VIVE_PRO_EYE +// #define VIVE_PRO_EYE #endif using PuckPosePair = std::pair;