blob: f6fc07cddf1ea311b423fb1c2d75d1eed7885627 [file] [log] [blame]
Willy Tuc710b972021-08-11 16:33:43 -07001project(
George Liu1a2e1502022-07-08 12:20:19 +08002 'phosphor-host-ipmid',
Willy Tuc710b972021-08-11 16:33:43 -07003 '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'))
Potin Lai5d214202023-01-16 18:11:49 +080035conf_data.set_quoted('FW_VER_REGEX', get_option('fw-ver-regex'))
Willy Tuc710b972021-08-11 16:33:43 -070036
Potin Laic7c55922023-02-16 10:33:55 +080037matches_map = get_option('matches-map')
38conf_data.set('MAJOR_MATCH_INDEX', matches_map[0])
39conf_data.set('MINOR_MATCH_INDEX', matches_map[1])
40conf_data.set('AUX_0_MATCH_INDEX', matches_map[2])
41conf_data.set('AUX_1_MATCH_INDEX', matches_map[3])
42conf_data.set('AUX_2_MATCH_INDEX', matches_map[4])
43conf_data.set('AUX_3_MATCH_INDEX', matches_map[5])
44
Willy Tuc710b972021-08-11 16:33:43 -070045conf_h = configure_file(
46 output: 'config.h',
47 configuration: conf_data)
48
49root = meson.current_source_dir()
50root_inc = include_directories('.', 'include')
51
52# Project Arguments
53cpp = meson.get_compiler('cpp')
54add_project_arguments(
55 cpp.get_supported_arguments([
56 '-DBOOST_ERROR_CODE_HEADER_ONLY',
57 '-DBOOST_SYSTEM_NO_DEPRECATED',
58 '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
59 '-DBOOST_ASIO_DISABLE_THREADS',
60 '-DBOOST_ALL_NO_LIB',
61 ]),
62 language : 'cpp')
63
Willy Tub78184e2022-10-27 22:57:38 +000064if not get_option('get-dbus-active-software').disabled()
65 add_project_arguments(
66 cpp.get_supported_arguments([
67 '-DGET_DBUS_ACTIVE_SOFTWARE',
68 ]),
69 language : 'cpp')
70endif
71
Willy Tuc710b972021-08-11 16:33:43 -070072feature_map = {
73 'boot-flag-safe-mode-support': '-DENABLE_BOOT_FLAG_SAFE_MODE_SUPPORT',
74 'i2c-whitelist-check' : '-DENABLE_I2C_WHITELIST_CHECK',
75 'update-functional-on-fail' : '-DUPDATE_FUNCTIONAL_ON_FAIL',
76 'dynamic-sensors' : '-DFEATURE_DYNAMIC_SENSORS',
77 'dynamic-sensors-write' : '-DFEATURE_DYNAMIC_SENSORS_WRITE',
Johnathan Mantey23a722c2023-05-12 08:18:54 -070078 'entity-manager-decorators' : '-DUSING_ENTITY_MANAGER_DECORATORS',
Willy Tuc710b972021-08-11 16:33:43 -070079 'hybrid-sensors' : '-DFEATURE_HYBRID_SENSORS',
80 'sensors-cache' : '-DFEATURE_SENSORS_CACHE',
81 'sel-logger-clears-sel' : '-DFEATURE_SEL_LOGGER_CLEARS_SEL',
82}
83
84foreach option_key, option_value : feature_map
85 if(get_option(option_key).enabled())
86 summary(option_key,option_value, section : 'Enabled Features')
87 add_project_arguments(option_value,language:'cpp')
88 endif
89endforeach
90
91add_project_arguments(
92 cpp.get_supported_arguments([
93 '-flto',
94 '-Wno-psabi',
95 '-Wno-missing-field-initializers',
96 '-Wno-pedantic',
97 '-Wno-non-virtual-dtor'
98 ]),
99 language: 'cpp')
100
101# Dependencies
102phosphor_logging_dep = dependency('phosphor-logging')
103phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
104sdeventplus_dep = dependency('sdeventplus')
105systemd = dependency('systemd')
106crypto = dependency('libcrypto', version : '>=1.0.2g')
107pam = cpp.find_library('pam', required: true)
Patrick Williams6b4cf432022-06-16 11:31:57 -0500108mapper = dependency('libmapper')
Willy Tuc710b972021-08-11 16:33:43 -0700109boost_coroutine = cpp.find_library('boost_coroutine', required: true)
Patrick Williams422385d2022-06-16 11:47:40 -0500110sdbusplus_dep = dependency('sdbusplus')
Willy Tuc710b972021-08-11 16:33:43 -0700111
Patrick Williamsc8fc7282022-06-16 11:58:53 -0500112if cpp.has_header_symbol(
113 'nlohmann/json.hpp',
114 'nlohmann::json::string_t',
115 required:false)
116 nlohmann_json_dep = declare_dependency()
117else
118 nlohmann_json_dep = dependency('nlohmann-json')
119endif
120
Patrick Williamsb69b2062022-07-25 09:40:49 -0500121generated_src = []
122
Willy Tuc710b972021-08-11 16:33:43 -0700123# Subfolders
124subdir('libipmid')
Willy Tuc710b972021-08-11 16:33:43 -0700125subdir('include')
126subdir('user_channel')
127subdir('scripts')
128
129if not get_option('softoff').disabled()
130 subdir('xyz/openbmc_project/Ipmi/Internal/SoftPowerOff')
131 subdir('softoff')
132endif
133
134# whitelist
135if not get_option('ipmi-whitelist').disabled()
136 generate_whitelist_script = files('generate_whitelist_create.sh')
137
138 whitelist_conf = get_option('whitelist-conf')
139 ipmiwhitelist = run_command( \
140 'bash', \
141 generate_whitelist_script, \
142 whitelist_conf)
143
144 whitelist_pre = declare_dependency(
145 include_directories: root_inc,
146 dependencies: [
Willy Tuc710b972021-08-11 16:33:43 -0700147 crypto,
148 ipmid_dep,
149 phosphor_dbus_interfaces_dep,
150 phosphor_logging_dep,
151 sdbusplus_dep,
152 ],
153 )
154
Willy Tuba9bbb62022-06-01 03:41:15 -0700155 whitelist_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700156 'whitelist',
157 'whitelist-filter.cpp',
158 'ipmiwhitelist.cpp',
159 implicit_include_directories: false,
160 dependencies: whitelist_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700161 version: meson.project_version(),
162 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700163 install: true,
164 install_dir: get_option('libdir') / 'ipmid-providers')
165endif
166
Willy Tuc710b972021-08-11 16:33:43 -0700167# libsysintfcmds
168sysintfcmds_pre = declare_dependency(
169 include_directories: root_inc,
170 dependencies: [
171 channellayer_dep,
172 crypto,
173 mapper,
174 phosphor_dbus_interfaces_dep,
175 phosphor_logging_dep,
176 sdbusplus_dep,
177 ipmid_dep,
178 ])
179
Willy Tuba9bbb62022-06-01 03:41:15 -0700180sysintfcmds_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700181 'sysintfcmds',
182 'systemintfcmds.cpp',
183 'host-interface.cpp',
184 implicit_include_directories: false,
185 dependencies: sysintfcmds_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700186 version: meson.project_version(),
187 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700188 install: true,
189 install_dir: get_option('libdir') / 'ipmid-providers')
190
Willy Tuc710b972021-08-11 16:33:43 -0700191# ipmid
192ipmid_pre = [
193 sdbusplus_dep,
194 phosphor_logging_dep,
195 phosphor_dbus_interfaces_dep,
196 boost_coroutine,
197 crypto,
198 ipmid_dep,
199 channellayer_dep,
200 mapper,
Willy Tuc710b972021-08-11 16:33:43 -0700201]
202
Willy Tuc710b972021-08-11 16:33:43 -0700203transportoem_src = []
204if not get_option('transport-oem').disabled()
205 transportoem_src = ['transporthandler_oem.cpp']
206endif
207
Willy Tuc710b972021-08-11 16:33:43 -0700208libipmi20_src = [
209 'app/channel.cpp',
210 'app/watchdog.cpp',
211 'app/watchdog_service.cpp',
212 'apphandler.cpp',
213 'sys_info_param.cpp',
214 'sensorhandler.cpp',
215 'storagehandler.cpp',
216 'chassishandler.cpp',
217 'dcmihandler.cpp',
218 'ipmisensor.cpp',
219 'storageaddsel.cpp',
220 'transporthandler.cpp',
221 'globalhandler.cpp',
222 'groupext.cpp',
223 'selutility.cpp',
224 'ipmi_fru_info_area.cpp',
225 'read_fru_data.cpp',
226 'sensordatahandler.cpp',
Jian Zhangff1b4bf2022-06-28 16:08:26 +0800227 'user_channel/channelcommands.cpp',
Willy Tuc710b972021-08-11 16:33:43 -0700228 generated_src,
229 transportoem_src,
230 conf_h,
231]
232
233ipmi20_lib = library(
234 'ipmi20',
235 libipmi20_src,
Vernon Mauery9cf08382023-04-28 14:00:11 -0700236 dependencies: [ipmid_pre, nlohmann_json_dep],
Willy Tuc710b972021-08-11 16:33:43 -0700237 include_directories: root_inc,
238 install: true,
239 install_dir: get_option('libdir') / 'ipmid-providers',
Willy Tuba9bbb62022-06-01 03:41:15 -0700240 version: meson.project_version(),
Willy Tuc710b972021-08-11 16:33:43 -0700241 override_options: ['b_lundef=false'])
242
243libipmi20_dep = declare_dependency(
244 dependencies: ipmid_pre,
245 include_directories: root_inc,
246 link_with: ipmi20_lib)
247
248# ipmid binary
249executable(
250 'ipmid',
251 'ipmid-new.cpp',
252 'host-cmd-manager.cpp',
253 'settings.cpp',
254 implicit_include_directories: false,
255 dependencies: [libipmi20_dep],
256 include_directories: root_inc,
257 export_dynamic: true,
258 install: true,
259 install_dir: get_option('bindir'))
260
261# Dynamic Sensor Stack
262subdir('dbus-sdr')
263
Willy Tu0679e4b2022-11-11 14:34:33 -0800264if not get_option('dynamic-sensors').disabled() or not get_option('tests').disabled()
Willy Tu6eab4202022-06-09 11:34:52 -0700265 library(
266 'dynamiccmds',
267 dbus_sdr_src,
268 implicit_include_directories: false,
269 dependencies: dbus_sdr_pre,
270 version: meson.project_version(),
271 override_options: ['b_lundef=false'],
272 install: true,
273 install_dir: get_option('libdir') / 'ipmid-providers')
274endif
Willy Tuba9bbb62022-06-01 03:41:15 -0700275
Willy Tuc710b972021-08-11 16:33:43 -0700276if not get_option('tests').disabled()
277 subdir('test')
278endif
279
280install_subdir(
281 'user_channel',
282 install_dir: get_option('includedir'),
283 strip_directory: false,
284 exclude_files: '*.cpp')