-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconanfile.py
55 lines (45 loc) · 1.36 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
from conans import ConanFile, CMake
class UsbAsio(ConanFile):
name = "usb_asio"
version = "0.1.0"
revision_mode = "scm"
generators = "cmake"
exports_sources = (
"include/*",
)
options = {
"asio": ["boost", "standalone"],
"examples": [True, False],
}
default_options = {
"asio": "boost",
"examples": False,
}
requires = (
"libusb/1.0.23",
)
def imports(self):
with open("version.txt", "w") as version_file:
version_file.write(str(self.version))
def requirements(self):
if self.options.asio == "boost":
self.requires("boost/1.74.0")
else:
self.requires("asio/1.17.0")
if self.options.examples:
self.requires("fmt/7.0.1")
def build(self):
if self.options.examples:
cmake = CMake(self)
cmake.definitions["USB_ASIO_USE_STANDALONE_ASIO"] \
= self.options.asio == "standalone"
cmake.configure()
cmake.build()
def package(self):
self.copy("*.hpp", dst="include", src="include")
def package_id(self):
del self.info.options.examples
self.info.header_only()
def package_info(self):
if self.options.asio == "standalone":
self.cpp_info.defines = ["USB_ASIO_USE_STANDALONE_ASIO"]