Skip to content
Snippets Groups Projects
Commit 47acdfd8 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

WIP: Migrate to Conan 2 (issue #73)

parent d1e6250c
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!49Resolve "EXTERN: Adapt to Conan 2"
Pipeline #51714 failed
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain
from conan.tools.files import copy
from conan.errors import ConanInvalidConfiguration
class CaosdbConan(ConanFile):
......@@ -20,48 +23,61 @@ class CaosdbConan(ConanFile):
"fPIC": True,
"build_acm": False,
}
generators = "cmake"
requires = [
("grpc/1.48.0"),
]
build_requires = [
("boost/1.78.0"),
("gtest/1.11.0"),
]
exports = ("*.cmake", "*CMakeLists.txt", "*.in",
"*.h", "*.proto", "*.c", "*.cpp",
"*.rst", "*.md",
)
)
exports_sources = "src", "doc", "include", "test", "cmake", "proto"
def build_requirements(self):
self.tool_requires("protobuf/3.21.12")
self.tool_requires("cmake/[>=3.13]")
self.tool_requires("boost/1.78.0")
self.test_requires("gtest/1.11.0")
self.requires("grpc/1.48.4")
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
self.options.rm_safe("fPIC")
self.options["boost"].without_python = True
self.options["boost"].filesystem_version = "3"
# def source(self):
# self.run("git clone https://gitlab.indiscale.com/caosdb/src/caosdb-cpplib.git")
# self.run("cd caosdb-cpplib && git submodule update --init")
def generate(self):
tc = CMakeToolchain(self)
# This writes the "conan_toolchain.cmake"
tc.generate()
cmake = CMakeDeps(self)
cmake.generate()
copy(self, pattern="protoc*", dst="build_tools", src="bin")
copy(self, pattern="grpc_cpp_plugin*", dst="build_tools", src="bin")
def imports(self):
self.copy("protoc*", "build_tools", "bin")
self.copy("grpc_cpp_plugin*", "build_tools", "bin")
def layout(self):
cmake_layout(self, src_folder=".")
def build(self):
cmake = CMake(self)
if self.options.build_acm:
cmake.definitions["BUILD_ACM"] = "On"
cmake.configure(source_folder="")
cmake.configure()
cmake.build()
def package(self):
self.copy("*.h", dst="include", src="include")
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
cmake = CMake(self)
cmake.install()
copy(self, pattern="*.h", dst="include", src="include")
copy(self, pattern="*.dll", dst="bin", keep_path=False)
copy(self, pattern="*.so", dst="lib", keep_path=False)
copy(self, pattern="*.dylib", dst="lib", keep_path=False)
copy(self, pattern="*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["caosdb", "ccaosdb"]
def validate(self):
if self.settings.os not in ("Linux", "Windows"):
raise ConanInvalidConfiguration(f"{self.settings.os} is currently not supported")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment