-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
67 lines (60 loc) · 2.05 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
from conans import ConanFile, CMake, tools
import os
class MicrolithCppConan(ConanFile):
name = "microlith"
version = "0.0.5"
description = "C++ subscription-based DI framework"
url = "https://github.com/dragozir/microlith"
license = "MIT"
author = "Jake F Hyde ([email protected])"
settings = "os", "compiler", "build_type", "arch"
options = {
'build_type': ['Debug', 'Release'],
'shared': [True, False],
'fPIC': [True, False],
'log': [True, False],
'embed_ctti': [True, False],
}
default_options = {
'build_type': 'Release',
'shared': True,
'fPIC': True,
'log': True,
'embed_ctti': False
}
build_requires = (
"cmake/3.19.7",
"ninja/1.10.2",
"gtest/1.10.0"
)
exports_sources = "cmake/*", "CMakeLists.txt", "include/*", "src/*", "test/*", "3rdparty/*"
generators = "cmake", "cmake_find_package", "cmake_paths"
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions['MICROLITH_VERSION'] = self.version
cmake.definitions['BUILD_SYSTEM'] = 'CONAN'
if not self.options.log:
cmake.definitions['MICROLITH_NO_SPDLOG'] = 'ON'
if self.options.embed_ctti:
if os.listdir('3rdparty/ctti') == []:
git = tools.Git()
git.run("submodule update --init")
cmake.definitions['MICROLITH_EMBED_CTTI'] = 'ON'
cmake.configure()
return cmake
def requirements(self):
if self.options.log:
self.requires("spdlog/1.8.2")
if not self.options.embed_ctti:
self.requires("ctti/[>=0.0.1]")
def build(self):
cmake = self._configure_cmake()
cmake.build()
cmake.test()
def package(self):
cmake = self._configure_cmake()
cmake.install()
if self.options.embed_ctti:
self.copy('*.hpp', dst='include/', src='3rdparty/ctti/include')
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)