-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconanfile.py
More file actions
79 lines (65 loc) · 2.71 KB
/
conanfile.py
File metadata and controls
79 lines (65 loc) · 2.71 KB
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
73
74
75
76
77
78
79
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain
class LibbaseRecipe(ConanFile):
name = "libbase"
settings = "os", "compiler", "build_type", "arch"
options = {
"module_net": [True, False],
"module_win": [True, False],
"module_wx": [True, False],
"examples": [True, False],
"tests": [True, False],
"docs": [True, False],
"with_tidy": [True, False],
"with_asan": [True, False],
"with_tsan": [True, False],
}
default_options = {
"module_net": True,
"module_win": True,
"module_wx": False,
"examples": True,
"tests": True,
"docs": False,
"with_tidy": True,
"with_asan": False,
"with_tsan": False,
}
def config_options(self):
if self.settings.os != "Windows":
del self.options.module_win
def validate(self):
if self.settings.os not in ["Windows", "Linux", "Macos"]:
raise ConanInvalidConfiguration("Unsupported OS")
if self.options.with_asan and self.options.with_tsan:
raise ConanInvalidConfiguration("ASAN and TSAN cannot be used together")
check_min_cppstd(self, "17")
def requirements(self):
self.requires("glog/[~0.7]", transitive_headers=True, transitive_libs=True)
if self.options.module_net:
self.requires("libcurl/[>=8.12 <9.0]")
if self.options.module_wx:
self.requires("wxwidgets/[>=3.2 <4.0]")
if self.options.tests:
self.requires("gtest/[~1.16]")
self.requires("benchmark/[~1.9]")
def layout(self):
cmake_layout(self)
def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.cache_variables["LIBBASE_BUILD_MODULE_NET"] = self.options.module_net
if self.settings.os == "Windows":
tc.cache_variables["LIBBASE_BUILD_MODULE_WIN"] = self.options.module_win
tc.cache_variables["LIBBASE_BUILD_MODULE_WX"] = self.options.module_wx
tc.cache_variables["LIBBASE_BUILD_EXAMPLES"] = self.options.examples
tc.cache_variables["LIBBASE_BUILD_TESTS"] = self.options.tests
tc.cache_variables["LIBBASE_BUILD_PERFORMANCE_TESTS"] = self.options.tests
tc.cache_variables["LIBBASE_BUILD_DOCS"] = self.options.docs
tc.cache_variables["LIBBASE_CLANG_TIDY"] = self.options.with_tidy
tc.cache_variables["LIBBASE_BUILD_ASAN"] = self.options.with_asan
tc.cache_variables["LIBBASE_BUILD_TSAN"] = self.options.with_tsan
tc.generate()