-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
116 lines (91 loc) · 3.61 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
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
114
115
116
# Copyright (c) 2016-2024 Knuth Project developers.
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import os
from conan import ConanFile
from conan.tools.build.cppstd import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy
from kthbuild import KnuthConanFileV2, option_on_off
required_conan_version = ">=2.0"
class KnuthNetworkConan(KnuthConanFileV2):
name = "network"
license = "http://www.boost.org/users/license.html"
url = "https://github.com/k-nuth/network"
description = "Crypto P2P Network Library"
settings = "os", "compiler", "build_type", "arch"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
"tests": [True, False],
"currency": ['BCH', 'BTC', 'LTC'],
"march_id": ["ANY"],
"march_strategy": ["download_if_possible", "optimized", "download_or_fail"],
"verbose": [True, False],
"cxxflags": ["ANY"],
"cflags": ["ANY"],
"cmake_export_compile_commands": [True, False],
"log": ["boost", "spdlog", "binlog"]
}
default_options = {
"shared": False,
"fPIC": True,
"tests": False,
"currency": "BCH",
"march_strategy": "download_if_possible",
"verbose": False,
"cmake_export_compile_commands": False,
"log": "spdlog",
}
exports_sources = "src/*", "CMakeLists.txt", "ci_utils/cmake/*", "cmake/*", "knuthbuildinfo.cmake", "include/*", "test/*"
def build_requirements(self):
if self.options.tests:
self.test_requires("catch2/3.6.0")
def requirements(self):
self.requires("domain/0.42.0", transitive_headers=True, transitive_libs=True)
def validate(self):
KnuthConanFileV2.validate(self)
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, "23")
def config_options(self):
KnuthConanFileV2.config_options(self)
def configure(self):
KnuthConanFileV2.configure(self)
#TODO(fernando): move to kthbuild
self.options["*"].log = self.options.log
self.output.info("Compiling with log: %s" % (self.options.log,))
def package_id(self):
KnuthConanFileV2.package_id(self)
def layout(self):
cmake_layout(self)
def generate(self):
tc = self.cmake_toolchain_basis()
# tc.variables["CMAKE_VERBOSE_MAKEFILE"] = True
#TODO(fernando): move to kthbuild
tc.variables["LOG_LIBRARY"] = self.options.log
tc.variables["CONAN_DISABLE_CHECK_COMPILER"] = option_on_off(True)
tc.generate()
tc = CMakeDeps(self)
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
if not self.options.cmake_export_compile_commands:
cmake.build()
if self.options.tests:
cmake.test()
def imports(self):
self.copy("*.h", "", "include")
def package(self):
cmake = CMake(self)
cmake.install()
# rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
# rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
# rmdir(self, os.path.join(self.package_folder, "res"))
# rmdir(self, os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.includedirs = ['include']
self.cpp_info.libs = ["network"]
if self.settings.arch == "armv7":
self.cpp_info.system_libs.append("atomic")