This commit is contained in:
+104
@@ -0,0 +1,104 @@
|
||||
import conan
|
||||
import conan.tools.build
|
||||
import conan.tools.cmake
|
||||
|
||||
class luma_conan(conan.ConanFile):
|
||||
name = "luma"
|
||||
version = "latest"
|
||||
description = "C++23 embedded touch UI library"
|
||||
license = "MIT"
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [
|
||||
True,
|
||||
False,
|
||||
],
|
||||
"fPIC": [
|
||||
True,
|
||||
False,
|
||||
],
|
||||
"with_tests": [
|
||||
True,
|
||||
False,
|
||||
],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"with_tests": False,
|
||||
}
|
||||
exports = "modulus.json"
|
||||
exports_sources = (
|
||||
"CMakeLists.txt",
|
||||
"cmake/*.in",
|
||||
"include/*.hpp",
|
||||
"include/luma/*.hpp",
|
||||
"include/luma/detail/*.hpp",
|
||||
"src/*.cpp",
|
||||
"tests/CMakeLists.txt",
|
||||
"tests/*.cpp",
|
||||
"tests/*.hpp",
|
||||
)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
del self.options.fPIC
|
||||
|
||||
def requirements(self):
|
||||
self.requires(
|
||||
"modulus/latest",
|
||||
transitive_headers=True,
|
||||
transitive_libs=True,
|
||||
)
|
||||
|
||||
def generate(self):
|
||||
deps = conan.tools.cmake.CMakeDeps(self)
|
||||
deps.generate()
|
||||
toolchain = conan.tools.cmake.CMakeToolchain(self)
|
||||
if hasattr(toolchain, "user_presets_path"):
|
||||
toolchain.user_presets_path = False
|
||||
toolchain.variables["BUILD_SHARED_LIBS"] = bool(self.options.shared)
|
||||
toolchain.variables["BUILD_TESTING"] = bool(self.options.with_tests)
|
||||
toolchain.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = conan.tools.cmake.CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
if self.options.with_tests and conan.tools.build.can_run(self):
|
||||
cmake.test(target="check")
|
||||
|
||||
def package_id(self):
|
||||
self.info.options.rm_safe("with_tests")
|
||||
for requirement in (
|
||||
"openssl",
|
||||
"sqlite3",
|
||||
"miniaudio",
|
||||
):
|
||||
if requirement in self.info.requires.pkg_names:
|
||||
self.info.requires.remove(requirement)
|
||||
|
||||
def package(self):
|
||||
cmake = conan.tools.cmake.CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property(
|
||||
"cmake_file_name",
|
||||
"luma",
|
||||
)
|
||||
self.cpp_info.set_property(
|
||||
"cmake_target_name",
|
||||
"luma::luma",
|
||||
)
|
||||
self.cpp_info.libs = ["luma"]
|
||||
self.cpp_info.requires = [
|
||||
"modulus::modulus",
|
||||
"modulus::boost_json",
|
||||
"modulus::raylib",
|
||||
]
|
||||
Reference in New Issue
Block a user