-
Notifications
You must be signed in to change notification settings - Fork 18
/
conanfile.py
72 lines (61 loc) · 2.55 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from conan import ConanFile
from conan.tools.build import check_min_cppstd, can_run
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.scm import Git
class cpprealmRecipe(ConanFile):
name = "cpprealm"
version = "2.2.0"
# Optional metadata
license = "Apache-2.0"
url = "https://github.com/realm/realm-cpp"
description = "Realm is a mobile database that runs directly inside phones, tablets or wearables."
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}
def is_darwin(self):
return self.settings.os == "Macos" or self.settings.os == "iOS" or self.settings.os == "watchOS"
def validate(self):
check_min_cppstd(self, "17")
def requirements(self):
self.requires(self.tested_reference_str)
if not self.is_darwin() and not self.settings.os == "Emscripten":
self.requires("zlib/1.3")
if not self.is_darwin():
self.requires("openssl/3.2.0")
self.requires("libuv/1.48.0")
def source(self):
git = Git(self)
git.clone(url="https://github.com/realm/realm-cpp", target=".")
git.folder = "."
git.checkout(commit="5ec1bda338dfd0c91ce1eea2ccb2c0adf7d86690")
git.run("submodule update --init --recursive")
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.variables["USES_CONAN"] = "ON"
tc.variables["REALM_CPP_NO_TESTS"] = "ON"
tc.variables["REALM_CORE_SUBMODULE_BUILD"] = "ON"
tc.variables["REALM_USE_SYSTEM_OPENSSL"] = "ON"
if self.settings.os == "Windows":
self.cpp_info.cxxflags = ["/Zc:preprocessor /bigobj"]
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
if self.settings.build_type == "Debug":
self.cpp_info.libs = ["cpprealm-dbg", "realm-object-store-dbg", "realm-parser-dbg", "realm-sync-dbg", "realm-dbg"]
else:
self.cpp_info.libs = ["cpprealm", "realm-object-store", "realm-parser", "realm-sync", "realm"]
if self.is_darwin():
self.cpp_info.frameworks = ["Foundation", "Security", "Compression", "z"]
if self.settings.os == "Windows":
self.cpp_info.system_libs = ["Version"]