Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 1 | project( |
| 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 |
| 13 | conf_data = configuration_data() |
| 14 | |
| 15 | # The name of the callout's forward association |
| 16 | conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout') |
| 17 | conf_data.set_quoted('BOARD_SENSOR', get_option('board-sensor')) |
| 18 | conf_data.set_quoted('SYSTEM_SENSOR', get_option('system-sensor')) |
| 19 | |
| 20 | # Soft Power off related. |
| 21 | if 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')) |
| 28 | endif |
| 29 | |
| 30 | conf_data.set_quoted('CONTROL_HOST_BUSNAME', get_option('control-host-busname')) |
| 31 | conf_data.set_quoted('CONTROL_HOST_OBJ_MGR', get_option('control-host-obj-mgr')) |
| 32 | conf_data.set_quoted('HOST_NAME', get_option('host-name')) |
| 33 | conf_data.set_quoted('POWER_READING_SENSOR', get_option('power-reading-sensor')) |
| 34 | conf_data.set_quoted('HOST_IPMI_LIB_PATH', get_option('host-ipmi-lib-path')) |
| 35 | |
| 36 | conf_h = configure_file( |
| 37 | output: 'config.h', |
| 38 | configuration: conf_data) |
| 39 | |
| 40 | root = meson.current_source_dir() |
| 41 | root_inc = include_directories('.', 'include') |
| 42 | |
| 43 | # Project Arguments |
| 44 | cpp = meson.get_compiler('cpp') |
| 45 | add_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 | |
| 55 | feature_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 | |
| 66 | foreach 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 |
| 71 | endforeach |
| 72 | |
| 73 | add_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 |
| 84 | phosphor_logging_dep = dependency('phosphor-logging') |
| 85 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 86 | sdeventplus_dep = dependency('sdeventplus') |
| 87 | systemd = dependency('systemd') |
| 88 | crypto = dependency('libcrypto', version : '>=1.0.2g') |
| 89 | pam = cpp.find_library('pam', required: true) |
| 90 | mapper = cpp.find_library('mapper', required: true) |
| 91 | boost_coroutine = cpp.find_library('boost_coroutine', required: true) |
| 92 | std_cpp_fs = cpp.find_library('stdc++fs', required: true) |
| 93 | |
| 94 | sdbusplus_dep = dependency('sdbusplus', required : false, include_type: 'system') |
| 95 | if 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') |
| 99 | endif |
| 100 | |
| 101 | # Subfolders |
| 102 | subdir('libipmid') |
| 103 | subdir('libipmid-host') |
| 104 | subdir('include') |
| 105 | subdir('user_channel') |
| 106 | subdir('scripts') |
| 107 | |
| 108 | if not get_option('softoff').disabled() |
| 109 | subdir('xyz/openbmc_project/Ipmi/Internal/SoftPowerOff') |
| 110 | subdir('softoff') |
| 111 | endif |
| 112 | |
| 113 | # whitelist |
| 114 | if 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 Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 126 | crypto, |
| 127 | ipmid_dep, |
| 128 | phosphor_dbus_interfaces_dep, |
| 129 | phosphor_logging_dep, |
| 130 | sdbusplus_dep, |
| 131 | ], |
| 132 | ) |
| 133 | |
Willy Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 134 | whitelist_lib = library( |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 135 | 'whitelist', |
| 136 | 'whitelist-filter.cpp', |
| 137 | 'ipmiwhitelist.cpp', |
| 138 | implicit_include_directories: false, |
| 139 | dependencies: whitelist_pre, |
Willy Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 140 | version: meson.project_version(), |
| 141 | override_options: ['b_lundef=false'], |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 142 | install: true, |
| 143 | install_dir: get_option('libdir') / 'ipmid-providers') |
| 144 | endif |
| 145 | |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 146 | # libsysintfcmds |
| 147 | sysintfcmds_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 Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 159 | sysintfcmds_lib = library( |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 160 | 'sysintfcmds', |
| 161 | 'systemintfcmds.cpp', |
| 162 | 'host-interface.cpp', |
| 163 | implicit_include_directories: false, |
| 164 | dependencies: sysintfcmds_pre, |
Willy Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 165 | version: meson.project_version(), |
| 166 | override_options: ['b_lundef=false'], |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 167 | install: true, |
| 168 | install_dir: get_option('libdir') / 'ipmid-providers') |
| 169 | |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 170 | # ipmid |
| 171 | ipmid_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 | |
| 183 | generated_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 | |
| 189 | transportoem_src = [] |
| 190 | if not get_option('transport-oem').disabled() |
| 191 | transportoem_src = ['transporthandler_oem.cpp'] |
| 192 | endif |
| 193 | |
| 194 | entity_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 | |
| 201 | entity_map_json_dep = declare_dependency(link_with: entity_map_json_lib) |
| 202 | |
| 203 | libipmi20_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 | |
| 227 | ipmi20_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 Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 234 | version: meson.project_version(), |
Willy Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 235 | override_options: ['b_lundef=false']) |
| 236 | |
| 237 | libipmi20_dep = declare_dependency( |
| 238 | dependencies: ipmid_pre, |
| 239 | include_directories: root_inc, |
| 240 | link_with: ipmi20_lib) |
| 241 | |
| 242 | # ipmid binary |
| 243 | executable( |
| 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 |
| 256 | subdir('dbus-sdr') |
| 257 | |
Willy Tu | ba9bbb6 | 2022-06-01 03:41:15 -0700 | [diff] [blame] | 258 | library( |
| 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 Tu | c710b97 | 2021-08-11 16:33:43 -0700 | [diff] [blame] | 268 | if not get_option('tests').disabled() |
| 269 | subdir('test') |
| 270 | endif |
| 271 | |
| 272 | install_subdir( |
| 273 | 'user_channel', |
| 274 | install_dir: get_option('includedir'), |
| 275 | strip_directory: false, |
| 276 | exclude_files: '*.cpp') |