Skip to content

Commit

Permalink
(conan-io#5184) openvr: add 1.16.8 + fix cpp_info.includedirs + propa…
Browse files Browse the repository at this point in the history
…gate libcxx for C API

* delete fPIC if shared in configure()

* explicit pkg_config name

* fix cpp_info.includedirs

* consistent quotes

* propagate libcxx if static for C API

* dl system libs on Linux and FreeBSD only

* add Foundation framework for all Apple OS

* add 1.16.8
  • Loading branch information
SpaceIm authored and AlvaroFS committed May 7, 2021
1 parent 23f535f commit 66a1204
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 7 deletions.
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"

0 comments on commit 66a1204

Please sign in to comment.