blob: 86a50ee71a5957b109ee077f30436b1d9b6d5153 [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)
Patrick Williams6b4cf432022-06-16 11:31:57 -050090mapper = dependency('libmapper')
Willy Tuc710b972021-08-11 16:33:43 -070091boost_coroutine = cpp.find_library('boost_coroutine', required: true)
Patrick Williams422385d2022-06-16 11:47:40 -050092sdbusplus_dep = dependency('sdbusplus')
Willy Tuc710b972021-08-11 16:33:43 -070093
Patrick Williamsc8fc7282022-06-16 11:58:53 -050094if cpp.has_header_symbol(
95 'nlohmann/json.hpp',
96 'nlohmann::json::string_t',
97 required:false)
98 nlohmann_json_dep = declare_dependency()
99else
100 nlohmann_json_dep = dependency('nlohmann-json')
101endif
102
Willy Tuc710b972021-08-11 16:33:43 -0700103# Subfolders
104subdir('libipmid')
105subdir('libipmid-host')
106subdir('include')
107subdir('user_channel')
108subdir('scripts')
109
110if not get_option('softoff').disabled()
111 subdir('xyz/openbmc_project/Ipmi/Internal/SoftPowerOff')
112 subdir('softoff')
113endif
114
115# whitelist
116if not get_option('ipmi-whitelist').disabled()
117 generate_whitelist_script = files('generate_whitelist_create.sh')
118
119 whitelist_conf = get_option('whitelist-conf')
120 ipmiwhitelist = run_command( \
121 'bash', \
122 generate_whitelist_script, \
123 whitelist_conf)
124
125 whitelist_pre = declare_dependency(
126 include_directories: root_inc,
127 dependencies: [
Willy Tuc710b972021-08-11 16:33:43 -0700128 crypto,
129 ipmid_dep,
130 phosphor_dbus_interfaces_dep,
131 phosphor_logging_dep,
132 sdbusplus_dep,
133 ],
134 )
135
Willy Tuba9bbb62022-06-01 03:41:15 -0700136 whitelist_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700137 'whitelist',
138 'whitelist-filter.cpp',
139 'ipmiwhitelist.cpp',
140 implicit_include_directories: false,
141 dependencies: whitelist_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700142 version: meson.project_version(),
143 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700144 install: true,
145 install_dir: get_option('libdir') / 'ipmid-providers')
146endif
147
Willy Tuc710b972021-08-11 16:33:43 -0700148# libsysintfcmds
149sysintfcmds_pre = declare_dependency(
150 include_directories: root_inc,
151 dependencies: [
152 channellayer_dep,
153 crypto,
154 mapper,
155 phosphor_dbus_interfaces_dep,
156 phosphor_logging_dep,
157 sdbusplus_dep,
158 ipmid_dep,
159 ])
160
Willy Tuba9bbb62022-06-01 03:41:15 -0700161sysintfcmds_lib = library(
Willy Tuc710b972021-08-11 16:33:43 -0700162 'sysintfcmds',
163 'systemintfcmds.cpp',
164 'host-interface.cpp',
165 implicit_include_directories: false,
166 dependencies: sysintfcmds_pre,
Willy Tuba9bbb62022-06-01 03:41:15 -0700167 version: meson.project_version(),
168 override_options: ['b_lundef=false'],
Willy Tuc710b972021-08-11 16:33:43 -0700169 install: true,
170 install_dir: get_option('libdir') / 'ipmid-providers')
171
Willy Tuc710b972021-08-11 16:33:43 -0700172# ipmid
173ipmid_pre = [
174 sdbusplus_dep,
175 phosphor_logging_dep,
176 phosphor_dbus_interfaces_dep,
177 boost_coroutine,
178 crypto,
179 ipmid_dep,
180 channellayer_dep,
181 mapper,
Willy Tuc710b972021-08-11 16:33:43 -0700182]
183
184generated_src = [
185 meson.project_build_root() + '/sensor-gen.cpp',
186 meson.project_build_root() + '/inventory-sensor-gen.cpp',
187 meson.project_build_root() + '/fru-read-gen.cpp',
188]
189
190transportoem_src = []
191if not get_option('transport-oem').disabled()
192 transportoem_src = ['transporthandler_oem.cpp']
193endif
194
195entity_map_json_lib = static_library(
196 'entity_map_json',
197 'entity_map_json.cpp',
198 include_directories: root_inc,
Patrick Williamsc8fc7282022-06-16 11:58:53 -0500199 dependencies: [ipmid_dep, nlohmann_json_dep],
Willy Tuc710b972021-08-11 16:33:43 -0700200 implicit_include_directories: false)
201
202entity_map_json_dep = declare_dependency(link_with: entity_map_json_lib)
203
204libipmi20_src = [
205 'app/channel.cpp',
206 'app/watchdog.cpp',
207 'app/watchdog_service.cpp',
208 'apphandler.cpp',
209 'sys_info_param.cpp',
210 'sensorhandler.cpp',
211 'storagehandler.cpp',
212 'chassishandler.cpp',
213 'dcmihandler.cpp',
214 'ipmisensor.cpp',
215 'storageaddsel.cpp',
216 'transporthandler.cpp',
217 'globalhandler.cpp',
218 'groupext.cpp',
219 'selutility.cpp',
220 'ipmi_fru_info_area.cpp',
221 'read_fru_data.cpp',
222 'sensordatahandler.cpp',
223 generated_src,
224 transportoem_src,
225 conf_h,
226]
227
228ipmi20_lib = library(
229 'ipmi20',
230 libipmi20_src,
Patrick Williamsc8fc7282022-06-16 11:58:53 -0500231 dependencies: [ipmid_pre, entity_map_json_dep, nlohmann_json_dep],
Willy Tuc710b972021-08-11 16:33:43 -0700232 include_directories: root_inc,
233 install: true,
234 install_dir: get_option('libdir') / 'ipmid-providers',
Willy Tuba9bbb62022-06-01 03:41:15 -0700235 version: meson.project_version(),
Willy Tuc710b972021-08-11 16:33:43 -0700236 override_options: ['b_lundef=false'])
237
238libipmi20_dep = declare_dependency(
239 dependencies: ipmid_pre,
240 include_directories: root_inc,
241 link_with: ipmi20_lib)
242
243# ipmid binary
244executable(
245 'ipmid',
246 'ipmid-new.cpp',
247 'host-cmd-manager.cpp',
248 'settings.cpp',
249 implicit_include_directories: false,
250 dependencies: [libipmi20_dep],
251 include_directories: root_inc,
252 export_dynamic: true,
253 install: true,
254 install_dir: get_option('bindir'))
255
256# Dynamic Sensor Stack
257subdir('dbus-sdr')
258
Willy Tu6eab4202022-06-09 11:34:52 -0700259if not get_option('dynamic-sensors').disabled()
260 library(
261 'dynamiccmds',
262 dbus_sdr_src,
263 implicit_include_directories: false,
264 dependencies: dbus_sdr_pre,
265 version: meson.project_version(),
266 override_options: ['b_lundef=false'],
267 install: true,
268 install_dir: get_option('libdir') / 'ipmid-providers')
269endif
Willy Tuba9bbb62022-06-01 03:41:15 -0700270
Willy Tuc710b972021-08-11 16:33:43 -0700271if not get_option('tests').disabled()
272 subdir('test')
273endif
274
275install_subdir(
276 'user_channel',
277 install_dir: get_option('includedir'),
278 strip_directory: false,
279 exclude_files: '*.cpp')