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