-
Notifications
You must be signed in to change notification settings - Fork 13
/
meson.build
150 lines (132 loc) · 3.59 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
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
project(
'openpower-debug-collector',
'cpp',
meson_version: '>= 0.57.0',
default_options: [
'warning_level=3',
'werror=true',
'cpp_std=c++20'
],
license: 'Apache-2.0',
version: '1.0.0',
)
systemd = dependency('systemd', required : true)
sdbusplus = dependency(
'sdbusplus',
fallback: [
'sdbusplus',
'sdbusplus_dep'
]
)
sdbusplusplus_prog = find_program('sdbus++', required : true)
sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson', required : true)
phosphorlogging = dependency(
'phosphor-logging',
fallback: [
'phosphor-logging',
'phosphor_logging_dep'
]
)
fmt_dep = dependency('fmt', required: false)
if not fmt_dep.found()
fmt_proj = import('cmake').subproject(
'fmt',
cmake_options: [
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
'-DMASTER_PROJECT=OFF'
],
required: false)
assert(fmt_proj.found(), 'fmtlib is required')
fmt_dep = fmt_proj.dependency('fmt')
endif
realpath_prog = find_program('realpath')
selected_subdirs = []
selected_subdirs += 'org/open_power'
generated_root = meson.current_build_dir() / 'gen'
generated_others = []
generated_sources = []
# Source the generated meson files
subdir('gen')
foreach d : selected_subdirs
subdir('gen' / d)
endforeach
# Parse through the list from sdbus++-gendir and put into sets.
generated_headers = []
generated_cpp = []
generated_others_files = []
foreach g : generated_sources generated_others
foreach f : g.to_list()
rel_path = run_command(
realpath_prog,
'--relative-to', generated_root,
f.full_path(),
).stdout().strip().split('\n')[-1]
if rel_path.endswith('.hpp')
generated_headers += rel_path
elif rel_path.endswith('.cpp')
generated_cpp += rel_path
else
generated_others_files += rel_path
endif
endforeach
endforeach
cxx = meson.get_compiler('cpp')
conf_data = configuration_data()
if get_option('hostboot-dump-collection').enabled()
conf_data.set('WATCHDOG_DUMP_COLLECTION', true)
extra_deps = [
cxx.find_library('pdbg'),
cxx.find_library('libdt-api'),
cxx.find_library('phal')
]
subdir('watchdog')
else
conf_data.set('WATCHDOG_DUMP_COLLECTION', false)
watchdog_lib = []
extra_deps = []
endif
deps = [
systemd,
sdbusplus,
phosphorlogging,
fmt_dep,
extra_deps
]
# list of unit files, the path as input and service name
# as output
# eg: unit_file += {'input:'<path>, 'output':<service name>}
unit_files = []
if get_option('dump-collection').enabled()
subdir('dump')
endif
executable('watchdog_timeout',
'watchdog_timeout.cpp',
configure_file(output: 'config.h', configuration: conf_data),
generated_sources,
dependencies: deps,
link_with: watchdog_lib,
include_directories: include_directories('gen'),
implicit_include_directories: true,
install: true
)
executable('checkstop_app',
'checkstop_app.cpp',
generated_sources,
dependencies: deps,
include_directories: include_directories('gen'),
implicit_include_directories: true,
install: true
)
unit_subs = configuration_data()
unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
systemd_system_unit_dir = dependency('systemd').get_variable(
pkgconfig: 'systemdsystemunitdir')
foreach u : unit_files
configure_file(
configuration: unit_subs,
input: u.get('input'),
install: true,
install_dir: systemd_system_unit_dir,
output: u.get('output')
)
endforeach