-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmeson.build
81 lines (73 loc) · 2.13 KB
/
meson.build
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
project(
'hipo4',
'cpp',
meson_version: '>=1.2',
default_options: {
'cpp_std': 'c++17',
'buildtype': 'release',
'libdir': 'lib',
'libexecdir': 'libexec',
'default_library': 'both',
'pkgconfig.relocatable': 'true',
},
version: '4.2.0',
)
add_languages('fortran', native: false, required: get_option('test_fortran'))
# modules
fs = import('fs')
pkg = import('pkgconfig')
# dependencies
lz4_minver = '1.9'
lz4_dep = dependency(
'liblz4',
method: 'pkg-config',
version: f'>=@lz4_minver@',
fallback: ['lz4', 'liblz4_dep'],
)
ROOT_dep = dependency(
'ROOT',
method: 'cmake',
version: '>=6.28',
required: false,
not_found_message: 'ROOT not found; tools which depend on ROOT will not be built.',
)
thread_dep = dependency(
'threads',
required: false,
)
# handle ROOT
# NOTE: hipo library does NOT depend on ROOT, but some extensions and examples do
ROOT_config = find_program('root-config', required: ROOT_dep.found())
ROOT_cling = find_program('rootcling', required: ROOT_dep.found())
ROOT_libdir = ROOT_dep.found() ? run_command(ROOT_config, '--libdir', check: true).stdout().strip() : ''
ROOT_incdir = ROOT_dep.found() ? run_command(ROOT_config, '--incdir', check: true).stdout().strip() : ''
# preprocessor
lz4_preproc_def = '-D__LZ4__'
add_project_arguments(lz4_preproc_def, language: ['cpp'])
# build main project
project_libs = []
subdir('hipo4')
# build examples
if(get_option('build_examples'))
subdir('examples')
endif
if(ROOT_dep.found() and get_option('install_root_tools'))
subdir('examples/root')
endif
# build extensions
build_dataframes = get_option('dataframes') and ROOT_dep.found()
if(build_dataframes)
subdir('extensions' / 'dataframes')
endif
# packaging
pkg.generate(
name: meson.project_name(),
description: 'High Performance Output Data format for experimental physics',
libraries: project_libs,
requires: [ f'liblz4 >= @lz4_minver@' ], # FIXME: can't use `lz4_dep` here when WrapDB is used; this string is a workaround
variables: [
'bindir=${prefix}' / get_option('bindir'),
f'with_dataframes=@build_dataframes@',
],
)
subdir('meson')