Repository navigation
Expand file tree
/
Copy pathconanfile.py
More file actions
113 lines (100 loc) · 2.58 KB
/
Copy pathconanfile.py
File metadata and controls
113 lines (100 loc) · 2.58 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from conan import ConanFile, tools
from conan.tools.cmake import CMakeToolchain, cmake_layout
from conan.tools.files import copy
import os
BOOST_COMPONENTS = [
"atomic",
"chrono",
"container",
"context",
"contract",
"coroutine",
"date_time",
"exception",
"fiber",
"filesystem",
"graph",
"graph_parallel",
"iostreams",
"json",
"locale",
"log",
"math",
"mpi",
"nowide",
"program_options",
"python",
"random",
"regex",
"serialization",
"stacktrace",
"system",
"test",
"thread",
"timer",
"type_erasure",
"wave",
]
USED_BOOST_COMPONENTS = [
"thread",
# required by libqi
"filesystem",
"locale",
"program_options",
"random",
"regex",
# required by boost.thread
"atomic",
"chrono",
"container",
"date_time",
"exception",
"system",
]
class QiPythonConan(ConanFile):
requires = [
"boost/[~1.83]",
"pybind11/[^2.11]",
"qi/[~4]",
]
test_requires = [
"gtest/[~1.14]",
]
generators = "CMakeDeps"
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
default_options = {
"boost/*:shared": True,
"openssl/*:shared": True,
"qi/*:with_boost_locale": True, # for `pytranslator.cpp`
}
# Disable every components of Boost unless we actively use them.
default_options.update(
{
f"boost/*:without_{_name}": (
False if _name in USED_BOOST_COMPONENTS else True
)
for _name in BOOST_COMPONENTS
}
)
def layout(self):
# Configure the format of the build folder name, based on the value of some variables.
self.folders.build_folder_vars = [
"settings.os",
"settings.arch",
"settings.compiler",
"settings.build_type",
]
# The cmake_layout() sets the folders and cpp attributes to follow the
# structure of a typical CMake project.
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_SKIP_RPATH"] = True
tc.generate()
for dep in self.dependencies.values():
if not dep.package_folder:
continue # skip if the dependency doesn't have a resolved package
copy(self, "*.dll", src=dep.package_folder, dst=self.build_folder)
copy(self, "*.dylib*", src=dep.package_folder, dst=self.build_folder)
copy(self, "*.so*", src=dep.package_folder, dst=self.build_folder)