Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | |
| 3 | project('phosphor-debug-collector', |
| 4 | 'cpp', |
Patrick Williams | 8f4cc94 | 2021-10-01 16:05:41 -0500 | [diff] [blame] | 5 | meson_version: '>= 0.57.0', |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 6 | default_options: [ |
Patrick Williams | 8f4cc94 | 2021-10-01 16:05:41 -0500 | [diff] [blame] | 7 | 'cpp_std=c++20', |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 8 | 'warning_level=3', |
PriyangaRamasamy | 01c6646 | 2021-02-23 05:46:25 -0600 | [diff] [blame] | 9 | 'werror=true', |
| 10 | 'buildtype=debugoptimized' |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 11 | ], |
| 12 | version: '1.0', |
| 13 | license: 'Apache-2.0' |
| 14 | ) |
| 15 | |
Patrick Williams | abbe159 | 2021-10-01 16:04:19 -0500 | [diff] [blame] | 16 | cpp = meson.get_compiler('cpp') |
| 17 | |
Dhruvaraj Subhashchandran | 9f55736 | 2021-05-12 06:28:20 -0500 | [diff] [blame] | 18 | # list of unit files, the path as input and service name |
| 19 | # as output |
| 20 | # eg: unit_file += {'input:'<path>, 'output':<service name>} |
| 21 | unit_files = [] |
| 22 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 23 | # Checking dependency external library |
| 24 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 25 | libsystemd = dependency('libsystemd', version : '>=221') |
George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [diff] [blame] | 26 | |
Patrick Williams | 02634e5 | 2022-03-21 11:16:11 -0500 | [diff] [blame] | 27 | sdbusplus_dep = dependency('sdbusplus') |
| 28 | sdbusplusplus_prog = find_program('sdbus++') |
| 29 | sdbuspp_gen_meson_prog = find_program('sdbus++-gen-meson') |
| 30 | |
| 31 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 32 | phosphor_logging_dep = dependency('phosphor-logging') |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 33 | |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 34 | fmt_dep = dependency('fmt', required: false) |
| 35 | if not fmt_dep.found() |
| 36 | fmt_proj = import('cmake').subproject( |
| 37 | 'fmt', |
| 38 | cmake_options: [ |
| 39 | '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', |
| 40 | '-DMASTER_PROJECT=OFF' |
| 41 | ], |
| 42 | required: false) |
| 43 | assert(fmt_proj.found(), 'fmtlib is required') |
| 44 | fmt_dep = fmt_proj.dependency('fmt') |
| 45 | endif |
| 46 | |
Patrick Williams | abbe159 | 2021-10-01 16:04:19 -0500 | [diff] [blame] | 47 | # Get Cereal dependency. |
| 48 | cereal_dep = dependency('cereal', required: false) |
| 49 | has_cereal = cpp.has_header_symbol( |
| 50 | 'cereal/cereal.hpp', |
| 51 | 'cereal::specialize', |
| 52 | dependencies: cereal_dep, |
| 53 | required: false) |
| 54 | if not has_cereal |
| 55 | cereal_opts = import('cmake').subproject_options() |
| 56 | cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'}) |
| 57 | cereal_proj = import('cmake').subproject( |
| 58 | 'cereal', |
| 59 | options: cereal_opts, |
| 60 | required: false) |
| 61 | assert(cereal_proj.found(), 'cereal is required') |
| 62 | cereal_dep = cereal_proj.dependency('cereal') |
| 63 | endif |
| 64 | |
PriyangaRamasamy | 01c6646 | 2021-02-23 05:46:25 -0600 | [diff] [blame] | 65 | # Disable FORTIFY_SOURCE when compiling with no optimization |
| 66 | if(get_option('optimization') == '0') |
| 67 | add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c']) |
| 68 | message('Disabling FORTIFY_SOURCE as optimization is set to 0') |
| 69 | endif |
| 70 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 71 | # Configuration header file(config.h) generation |
| 72 | |
| 73 | conf_data = configuration_data() |
| 74 | |
| 75 | conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'), |
| 76 | description : 'The Dbus busname to own' |
| 77 | ) |
| 78 | conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'), |
| 79 | description : 'The Dump manager Dbus root' |
| 80 | ) |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 81 | conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'), |
| 82 | description : 'The BMC Dump manager Dbus path' |
| 83 | ) |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 84 | conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'), |
| 85 | description : 'Directory where core dumps are placed' |
| 86 | ) |
| 87 | conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'), |
| 88 | description : 'Internal Dump manager Dbus object path' |
| 89 | ) |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 90 | conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'), |
| 91 | description : 'The BMC dump entry DBus object path' |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 92 | ) |
| 93 | conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'), |
| 94 | description : 'Directory where bmc dumps are placed') |
George Liu | ff92ffe | 2021-02-09 15:01:53 +0800 | [diff] [blame] | 95 | conf_data.set_quoted('SYSTEMD_PSTORE_PATH', get_option('SYSTEMD_PSTORE_PATH'), |
| 96 | description : 'Path to the systemd pstore directory') |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 97 | conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'), |
| 98 | description : 'Maximum size of one bmc dump in kilo bytes' |
| 99 | ) |
| 100 | conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'), |
| 101 | description : 'Minimum space required for one bmc dump in kilo bytes' |
| 102 | ) |
| 103 | conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'), |
| 104 | description : 'Total size of the dump in kilo bytes' |
| 105 | ) |
| 106 | conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging', |
| 107 | description : 'The log manager DBus object path' |
| 108 | ) |
| 109 | conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'), |
| 110 | description : 'Path of file for storing elog id\'s, which have associated dumps' |
| 111 | ) |
| 112 | conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'), |
| 113 | description : 'Class version to register with Cereal' |
| 114 | ) |
| 115 | conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'), |
| 116 | description : 'YAML filepath containing error object paths' |
| 117 | ) |
Chirag Sharma | e22aca7 | 2021-01-18 09:55:29 -0600 | [diff] [blame] | 118 | conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(), |
| 119 | description : 'Turn on jffs workaround for core file' |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 120 | ) |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 121 | conf_data.set_quoted('FAULTLOG_DUMP_OBJ_ENTRY', get_option('FAULTLOG_DUMP_OBJ_ENTRY'), |
| 122 | description : 'The Fault Log dump entry DBus object path' |
| 123 | ) |
| 124 | conf_data.set_quoted('FAULTLOG_DUMP_OBJPATH', get_option('FAULTLOG_DUMP_OBJPATH'), |
| 125 | description : 'The Fault Log Dump manager Dbus path' |
| 126 | ) |
| 127 | conf_data.set_quoted('FAULTLOG_DUMP_PATH', get_option('FAULTLOG_DUMP_PATH'), |
| 128 | description : 'Directory where fault logs are placed' |
| 129 | ) |
Xie Ning | fc69f35 | 2022-05-17 16:06:52 +0800 | [diff] [blame] | 130 | conf_data.set('BMC_DUMP_ROTATE_CONFIG', get_option('dump_rotate_config').enabled(), |
| 131 | description : 'Turn on rotate config for bmc dump' |
| 132 | ) |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 133 | |
| 134 | configure_file(configuration : conf_data, |
| 135 | output : 'config.h' |
| 136 | ) |
| 137 | |
| 138 | subdir('xyz/openbmc_project/Dump/Internal/Create') |
| 139 | |
| 140 | python = find_program('python3') |
Patrick Williams | ce83688 | 2021-10-01 16:09:35 -0500 | [diff] [blame] | 141 | errors_map_gen_file_loc = meson.project_source_root() |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 142 | errors_map_gen_file_loc += '/errors_map_gen.py' |
| 143 | |
| 144 | errors_map_hpp = custom_target( |
| 145 | 'errors_map.hpp', |
| 146 | command : [ |
| 147 | python, |
| 148 | errors_map_gen_file_loc, |
| 149 | '-i', |
| 150 | get_option('ERROR_MAP_YAML') |
| 151 | ], |
| 152 | depend_files : [ 'errors_map.mako.hpp', |
| 153 | 'errors_map_gen.py', |
| 154 | get_option('ERROR_MAP_YAML') |
| 155 | ], |
| 156 | output : 'errors_map.hpp' |
| 157 | ) |
| 158 | |
| 159 | phosphor_dump_manager_sources = [ |
| 160 | 'dump_entry.cpp', |
| 161 | 'dump_manager.cpp', |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 162 | 'dump_manager_bmc.cpp', |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 163 | 'dump_manager_main.cpp', |
| 164 | 'dump_serialize.cpp', |
| 165 | 'elog_watch.cpp', |
| 166 | errors_map_hpp, |
| 167 | server_hpp, |
| 168 | server_cpp, |
| 169 | 'watch.cpp', |
| 170 | 'bmc_dump_entry.cpp', |
| 171 | 'dump_utils.cpp', |
Claire Weinan | 919f71c | 2022-03-01 19:02:07 -0800 | [diff] [blame] | 172 | 'dump_offload.cpp', |
| 173 | 'dump_manager_faultlog.cpp', |
| 174 | 'faultlog_dump_entry.cpp', |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 175 | ] |
| 176 | |
| 177 | phosphor_dump_manager_dependency = [ |
George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [diff] [blame] | 178 | phosphor_dbus_interfaces_dep, |
| 179 | sdbusplus_dep, |
| 180 | phosphor_logging_dep, |
Patrick Williams | abbe159 | 2021-10-01 16:04:19 -0500 | [diff] [blame] | 181 | fmt_dep, |
| 182 | cereal_dep, |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 183 | ] |
| 184 | |
| 185 | phosphor_dump_manager_install = true |
| 186 | |
Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 187 | phosphor_dump_manager_incdir = [] |
| 188 | |
Ramesh Iyyar | 131994b | 2020-12-03 08:35:36 -0600 | [diff] [blame] | 189 | # To get host transport based interface to take respective host |
| 190 | # dump actions. It will contain required sources and dependency |
| 191 | # list for phosphor_dump_manager. |
| 192 | subdir('host-transport-extensions') |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 193 | |
Dhruvaraj Subhashchandran | 8b9b469 | 2020-09-24 11:59:42 -0500 | [diff] [blame] | 194 | #pick any architecture specific dumps |
| 195 | subdir('dump-extensions') |
| 196 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 197 | phosphor_dump_monitor_sources = [ |
| 198 | 'core_manager.cpp', |
| 199 | 'core_manager_main.cpp', |
| 200 | 'watch.cpp' |
| 201 | ] |
| 202 | |
| 203 | phosphor_dump_monitor_dependency = [ |
George Liu | 73e0bab | 2021-06-29 15:57:43 +0800 | [diff] [blame] | 204 | phosphor_dbus_interfaces_dep, |
| 205 | phosphor_logging_dep, |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 206 | fmt_dep |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 207 | ] |
| 208 | |
| 209 | phosphor_dump_monitor_install = true |
| 210 | |
Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 211 | phosphor_dump_monitor_incdir = [] |
| 212 | |
George Liu | ff92ffe | 2021-02-09 15:01:53 +0800 | [diff] [blame] | 213 | phosphor_ramoops_monitor_sources = [ |
| 214 | 'ramoops_manager.cpp', |
| 215 | 'ramoops_manager_main.cpp', |
| 216 | 'watch.cpp' |
| 217 | ] |
| 218 | |
| 219 | phosphor_ramoops_monitor_dependency = [ |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 220 | phosphor_dbus_interfaces_dep, |
| 221 | phosphor_logging_dep, |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 222 | fmt_dep |
George Liu | ff92ffe | 2021-02-09 15:01:53 +0800 | [diff] [blame] | 223 | ] |
| 224 | |
| 225 | phosphor_ramoops_monitor_install = true |
| 226 | |
| 227 | phosphor_ramoops_monitor_incdir = [] |
| 228 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 229 | executables = [[ 'phosphor-dump-manager', |
| 230 | phosphor_dump_manager_sources, |
| 231 | phosphor_dump_manager_dependency, |
Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 232 | phosphor_dump_manager_install, |
| 233 | phosphor_dump_manager_incdir |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 234 | ], |
| 235 | [ 'phosphor-dump-monitor', |
| 236 | phosphor_dump_monitor_sources, |
| 237 | phosphor_dump_monitor_dependency, |
Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 238 | phosphor_dump_monitor_install, |
| 239 | phosphor_dump_monitor_incdir |
George Liu | ff92ffe | 2021-02-09 15:01:53 +0800 | [diff] [blame] | 240 | ], |
| 241 | [ 'phosphor-ramoops-monitor', |
| 242 | phosphor_ramoops_monitor_sources, |
| 243 | phosphor_ramoops_monitor_dependency, |
| 244 | phosphor_ramoops_monitor_install, |
| 245 | phosphor_ramoops_monitor_incdir |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 246 | ] |
| 247 | ] |
| 248 | |
| 249 | foreach executable : executables |
| 250 | binary = executable( |
| 251 | executable[0], |
| 252 | executable[1], |
| 253 | dependencies: executable[2], |
Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 254 | install : executable[3], |
| 255 | include_directories : executable[4] |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 256 | ) |
| 257 | endforeach |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 258 | |
Dhruvaraj Subhashchandran | 9f55736 | 2021-05-12 06:28:20 -0500 | [diff] [blame] | 259 | unit_subs = configuration_data() |
| 260 | unit_subs.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) |
| 261 | systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable( |
| 262 | 'systemdsystemunitdir', |
| 263 | define_variable: ['prefix', get_option('prefix')]) |
| 264 | foreach u : unit_files |
| 265 | configure_file( |
| 266 | configuration: unit_subs, |
| 267 | input: u.get('input'), |
| 268 | install: true, |
| 269 | install_dir: systemd_system_unit_dir, |
| 270 | output: u.get('output') |
| 271 | ) |
| 272 | endforeach |
| 273 | |
Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 274 | if get_option('tests').enabled() |
| 275 | subdir('test') |
| 276 | endif |