-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmeson.build
188 lines (166 loc) · 5.2 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
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
project(
'phosphor-ledmanager', 'cpp',
version : '1.0.0',
meson_version: '>=0.57.0',
default_options: [
'warning_level=3',
'werror=true',
'cpp_std=c++20',
'buildtype=debugoptimized'
]
)
conf_data = configuration_data()
conf_data.set_quoted('BUSNAME', 'xyz.openbmc_project.LED.GroupManager')
conf_data.set_quoted('OBJPATH', '/xyz/openbmc_project/led/groups')
conf_data.set_quoted('LED_JSON_FILE', '/usr/share/phosphor-led-manager/led-group-config.json')
conf_data.set_quoted('SAVED_GROUPS_FILE', '/var/lib/phosphor-led-manager/savedGroups')
conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault')
conf_data.set_quoted('ELOG_ENTRY', 'entry')
conf_data.set_quoted('LED_FAULT', 'fault')
conf_data.set('CLASS_VERSION', 1)
conf_data.set('LED_USE_JSON', get_option('use-json').enabled())
conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').enabled())
conf_data.set('MONITOR_OPERATIONAL_STATUS', get_option('monitor-operational-status').enabled())
conf_data.set('IBM_SAI', get_option('monitor-sai-status').enabled())
sdbusplus_dep = dependency('sdbusplus', required: false)
if sdbusplus_dep.found()
sdbusplusplus_prog = find_program('sdbus++')
sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson')
else
sdbusplus_proj = subproject('sdbusplus', required: true)
sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
sdbusplusplus_prog = sdbusplus_proj.get_variable('sdbusplusplus_prog')
sdbuspp_gen_meson_prog = sdbusplus_proj.get_variable(
'sdbuspp_gen_meson_prog'
)
endif
sdeventplus_dep = dependency(
'sdeventplus',
fallback: [
'sdeventplus',
'sdeventplus_dep'
],
)
phosphor_logging_dep = dependency(
'phosphor-logging',
fallback: [
'phosphor-logging',
'phosphor_logging_dep'
],
)
phosphor_dbus_interfaces_dep = dependency(
'phosphor-dbus-interfaces',
fallback: [
'phosphor-dbus-interfaces',
'phosphor_dbus_interfaces_dep'
],
)
prog_python = find_program('python3', required: true)
realpath_prog = find_program('realpath')
cpp = meson.get_compiler('cpp')
if cpp.has_header('nlohmann/json.hpp')
nlohmann_json = declare_dependency()
else
subproject('nlohmann', required: false)
nlohmann_json = declare_dependency(
include_directories: [
'subprojects/nlohmann/single_include',
'subprojects/nlohmann/single_include/nlohmann',
]
)
endif
selected_subdirs = []
selected_subdirs += 'xyz/openbmc_project'
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
deps = [
sdbusplus_dep,
sdeventplus_dep,
phosphor_logging_dep,
phosphor_dbus_interfaces_dep,
nlohmann_json
]
sources = [
'group.cpp',
'led-main.cpp',
'manager.cpp',
'serialize.cpp',
'utils.cpp',
]
if get_option('monitor-sai-status').enabled()
sources += [
'ibm-sai.cpp'
]
endif
if get_option('use-json').disabled()
led_gen_hpp = custom_target(
'led-gen.hpp',
command : [
prog_python,
meson.project_source_root() + '/parse_led.py',
'-i', meson.project_source_root(),
'-o', meson.current_build_dir(),
],
output : 'led-gen.hpp')
sources += [led_gen_hpp]
endif
if get_option('use-lamp-test').enabled()
conf_data.set_quoted('LAMP_TEST_OBJECT', '/xyz/openbmc_project/led/groups/lamp_test')
conf_data.set_quoted('HOST_LAMP_TEST_OBJECT', '/xyz/openbmc_project/led/groups/host_lamp_test')
conf_data.set_quoted('LAMP_TEST_LED_OVERRIDES_JSON', '/usr/share/phosphor-led-manager/lamp-test-led-overrides.json')
conf_data.set('LAMP_TEST_TIMEOUT_IN_SECS', 240)
sources += ['lamptest.cpp']
endif
configure_file(output: 'config.h',
configuration: conf_data
)
install_data(
['scripts/led-set-all-groups-asserted.sh', 'scripts/oem/set-guarded-fru-leds.sh'],
install_mode: 'rwxr-xr-x',
install_dir: get_option('bindir')
)
executable(
'phosphor-ledmanager',
sources,
generated_sources,
include_directories: include_directories('gen'),
implicit_include_directories: true,
dependencies: deps,
install: true,
install_dir: get_option('bindir')
)
subdir('fault-monitor')
build_tests = get_option('tests')
if not build_tests.disabled()
subdir('test')
endif
install_subdir('configs',
install_dir: get_option('datadir') / 'phosphor-led-manager',
strip_directory: true)