Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openvr: add 1.16.8 + fix cpp_info.includedirs + propagate libcxx for C API #5184

Merged
merged 8 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions recipes/openvr/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ sources:
"1.14.15":
url: https://github.com/ValveSoftware/openvr/archive/v1.14.15.tar.gz
sha256: 40644e569f057e86c733d818a22d821c640307e5058d95958414422134d79584
"1.16.8":
url: https://github.com/ValveSoftware/openvr/archive/refs/tags/v1.16.8.tar.gz
sha256: 387c98c0540f66595c4594e5f3340a1095dd90e954ff14fd5d89cc849ba32d1b
patches:
"1.16.8":
- patch_file: "patches/fix-includes-and-assert-1.16.8.patch"
base_path: "source_subfolder"
21 changes: 15 additions & 6 deletions recipes/openvr/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class OpenvrConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/ValveSoftware/openvr"
license = "BSD-3-Clause"
exports_sources = ["CMakeLists.txt"]
generators = "cmake"

settings = "os", "compiler", "build_type", "arch"
options = {
Expand All @@ -22,17 +20,21 @@ class OpenvrConan(ConanFile):
"fPIC": True,
}

exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake"
_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

def config_options(self):
if self.settings.os == "Windows" or self.options.shared:
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, "11")

Expand All @@ -57,6 +59,8 @@ def _configure_cmake(self):
return self._cmake

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()

Expand All @@ -68,13 +72,18 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.names["pkg_config"] = "openvr"
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.includedirs.append(os.path.join("include", "openvr"))

if not self.options.shared:
self.cpp_info.defines.append('OPENVR_BUILD_STATIC')
self.cpp_info.defines.append("OPENVR_BUILD_STATIC")
libcxx = tools.stdcpp_library(self)
if libcxx:
self.cpp_info.system_libs.append(libcxx)

if self.settings.os != "Windows":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("dl")

if self.settings.os == "Macos":
if tools.is_apple_os(self.settings.os):
self.cpp_info.frameworks.append("Foundation")
122 changes: 122 additions & 0 deletions recipes/openvr/all/patches/fix-includes-and-assert-1.16.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
Fix compilaton errors due to wrong headers folder and usage of missing assert.h:
https://github.com/ValveSoftware/openvr/pull/1524
https://github.com/ValveSoftware/openvr/pull/1542

--- a/src/openvr_api_public.cpp
+++ b/src/openvr_api_public.cpp
@@ -2,12 +2,12 @@
#define VR_API_EXPORT 1
#include "openvr.h"
#include "ivrclientcore.h"
-#include <vrcore/pathtools_public.h>
-#include <vrcore/sharedlibtools_public.h>
-#include <vrcore/envvartools_public.h>
+#include <vrcommon/pathtools_public.h>
+#include <vrcommon/sharedlibtools_public.h>
+#include <vrcommon/envvartools_public.h>
#include "hmderrors_public.h"
-#include <vrcore/strtools_public.h>
-#include <vrcore/vrpathregistry_public.h>
+#include <vrcommon/strtools_public.h>
+#include <vrcommon/vrpathregistry_public.h>
#include <mutex>

using vr::EVRInitError;
--- a/src/vrcommon/dirtools_public.cpp
+++ b/src/vrcommon/dirtools_public.cpp
@@ -1,7 +1,7 @@
//========= Copyright Valve Corporation ============//
-#include <vrcore/dirtools_public.h>
-#include <vrcore/strtools_public.h>
-#include <vrcore/pathtools_public.h>
+#include <vrcommon/dirtools_public.h>
+#include <vrcommon/strtools_public.h>
+#include <vrcommon/pathtools_public.h>

#include <errno.h>
#include <string.h>
--- a/src/vrcommon/envvartools_public.cpp
+++ b/src/vrcommon/envvartools_public.cpp
@@ -1,6 +1,6 @@
//========= Copyright Valve Corporation ============//
-#include <vrcore/envvartools_public.h>
-#include <vrcore/strtools_public.h>
+#include <vrcommon/envvartools_public.h>
+#include <vrcommon/strtools_public.h>
#include <stdlib.h>
#include <string>
#include <cctype>
--- a/src/vrcommon/pathtools_public.cpp
+++ b/src/vrcommon/pathtools_public.cpp
@@ -1,6 +1,6 @@
//========= Copyright Valve Corporation ============//
-#include <vrcore/strtools_public.h>
-#include <vrcore/pathtools_public.h>
+#include <vrcommon/strtools_public.h>
+#include <vrcommon/pathtools_public.h>

#if defined( _WIN32)
#include <windows.h>
--- a/src/vrcommon/sharedlibtools_public.cpp
+++ b/src/vrcommon/sharedlibtools_public.cpp
@@ -1,5 +1,5 @@
//========= Copyright Valve Corporation ============//
-#include <vrcore/sharedlibtools_public.h>
+#include <vrcommon/sharedlibtools_public.h>
#include <string.h>

#if defined(_WIN32)
--- a/src/vrcommon/strtools_public.cpp
+++ b/src/vrcommon/strtools_public.cpp
@@ -1,6 +1,7 @@
//========= Copyright Valve Corporation ============//
-#include <vrcore/strtools_public.h>
+#include <vrcommon/strtools_public.h>
#include <string.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
@@ -9,7 +10,6 @@
#include <functional>
#include <locale>
#include <codecvt>
-#include <vrcore/assert.h>

#if defined( _WIN32 )
#include <windows.h>
@@ -128,7 +128,6 @@ std::string Format( const char *pchFormat, ... )
// Something went fairly wrong
if ( unSize < 0 )
{
- AssertMsg( false, "Format string parse failure" );
return "";
}

@@ -149,7 +148,6 @@ std::string Format( const char *pchFormat, ... )
// Double check, just in case
if ( unSize < 0 )
{
- AssertMsg( false, "Format string parse failure" );
return "";
}

--- a/src/vrcommon/vrpathregistry_public.cpp
+++ b/src/vrcommon/vrpathregistry_public.cpp
@@ -1,11 +1,11 @@
//========= Copyright Valve Corporation ============//

-#include <vrcore/vrpathregistry_public.h>
+#include <vrcommon/vrpathregistry_public.h>
#include <json/json.h>
-#include <vrcore/pathtools_public.h>
-#include <vrcore/envvartools_public.h>
-#include <vrcore/strtools_public.h>
-#include <vrcore/dirtools_public.h>
+#include <vrcommon/pathtools_public.h>
+#include <vrcommon/envvartools_public.h>
+#include <vrcommon/strtools_public.h>
+#include <vrcommon/dirtools_public.h>

#if defined( WIN32 )
#include <windows.h>
3 changes: 2 additions & 1 deletion recipes/openvr/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <openvr.h>

#include <cstdlib>
#include <openvr/openvr.h>

int main()
{
Expand Down
2 changes: 2 additions & 0 deletions recipes/openvr/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ versions:
folder: "all"
"1.14.15":
folder: "all"
"1.16.8":
folder: "all"