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