blob: bfb417f3bfd92728315f75a19dd3cbfd0033613f [file] [log] [blame]
Willy Tuc710b972021-08-11 16:33:43 -07001project(
2 'phosphor-host-ipimd',
3 'cpp',
4 version: '0.1',
5 meson_version: '>=0.57.0',
6 default_options: [
7 'werror=true',
8 'warning_level=3',
9 'cpp_std=c++20',
10 ])
11
12# Setting up config data
13conf_data = configuration_data()
14
15# The name of the callout's forward association
16conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
17conf_data.set_quoted('BOARD_SENSOR', get_option('board-sensor'))
18conf_data.set_quoted('SYSTEM_SENSOR', get_option('system-sensor'))
19
20# Soft Power off related.
21if not get_option('softoff').disabled()
22 conf_data.set_quoted('SOFTOFF_BUSNAME', get_option('softoff-busname'))
23 conf_data.set_quoted('SOFTOFF_OBJPATH', get_option('softoff-objpath'))
24 conf_data.set('IPMI_SMS_ATN_ACK_TIMEOUT_SECS', get_option('ipmi-sms-atn-ack-timeout-secs'))
25 conf_data.set('IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS', get_option('ipmi-host-shutdown-complete-timeout-secs'))
26 conf_data.set_quoted('HOST_INBAND_REQUEST_DIR', get_option('host-inband-request-dir'))
27 conf_data.set_quoted('HOST_INBAND_REQUEST_FILE', get_option('host-inband-request-file'))
28endif
29
30conf_data.set_quoted('CONTROL_HOST_BUSNAME', get_option('control-host-busname'))
31conf_data.set_quoted('CONTROL_HOST_OBJ_MGR', get_option('control-host-obj-mgr'))
32conf_data.set_quoted('HOST_NAME', get_option('host-name'))
33conf_data.set_quoted('POWER_READING_SENSOR', get_option('power-reading-sensor'))
34conf_data.set_quoted('HOST_IPMI_LIB_PATH', get_option('host-ipmi-lib-path'))
35
36conf_h = configure_file(
37 output: 'config.h',
38 configuration: conf_data)
39
40root = meson.current_source_dir()
41root_inc = include_directories('.', 'include')
42
43# Project Arguments
44cpp = meson.get_compiler('cpp')
45add_project_arguments(
46 cpp.get_supported_arguments([
47 '-DBOOST_ERROR_CODE_HEADER_ONLY',
48 '-DBOOST_SYSTEM_NO_DEPRECATED',
49 '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
50 '-DBOOST_ASIO_DISABLE_THREADS',
51 '-DBOOST_ALL_NO_LIB',
52 ]),
53 language : 'cpp')
54
55feature_map = {
56 'boot-flag-safe-mode-support': '-DENABLE_BOOT_FLAG_SAFE_MODE_SUPPORT',
57 'i2c-whitelist-check' : '-DENABLE_I2C_WHITELIST_CHECK',
58 'update-functional-on-fail' : '-DUPDATE_FUNCTIONAL_ON_FAIL',
59 'dynamic-sensors' : '-DFEATURE_DYNAMIC_SENSORS',
60 'dynamic-sensors-write' : '-DFEATURE_DYNAMIC_SENSORS_WRITE',
61 'hybrid-sensors' : '-DFEATURE_HYBRID_SENSORS',
62 'sensors-cache' : '-DFEATURE_SENSORS_CACHE',
63 'sel-logger-clears-sel' : '-DFEATURE_SEL_LOGGER_CLEARS_SEL',
64}
65
66foreach option_key, option_value : feature_map
67 if(get_option(option_key).enabled())
68 summary(option_key,option_value, section : 'Enabled Features')
69 add_project_arguments(option_value,language:'cpp')
70 endif
71endforeach
72
73add_project_arguments(
74 cpp.get_supported_arguments([
75 '-flto',
76 '-Wno-psabi',
77 '-Wno-missing-field-initializers',
78 '-Wno-pedantic',
79 '-Wno-non-virtual-dtor'
80 ]),
81 language: 'cpp')
82
83# Dependencies
84phosphor_logging_dep = dependency('phosphor-logging')
85phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
86sdeventplus_dep = dependency('sdeventplus')
87systemd = dependency('systemd')
88crypto = dependency('libcrypto', version : '>=1.0.2g')
89pam = cpp.find_library('pam', required: true)
90mapper = cpp.find_library('mapper', required: true)
91boost_coroutine = cpp.find_library('boost_coroutine', required: true)
92std_cpp_fs = cpp.find_library('stdc++fs', required: true)
93
94sdbusplus_dep = dependency('sdbusplus', required : false, include_type: 'system')
95if not sdbusplus_dep.found()
96 sdbusplus_proj = subproject('sdbusplus', required: true)
97 sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
98 sdbusplus_dep = sdbusplus_dep.as_system('system')
99endif
100
101# Subfolders
102subdir('libipmid')
103subdir('libipmid-host')
104subdir('include')
105subdir('user_channel')
106subdir('scripts')
107
108if not get_option('softoff').disabled()
109 subdir('xyz/openbmc_project/Ipmi/Internal/SoftPowerOff')
110 subdir('softoff')
111endif
112
113# whitelist
114if not get_option('ipmi-whitelist').disabled()
115 generate_whitelist_script = files('generate_whitelist_create.sh')
116
117 whitelist_conf = get_option('whitelist-conf')
118 ipmiwhitelist = run_command( \
119 'bash', \
120 generate_whitelist_script, \
121 whitelist_conf)
122
123 whitelist_pre = declare_dependency(
124 include_directories: root_inc,
125 dependencies: [
Willy Tuc710b972021-08-11 16:33:43 -0700126 crypto,
127 ipmid_dep,
128 phosphor_dbus_interfaces_dep,
129 phosphor_logging_dep,
130 sdbusplus_dep,
131 ],
132 )
133
Willy Tuba9bbb62022-06-01 03:41:15 -0700134 whitelist_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700135 'whitelist',
136 'whitelist-filter.cpp',
137 'ipmiwhitelist.cpp',
138 implicit_include_directories: false,
139 dependencies: whitelist_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700140 version: meson.project_version(),
141 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700142 install: true,
143 install_dir: get_option('libdir') / 'ipmid-providers')
144endif
145
Willy Tuc710b972021-08-11 16:33:43 -0700146# libsysintfcmds
147sysintfcmds_pre = declare_dependency(
148 include_directories: root_inc,
149 dependencies: [
150 channellayer_dep,
151 crypto,
152 mapper,
153 phosphor_dbus_interfaces_dep,
154 phosphor_logging_dep,
155 sdbusplus_dep,
156 ipmid_dep,
157 ])
158
Willy Tuba9bbb62022-06-01 03:41:15 -0700159sysintfcmds_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700160 'sysintfcmds',
161 'systemintfcmds.cpp',
162 'host-interface.cpp',
163 implicit_include_directories: false,
164 dependencies: sysintfcmds_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700165 version: meson.project_version(),
166 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700167 install: true,
168 install_dir: get_option('libdir') / 'ipmid-providers')
169
Willy Tuc710b972021-08-11 16:33:43 -0700170# ipmid
171ipmid_pre = [
172 sdbusplus_dep,
173 phosphor_logging_dep,
174 phosphor_dbus_interfaces_dep,
175 boost_coroutine,
176 crypto,
177 ipmid_dep,
178 channellayer_dep,
179 mapper,
180 std_cpp_fs
181]
182
183generated_src = [
184 meson.project_build_root() + '/sensor-gen.cpp',
185 meson.project_build_root() + '/inventory-sensor-gen.cpp',
186 meson.project_build_root() + '/fru-read-gen.cpp',
187]
188
189transportoem_src = []
190if not get_option('transport-oem').disabled()
191 transportoem_src = ['transporthandler_oem.cpp']
192endif
193
194entity_map_json_lib = static_library(
195 'entity_map_json',
196 'entity_map_json.cpp',
197 include_directories: root_inc,
198 dependencies: [ipmid_dep],
199 implicit_include_directories: false)
200
201entity_map_json_dep = declare_dependency(link_with: entity_map_json_lib)
202
203libipmi20_src = [
204 'app/channel.cpp',
205 'app/watchdog.cpp',
206 'app/watchdog_service.cpp',
207 'apphandler.cpp',
208 'sys_info_param.cpp',
209 'sensorhandler.cpp',
210 'storagehandler.cpp',
211 'chassishandler.cpp',
212 'dcmihandler.cpp',
213 'ipmisensor.cpp',
214 'storageaddsel.cpp',
215 'transporthandler.cpp',
216 'globalhandler.cpp',
217 'groupext.cpp',
218 'selutility.cpp',
219 'ipmi_fru_info_area.cpp',
220 'read_fru_data.cpp',
221 'sensordatahandler.cpp',
222 generated_src,
223 transportoem_src,
224 conf_h,
225]
226
227ipmi20_lib = library(
228 'ipmi20',
229 libipmi20_src,
230 dependencies: [ipmid_pre, entity_map_json_dep],
231 include_directories: root_inc,
232 install: true,
233 install_dir: get_option('libdir') / 'ipmid-providers',
Willy Tuba9bbb62022-06-01 03:41:15 -0700234 version: meson.project_version(),
Willy Tuc710b972021-08-11 16:33:43 -0700235 override_options: ['b_lundef=false'])
236
237libipmi20_dep = declare_dependency(
238 dependencies: ipmid_pre,
239 include_directories: root_inc,
240 link_with: ipmi20_lib)
241
242# ipmid binary
243executable(
244 'ipmid',
245 'ipmid-new.cpp',
246 'host-cmd-manager.cpp',
247 'settings.cpp',
248 implicit_include_directories: false,
249 dependencies: [libipmi20_dep],
250 include_directories: root_inc,
251 export_dynamic: true,
252 install: true,
253 install_dir: get_option('bindir'))
254
255# Dynamic Sensor Stack
256subdir('dbus-sdr')
257
Willy Tuba9bbb62022-06-01 03:41:15 -0700258library(
259 'dynamiccmds',
260 dbus_sdr_src,
261 implicit_include_directories: false,
262 dependencies: dbus_sdr_pre,
263 version: meson.project_version(),
264 override_options: ['b_lundef=false'],
265 install: true,
266 install_dir: get_option('libdir') / 'ipmid-providers')
267
Willy Tuc710b972021-08-11 16:33:43 -0700268if not get_option('tests').disabled()
269 subdir('test')
270endif
271
272install_subdir(
273 'user_channel',
274 install_dir: get_option('includedir'),
275 strip_directory: false,
276 exclude_files: '*.cpp')