-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconanfile.py
More file actions
48 lines (38 loc) · 1.23 KB
/
conanfile.py
File metadata and controls
48 lines (38 loc) · 1.23 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
from conans import ConanFile, CMake
class LogppConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "fmt/8.1.1", "tomlplusplus/2.3.0"
generators = "cmake"
options = {
"build_tests": [True, False],
"build_benches": [True, False],
"shared": [True, False]
}
default_options = {
"build_tests": False,
"build_benches": False,
"shared": False
}
exports_sources = "*"
_cmake = False
def requirements(self):
if self.options.build_tests:
self.requires("gtest/1.10.0")
if self.options.build_benches:
self.requires("benchmark/1.5.2")
def build(self):
cmake = self._configure_cmake()
cmake.build()
if self.options.build_tests:
cmake.test()
def package(self):
cmake = self._configure_cmake()
cmake.install()
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["LOGPP_BUILD_TESTS"] = self.options.build_tests
self._cmake.definitions["LOGPP_BUILD_BENCHES"] = self.options.build_benches
self._cmake.configure()
return self._cmake