Skip to content

Commit

Permalink
openvr: fix shared install on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Dec 7, 2023
1 parent 3025844 commit 9f7e630
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions recipes/openvr/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd, stdcpp_library
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, save
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, \
save, mkdir
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"
Expand Down Expand Up @@ -90,19 +91,25 @@ def build(self):
cmake.configure()
cmake.build()

@property
def _lib_name(self):
if self.settings.os == "Windows" and self.settings.arch == "x86_64":
return "openvr_api64"
return "openvr_api"

def package(self):
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
copy(self, "openvr_api*.dll",
dst=os.path.join(self.package_folder, "bin"),
src=self.build_folder,
keep_path=False)
if self.settings.os == "Windows" and self.options.shared:
mkdir(self, os.path.join(self.package_folder, "bin"))
os.rename(os.path.join(self.package_folder, "lib", f"{self._lib_name}.dll"),
os.path.join(self.package_folder, "bin", f"{self._lib_name}.dll"))
rmdir(self, os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.set_property("pkg_config_name", "openvr")
self.cpp_info.libs = collect_libs(self)
self.cpp_info.libs = [self._lib_name]
self.cpp_info.includedirs.append(os.path.join("include", "openvr"))

if not self.options.shared:
Expand Down

0 comments on commit 9f7e630

Please sign in to comment.