This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
72 lines (62 loc) · 2.25 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
68
69
70
71
72
from conans import CMake, ConanFile, tools
class FetchppConan(ConanFile):
name = "fetchpp"
version = "dev"
license = "Apache 2.0"
author = "[email protected]"
description = "the simplest http client"
topics = ("http", "beast", "fetch", "client")
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"warn_as_error": [True, False],
"coverage": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"warn_as_error": False,
"coverage": False,
}
generators = "cmake"
exports_sources = "CMakeLists.txt", "libs/*"
cmake = None
@property
def should_build_tests(self):
return self.develop and not tools.cross_building(self.settings)
def requirements(self):
self.requires("libressl/3.2.5")
self.requires("boost/1.78.0-r3")
self.requires("nlohmann_json/3.10.2")
self.requires("skyr-url/1.13.0-r4")
def build_requirements(self):
self.build_requires("catch2/2.13.6-r1")
self.build_requires("fmt/7.1.3")
def init_cmake(self):
if self.cmake:
return
self.cmake = CMake(self)
self.cmake.definitions["WARN_AS_ERROR"] = self.options.warn_as_error
self.cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.fPIC
self.cmake.definitions["BUILD_TESTING"] = self.should_build_tests
self.cmake.definitions["WITH_COVERAGE"] = self.options.coverage
if self.settings.os == "Windows":
# required to build skyr-url on Windows
self.cmake.definitions["CONAN_CMAKE_CXX_STANDARD"] = "20"
def build(self):
self.init_cmake()
if self.should_configure:
self.cmake.configure()
if self.should_build:
self.cmake.build()
if self.should_build_tests and self.should_test:
self.cmake.test()
def package(self):
self.init_cmake()
self.cmake.install()
def package_id(self):
del self.info.options.warn_as_error
def package_info(self):
self.cpp_info.defines.append("BOOST_BEAST_SEPARATE_COMPILATION")
self.cpp_info.libs = ["fetchpp"]