From 3b7c00648ea37131485830946d4ee90a5fec15ca Mon Sep 17 00:00:00 2001 From: Edgar Date: Wed, 24 Jan 2024 13:22:24 +0100 Subject: [PATCH] :package: Added OVR Conan package --- conan-recipes/ovr-platform-skd/CMakeLists.txt | 16 +++++++ conan-recipes/ovr-platform-skd/conanfile.py | 37 +++++++++++++++ conan-recipes/ovr-skd/CMakeLists.txt | 16 +++++++ conan-recipes/ovr-skd/conanfile.py | 46 +++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 conan-recipes/ovr-platform-skd/CMakeLists.txt create mode 100644 conan-recipes/ovr-platform-skd/conanfile.py create mode 100644 conan-recipes/ovr-skd/CMakeLists.txt create mode 100644 conan-recipes/ovr-skd/conanfile.py diff --git a/conan-recipes/ovr-platform-skd/CMakeLists.txt b/conan-recipes/ovr-platform-skd/CMakeLists.txt new file mode 100644 index 0000000000..3c8c61e36b --- /dev/null +++ b/conan-recipes/ovr-platform-skd/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.20) +project(LibOVR) + +message(STATUS "Building LibOVR for ${CMAKE_BUILD_TYPE} configuration") + +include_directories(LibOVR/Include LibOVR/Src) +file(GLOB HEADER_FILES LibOVR/Include/*.h) +file(GLOB EXTRA_HEADER_FILES LibOVR/Include/Extras/*.h) +file(GLOB_RECURSE SOURCE_FILES LibOVR/Shim/*.c LibOVR/Shim/*.cpp) +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOVR_BUILD_DEBUG") +add_library(LibOVR STATIC ${SOURCE_FILES} ${HEADER_FILES} ${EXTRA_HEADER_FILES}) +set_target_properties(LibOVR PROPERTIES DEBUG_POSTFIX "d") + +install(TARGETS LibOVR DESTINATION lib) +install(FILES ${HEADER_FILES} DESTINATION include) +install(FILES ${EXTRA_HEADER_FILES} DESTINATION include/extras) \ No newline at end of file diff --git a/conan-recipes/ovr-platform-skd/conanfile.py b/conan-recipes/ovr-platform-skd/conanfile.py new file mode 100644 index 0000000000..498e222f6b --- /dev/null +++ b/conan-recipes/ovr-platform-skd/conanfile.py @@ -0,0 +1,37 @@ +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +import os + + +class OVRPlatformConan(ConanFile): + name = "ovr-platform-skd" + version = "1.10.0" + author = "Edgar (Edgar@AnotherFoxGuy.com)" + settings = "os", "arch" + + def build(self): + get( + self, + url="https://build-deps.overte.org/dependencies/OVRPlatformSDK_v1.10.0.zip", + sha256="4d0ecc491e4ddfc88056b674deef5a0a9a023d2f03b89e5ec6c1415863d200b2", + ) + + def package(self): + copy( + self, + "*.h", + os.path.join(self.source_folder, "Include"), + os.path.join(self.package_folder, "include"), + ) + copy( + self, + "LibOVRPlatform64_1.lib", + os.path.join(self.source_folder, "Windows"), + os.path.join(self.package_folder, "lib"), + keep_path=False, + ) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "OVRPlatform") + self.cpp_info.set_property("cmake_target_name", "OVR::Platform") + self.cpp_info.libs = collect_libs(self) diff --git a/conan-recipes/ovr-skd/CMakeLists.txt b/conan-recipes/ovr-skd/CMakeLists.txt new file mode 100644 index 0000000000..3c8c61e36b --- /dev/null +++ b/conan-recipes/ovr-skd/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.20) +project(LibOVR) + +message(STATUS "Building LibOVR for ${CMAKE_BUILD_TYPE} configuration") + +include_directories(LibOVR/Include LibOVR/Src) +file(GLOB HEADER_FILES LibOVR/Include/*.h) +file(GLOB EXTRA_HEADER_FILES LibOVR/Include/Extras/*.h) +file(GLOB_RECURSE SOURCE_FILES LibOVR/Shim/*.c LibOVR/Shim/*.cpp) +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOVR_BUILD_DEBUG") +add_library(LibOVR STATIC ${SOURCE_FILES} ${HEADER_FILES} ${EXTRA_HEADER_FILES}) +set_target_properties(LibOVR PROPERTIES DEBUG_POSTFIX "d") + +install(TARGETS LibOVR DESTINATION lib) +install(FILES ${HEADER_FILES} DESTINATION include) +install(FILES ${EXTRA_HEADER_FILES} DESTINATION include/extras) \ No newline at end of file diff --git a/conan-recipes/ovr-skd/conanfile.py b/conan-recipes/ovr-skd/conanfile.py new file mode 100644 index 0000000000..a355967814 --- /dev/null +++ b/conan-recipes/ovr-skd/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps +import os + + +class OVRConan(ConanFile): + name = "ovr-skd" + version = "1.35.0" + author = "Edgar (Edgar@AnotherFoxGuy.com)" + settings = "os", "compiler", "build_type", "arch" + exports_sources = "CMakeLists.txt" + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + strip_root = False + if self.settings.os == "Windows": + url = "https://build-deps.overte.org/dependencies/ovr_sdk_win_1.35.0.zip" + sha256 = "2805619518a0a083f3eca0358ab7f4114d7d94b4abb2b65ced7e95f287df28a2" + elif self.settings.os == "Macos": + url = "https://build-deps.overte.org/dependencies/ovr_sdk_macos_0.5.0.1.tar.gz" + sha256 = "58636983f970467afd18594899c22e70aae923023cd282b913c7c76ae46a8a12" + else: + url = "https://github.com/jherico/OculusSDK/archive/0d6f0cf110ea7566fc6d64b8d4fe6bb881d9cff5.zip" + sha256 = "971e9f6ac8469913bd20445ba03a79e6654eaf71701823aa9fb5cec7c8e51ea6" + strip_root = True + get(self, url=url, sha256=sha256, strip_root=strip_root) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "OVR") + self.cpp_info.set_property("cmake_target_name", "OVR::SDK") + self.cpp_info.libs = collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("rt", "udev")