🔧 Added support for building ogre3d-caelum with conan v2

This commit is contained in:
2022-10-22 08:59:47 +00:00
parent 9d5ccfa930
commit aa287b29bd
2 changed files with 32 additions and 24 deletions

View File

@ -1,25 +1,40 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.files import get, collect_libs, replace_in_file
from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout
import os
class CaelumConan(ConanFile):
name = "ogre3d-caelum"
license = "GNU Lesser General Public License v2.1"
url = "https://github.com/RigsOfRods/Caelum/issues"
description = "Caelum is a library which provides cross-platform socket abstraction"
description = "Library for rendering of dynamic and realistic skies"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package"
exports_sources = "patches/**"
def layout(self):
cmake_layout(self)
def requirements(self):
for req in self.conan_data["requirements"][self.version]:
self.requires(req)
self.requires("ogre3d/[13.x]@test/test")
self.requires("libpng/1.6.38")
def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True)
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def _patch_sources(self):
replace_in_file(self,
os.path.join(self.source_folder, "main/CMakeLists.txt"),
"OgreMain",
"OGRE::OGRE",
)
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
@ -29,12 +44,15 @@ class CaelumConan(ConanFile):
cmake.install()
def package_info(self):
self.cpp_info.name = "Caelum"
self.cpp_info.set_property("cmake_module_file_name", "Caelum")
self.cpp_info.set_property("cmake_module_target_name", "Caelum::Caelum")
self.cpp_info.set_property("cmake_file_name", "Caelum")
self.cpp_info.set_property("cmake_target_name", "Caelum::Caelum")
self.cpp_info.includedirs = [
'include',
'include/Caelum'
]
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.libs = collect_libs(self)
def package_id(self):
self.info.requires["ogre3d"].full_recipe_mode()