This repository was archived by the owner on Feb 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmeson.build
More file actions
270 lines (249 loc) · 7.33 KB
/
meson.build
File metadata and controls
270 lines (249 loc) · 7.33 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
project(
'iguana',
'cpp',
version: '1.1.0',
license: [ 'LGPLv3' ],
license_files: [ 'LICENSE' ],
meson_version: '>=1.2',
default_options: {
'cpp_std': 'c++17',
'buildtype': 'release',
'libdir': 'lib',
'licensedir': 'share/licenses/iguana',
'pkgconfig.relocatable': 'true',
'force_fallback_for': ['rcdb'],
},
)
project_description = 'Implementation Guardian of Analysis Algorithms'
# initialize binding languanges
add_languages('fortran', native: false, required: get_option('bind_fortran'))
use_chameleon = get_option('bind_fortran')
# warn that macOS is no longer tested
if host_machine.system() == 'darwin'
warning('''host machine system is darwin:
==================================================================================
It looks like you are using macOS.
- Tests on macOS have been removed as of Iguana v0.9.0, in favor of testing
in a Linux container.
- For consistency and better support, using a Linux container is preferred.
- Otherwise, please report any problems on macOS, if you choose to continue.
==================================================================================
''')
endif
# meson modules
pkg = import('pkgconfig')
fs = import('fs')
# build subprojects
rcdb_subproj = subproject('rcdb', required: get_option('z_require_rcdb'))
# resolve dependencies
fmt_dep = dependency(
'fmt',
version: '>=9.1.0',
method: 'pkg-config',
)
yamlcpp_dep = dependency(
'yaml-cpp',
version: '>=0.7.0',
method: 'pkg-config',
)
hipo_dep = dependency(
'hipo4',
version: '>=4.2.0',
method: 'pkg-config',
)
ROOT_dep = dependency(
'ROOT',
version: '>=6.30',
method: 'cmake',
required: get_option('z_require_root'),
modules: [
'ROOT::Core',
'ROOT::GenVector',
'ROOT::Gpad',
'ROOT::Graf',
'ROOT::Hist',
'ROOT::RIO',
'ROOT::ROOTDataFrame',
'ROOT::ROOTVecOps',
'ROOT::TreePlayer',
],
)
prog_ruby = find_program(
'ruby',
version: '>=3.0.0',
required: use_chameleon,
)
prog_python = find_program(
'python3',
version: '>=3.0.0',
required: get_option('bind_python'),
)
rcdb_dep = dependency(
'rcdb',
fallback: ['rcdb', 'rcdb_dep'],
required: get_option('z_require_rcdb'),
)
thread_dep = dependency(
'threads',
required: true, # FIXME: actually, it's only needed for multi-threading tests/examples
)
# list of dependencies
# FIXME: for users which use LD_LIBRARY_PATH, we should try to keep this list
# ordered such that the ones users are *least likely* to try to build
# themselves are listed last (see FIXME in meson/this_iguana.sh.in)
dep_list = []
foreach dep : [ hipo_dep, fmt_dep, yamlcpp_dep, rcdb_dep, ROOT_dep ]
if dep.found()
dep_list += dep
endif
endforeach
# pkgconfig configuration: make a list of dependency library and include directories
dep_lib_dirs = []
dep_include_dirs = []
dep_pkgconfig_dirs = []
foreach dep : dep_list
# get library and include dirs
if dep.type_name() == 'pkgconfig'
libdirs = [ dep.get_variable(pkgconfig: 'libdir') ]
incdirs = [ dep.get_variable(pkgconfig: 'includedir') ]
elif dep.type_name() == 'cmake'
libdirs = []
foreach lib : dep.get_variable(cmake: 'PACKAGE_LIBRARIES').split(';')
libdirs += run_command('dirname', lib, check: true).stdout().strip()
endforeach
incdirs = dep.get_variable(cmake: 'PACKAGE_INCLUDE_DIRS').split(';')
else
name = dep.get_variable(internal: 'name', default_value: dep.name())
if name == 'rcdb'
incdirs = [ dep.get_variable(internal: 'includedir') ]
else
warning(f'Unknown dependency "@name@"')
continue
endif
endif
# append to `dep_*_dirs` arrays, uniquely
foreach libdir : libdirs
if not dep_lib_dirs.contains(libdir)
dep_lib_dirs += libdir
endif
if dep.type_name() == 'pkgconfig'
pkgconfigdir = libdir / 'pkgconfig'
if not dep_pkgconfig_dirs.contains(pkgconfigdir)
dep_pkgconfig_dirs += pkgconfigdir
endif
endif
endforeach
foreach incdir : incdirs
if not dep_include_dirs.contains(incdir)
dep_include_dirs += incdir
endif
endforeach
endforeach
# handle HIPO dataframes
hipo_dep_dataframes_found = hipo_dep.get_variable(
pkgconfig: 'with_dataframes',
default_value: 'false',
).to_lower() == 'true'
# general project vars
project_inc = include_directories('src')
project_libs = []
project_deps = declare_dependency(dependencies: dep_list)
project_etcdir = get_option('sysconfdir') / meson.project_name()
project_test_env = environment()
project_pythondir = 'python'
# sanitizer settings
project_test_env.set(
'UBSAN_OPTIONS',
'halt_on_error=1',
'abort_on_error=1',
'print_summary=1',
'print_stacktrace=1',
'suppressions=' + meson.project_source_root() / 'meson' / 'ubsan.supp',
)
project_test_env.set(
'ASAN_OPTIONS',
'halt_on_error=1',
'abort_on_error=1',
'print_summary=1',
'suppressions=' + meson.project_source_root() / 'meson' / 'asan.supp',
)
project_test_env.set(
'LSAN_OPTIONS',
'suppressions=' + meson.project_source_root() / 'meson' / 'lsan.supp',
)
# additional test environment variables
project_test_env.prepend(
'PKG_CONFIG_PATH',
get_option('prefix') / get_option('libdir') / 'pkgconfig'
)
project_test_env.prepend(
'PYTHONPATH',
get_option('prefix') / 'python'
)
# set preprocessor macros
add_project_arguments('-DIGUANA_ETCDIR="' + get_option('prefix') / project_etcdir + '"', language: [ 'cpp' ])
if ROOT_dep.found()
add_project_arguments('-DIGUANA_ROOT_FOUND', language: [ 'cpp' ]) # currently only used for Validator plot styles
endif
# start chameleon
if use_chameleon
subdir('src/chameleon')
endif
# build and install shared libraries
subdir('src/iguana/services')
subdir('src/iguana/bankdefs')
subdir('src/iguana/algorithms')
subdir('src/iguana/tests')
# build and install bindings
if use_chameleon
subdir('src/iguana/bindings')
endif
if get_option('bind_python')
subdir('bind/python')
endif
# build examples
if get_option('install_examples')
subdir('examples')
endif
# generate documentation
if get_option('install_documentation')
subdir('doc/doxygen')
endif
# generate pkg-config file
pkg.generate(
name: meson.project_name(),
description: project_description,
libraries: project_libs,
requires: [ fmt_dep, yamlcpp_dep, hipo_dep ], # pkg-config dependencies only
)
# install environment setup files
if get_option('z_install_envfile')
configure_file(
input: 'meson' / 'this_iguana.sh.in',
output: 'this_iguana.sh',
install: true,
install_dir: get_option('bindir'),
configuration: {
'ld_path': host_machine.system() != 'darwin' ? 'LD_LIBRARY_PATH' : 'DYLD_LIBRARY_PATH',
'python': get_option('bind_python') ? 'true' : 'false',
'root': ROOT_dep.found() ? 'true' : 'false',
'libdir': get_option('libdir'),
'includedir': get_option('includedir'),
'bindir': get_option('bindir'),
'etcdir': project_etcdir,
'pythondir': project_pythondir,
'dep_pkgconfigdirs': ':'.join(dep_pkgconfig_dirs),
'dep_libdirs': ':'.join(dep_lib_dirs),
'dep_includedirs': ':'.join(dep_include_dirs),
},
)
foreach shell : [ 'csh', 'tcsh' ]
configure_file(
input: 'meson' / 'this_iguana.csh.in',
output: 'this_iguana.' + shell,
install: true,
install_dir: get_option('bindir'),
configuration: {'shell': shell},
)
endforeach
endif