Repository navigation
Expand file tree
/
Copy pathconanfile.py
More file actions
160 lines (134 loc) · 6.7 KB
/
Copy pathconanfile.py
File metadata and controls
160 lines (134 loc) · 6.7 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
from os.path import join
from conan import ConanFile
from conan.tools.files import copy
from conan.tools.build import check_min_cppstd
from conans import CMake
required_conan_version = ">=1.50.0"
class SISLConan(ConanFile):
name = "sisl"
version = "9.0.1"
homepage = "https://github.com/eBay/sisl"
description = "Library for fast data structures, utilities"
topics = ("ebay", "components", "core", "efficiency")
url = "https://github.com/eBay/sisl"
license = "Apache-2.0"
settings = "arch", "os", "compiler", "build_type"
options = {
"shared": ['True', 'False'],
"fPIC": ['True', 'False'],
"coverage": ['True', 'False'],
"sanitize": ['True', 'False'],
'prerelease' : ['True', 'False'],
'malloc_impl' : ['libc', 'tcmalloc', 'jemalloc'],
}
default_options = {
'shared': False,
'fPIC': True,
'coverage': False,
'sanitize': False,
'prerelease': True,
'malloc_impl': 'tcmalloc',
}
generators = "cmake", "cmake_find_package"
exports_sources = ("CMakeLists.txt", "cmake/*", "include/*", "src/*", "LICENSE")
def build_requirements(self):
self.build_requires("benchmark/1.7.1")
self.build_requires("gtest/1.13.0")
def requirements(self):
# Custom packages
if self.options.prerelease:
self.requires("prerelease_dummy/1.0.1")
# Memory allocation
if self.options.malloc_impl == "tcmalloc":
self.requires("gperftools/2.7.0")
elif self.options.malloc_impl == "jemalloc":
self.requires("jemalloc/5.2.1")
# Linux Specific Support
if self.settings.os in ["Linux"]:
self.requires("folly/2022.01.31.00")
self.requires("userspace-rcu/0.11.4")
# Generic packages (conan-center)
self.requires("boost/1.79.0")
self.requires("cpr/1.9.3")
self.requires("cxxopts/2.2.1")
self.requires("flatbuffers/1.12.0")
self.requires("grpc/1.48.0")
self.requires("jwt-cpp/0.4.0")
self.requires("nlohmann_json/3.11.2")
self.requires("prometheus-cpp/1.1.0")
self.requires("spdlog/1.11.0")
self.requires("zmarok-semver/1.1.0")
if self.settings.compiler in ["gcc"]:
self.requires("pistache/0.0.5")
self.requires("fmt/8.1.1", override=True)
self.requires("libcurl/7.86.0", override=True)
self.requires("libevent/2.1.12", override=True)
self.requires("openssl/1.1.1q", override=True)
self.requires("xz_utils/5.2.5", override=True)
self.requires("zlib/1.2.12", override=True)
def validate(self):
if self.info.settings.compiler.cppstd:
check_min_cppstd(self, 20)
def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.build_type == "Debug":
if self.options.coverage and self.options.sanitize:
raise ConanInvalidConfiguration("Sanitizer does not work with Code Coverage!")
if self.options.coverage or self.options.sanitize:
self.options.malloc_impl = 'libc'
def build(self):
cmake = CMake(self)
definitions = {'CONAN_BUILD_COVERAGE': 'OFF',
'CMAKE_EXPORT_COMPILE_COMMANDS': 'ON',
'MEMORY_SANITIZER_ON': 'OFF',
'MALLOC_IMPL': self.options.malloc_impl}
test_target = None
if self.settings.build_type == "Debug":
if self.options.sanitize:
definitions['MEMORY_SANITIZER_ON'] = 'ON'
elif self.options.coverage:
definitions['CONAN_BUILD_COVERAGE'] = 'ON'
test_target = 'coverage'
definitions['MALLOC_IMPL'] = self.options.malloc_impl
cmake.configure(defs=definitions)
cmake.build()
cmake.test(target=test_target, output_on_failure=True)
def package(self):
lib_dir = join(self.package_folder, "lib")
copy(self, "LICENSE", self.source_folder, join(self.package_folder, "licenses"), keep_path=False)
copy(self, "*.lib", self.build_folder, lib_dir, keep_path=False)
copy(self, "*.a", self.build_folder, lib_dir, keep_path=False)
copy(self, "*.so*", self.build_folder, lib_dir, keep_path=False)
copy(self, "*.dylib*", self.build_folder, lib_dir, keep_path=False)
copy(self, "*.dll*", self.build_folder, join(self.package_folder, "bin"), keep_path=False)
copy(self, "*.so*", self.build_folder, lib_dir, keep_path=False)
copy(self, "*.proto", join(self.source_folder, "src", "flip", "proto"), join(self.package_folder, "proto", "flip"), keep_path=False)
copy(self, "*", join(self.source_folder, "src", "flip", "client", "python"), join(self.package_folder, "bindings", "flip", "python"), keep_path=False)
copy(self, "*.h*", join(self.source_folder, "include"), join(self.package_folder, "include"), keep_path=True)
gen_dir = join(self.package_folder, "include", "sisl")
copy(self, "*.pb.h", join(self.build_folder, "src"), gen_dir, keep_path=True)
copy(self, "*security_config_generated.h", join(self.build_folder, "src"), gen_dir, keep_path=True)
copy(self, "settings_gen.cmake", join(self.source_folder, "cmake"), join(self.package_folder, "cmake"), keep_path=False)
def package_info(self):
self.cpp_info.libs = ["sisl"]
if self.settings.compiler == "gcc":
self.cpp_info.cppflags.extend(["-fconcepts"])
if self.settings.os == "Linux":
self.cpp_info.libs.append("flip")
self.cpp_info.cppflags.append("-D_POSIX_C_SOURCE=200809L")
self.cpp_info.cppflags.append("-D_FILE_OFFSET_BITS=64")
self.cpp_info.cppflags.append("-D_LARGEFILE64")
self.cpp_info.system_libs.extend(["dl", "pthread"])
self.cpp_info.exelinkflags.extend(["-export-dynamic"])
if self.options.sanitize:
self.cpp_info.sharedlinkflags.append("-fsanitize=address")
self.cpp_info.exelinkflags.append("-fsanitize=address")
self.cpp_info.sharedlinkflags.append("-fsanitize=undefined")
self.cpp_info.exelinkflags.append("-fsanitize=undefined")
if self.options.malloc_impl == 'jemalloc':
self.cpp_info.cppflags.append("-DUSE_JEMALLOC=1")
elif self.options.malloc_impl == 'tcmalloc':
self.cpp_info.cppflags.append("-DUSING_TCMALLOC=1")
self.cpp_info.libdirs += self.deps_cpp_info["gperftools"].lib_paths
self.cpp_info.libs += ["tcmalloc"]