Files
ligo/conanfile.py
T
khodowany 67429eacd1
publish / publish (push) Successful in 31m41s
Initial public khodo snapshot
2026-09-04 19:30:11 -05:00

108 lines
2.4 KiB
Python

import conan
import conan.tools.build
import conan.tools.cmake
class ligo_conan(conan.ConanFile):
name = "ligo"
version = "latest"
description = "C++23 networking and transport 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/ligo/*.hpp",
"include/ligo/detail/*.hpp",
"src/*.cpp",
"src/detail/*.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 (
"sqlite3",
"raylib",
"glfw",
"opengl",
"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",
"ligo",
)
self.cpp_info.set_property(
"cmake_target_name",
"ligo::ligo",
)
self.cpp_info.libs = ["ligo"]
self.cpp_info.requires = [
"modulus::modulus",
"modulus::boost_json",
"modulus::openssl",
]