forked from MiSo1289/asiochan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
66 lines (54 loc) · 1.65 KB
/
conanfile.py
File metadata and controls
66 lines (54 loc) · 1.65 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
import re
from conans import CMake, ConanFile, tools
def get_version():
try:
content = tools.load("CMakeLists.txt")
version = re.search("set\\(ASIOCHAN_VERSION (.*)\\)", content).group(1)
return version.strip()
except OSError:
return None
class AsioChan(ConanFile):
name = "asiochan"
version = get_version()
revision_mode = "scm"
description = "C++20 coroutine channels for ASIO"
homepage = "https://github.com/MiSo1289/asiochan"
url = "https://github.com/MiSo1289/asiochan"
license = "MIT"
generators = "cmake"
settings = ("os", "compiler", "arch", "build_type")
exports_sources = (
"examples/*",
"include/*",
"tests/*",
"CMakeLists.txt",
)
build_requires = (
# Unit-test framework
"catch2/2.13.3",
)
options = {
"asio": ["boost", "standalone"]
}
default_options = {
"asio": "boost",
}
def requirements(self):
if self.options.asio == "boost":
self.requires("boost/1.75.0")
else:
self.requires("asio/1.18.1")
def build(self):
cmake = CMake(self)
cmake.definitions["ASIOCHAN_USE_STANDALONE_ASIO"] = self.options.asio == "standalone"
cmake.configure()
cmake.build()
if tools.get_env("CONAN_RUN_TESTS", True):
cmake.test()
def package(self):
self.copy("*.hpp", dst="include", src="include")
def package_id(self):
self.info.header_only()
def package_info(self):
if self.options.asio == "standalone":
self.cpp_info.defines = ["ASIOCHAN_USE_STANDALONE_ASIO"]