forked from mathworks/llfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
149 lines (110 loc) · 4.52 KB
/
Copy pathconanfile.py
File metadata and controls
149 lines (110 loc) · 4.52 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
#=##=##=#==#=#==#===#+==#+==========+==+=+=+=+=+=++=+++=+++++=-++++=-+++++++++++
#
# Part of the LLFS Project, under Apache License v2.0.
# See https://www.apache.org/licenses/LICENSE-2.0 for license information.
# SPDX short identifier: Apache-2.0
#
import io, os, platform, shlex, subprocess, sys
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
class LlfsConan(ConanFile):
name = "llfs"
#----- --- -- - - - -
# version is set automatically from Git tags - DO NOT SET IT HERE
#----- --- -- - - - -
license = "Apache Public License 2.0"
author = "The MathWorks, Inc."
url = "https://github.com/mathworks/llfs"
description = "Low-Level File System Utilities (C++)"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
}
default_options = {
"shared": False,
}
python_requires = "cor_recipe_utils/0.19.1"
python_requires_extend = "cor_recipe_utils.ConanFileBase"
tool_requires = [
"cmake/[>=3.20.0 <4]",
"ninja/[>=1.12.1 <2]",
]
build_policy = "missing"
exports_sources = [
"CMakeLists.txt",
"src/CMakeLists.txt",
"src/**/*.hpp",
"src/**/*.h",
"src/**/*.ipp",
"src/**/*.cpp",
]
tool_requires = [
"cmake/[>=3.20.0 <4]",
"ninja/[>=1.12.1 <2]",
]
_is_header_only = (platform.system() != "Linux")
package_id_embed_mode = "full_mode"
package_id_non_embed_mode = "full_mode"
package_id_unknown_mode = "full_mode"
#+++++++++++-+-+--+----- --- -- - - - -
def configure(self):
self.options["gtest"].shared = False
self.options["boost"].shared = False
self.options["boost"].without_test = True
self.options["batteries"].with_glog = True
self.options["batteries"].header_only = False
def requirements(self):
VISIBLE = self.cor.VISIBLE
OVERRIDE = self.cor.OVERRIDE
self.requires("batteries/[>=0.71.1 <1]", **VISIBLE)
self.requires("boost/[>=1.88.0 <2]", **VISIBLE)
self.requires("cli11/[>=2.5.0 <3]", **VISIBLE)
self.requires("glog/[>=0.7.1 <1]", **VISIBLE)
self.requires("libbacktrace/[>=cci.20210118]", **VISIBLE)
self.requires("openssl/[>=3.6.0 <4]", **VISIBLE)
self.requires("xxhash/[>=0.8.3 <1]", **VISIBLE)
self.requires("zlib/[>=1.3.1 <2]")
self.test_requires("gtest/[>=1.16.0 <2]")
if platform.system() == "Linux":
self.requires("liburing/[>=2.11 <3]", **VISIBLE)
self.requires("libfuse/[>=3.16.2 <4]", **VISIBLE)
self.requires("libunwind/[>=1.8.1 <2]", **VISIBLE)
#+++++++++++-+-+--+----- --- -- - - - -
def set_version(self):
return self.cor.set_version_from_git_tags(self)
def layout(self):
self.cor.layout_cmake_unified_src(self)
self.cpp.build.libdirs += ['src']
if not self._is_header_only:
self.cpp.build.libs += ['llfs']
def generate(self):
return self.cor.generate_cmake_default(self)
def build(self):
return self.cor.build_cmake_default(self)
def package(self):
return self.cor.package_cmake_install(self)
def package_info(self):
return self.cor.package_info_lib_default(self)
def package_id(self):
return self.cor.package_id_lib_default(self)
#+++++++++++-+-+--+----- --- -- - - - -
def validate_build(self):
if self.settings.compiler == "gcc":
out_capture = io.StringIO()
from_conf = self.conf.get('tools.build:compiler_executables')
cc_name = (
self.buildenv.vars(self).get('CC') or
self.buildenv.vars(self).get('CXX') or
os.getenv('CC') or
os.getenv('CXX') or
(from_conf and from_conf.get('cpp')) or
'gcc'
)
self.run(shlex.join([cc_name, '-dumpversion']), stdout=out_capture, shell=True)
actual_compiler_version = Version(out_capture.getvalue().strip())
profile_compiler_version = Version(str(self.settings.compiler.version))
if profile_compiler_version.major != actual_compiler_version.major:
raise ConanInvalidConfiguration(f"Compiler version mismatch: actual={actual_compiler_version}"
f", expected={profile_compiler_version}")
#+++++++++++-+-+--+----- --- -- - - - -