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