| 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') | 
|  | 19 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') | 
|  | 20 | sdbusplus = dependency('sdbusplus') | 
|  | 21 | phosphor_logging = dependency('phosphor-logging') | 
|  | 22 |  | 
| PriyangaRamasamy | 01c6646 | 2021-02-23 05:46:25 -0600 | [diff] [blame] | 23 | # Disable FORTIFY_SOURCE when compiling with no optimization | 
|  | 24 | if(get_option('optimization') == '0') | 
|  | 25 | add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c']) | 
|  | 26 | message('Disabling FORTIFY_SOURCE as optimization is set to 0') | 
|  | 27 | endif | 
|  | 28 |  | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 29 | # Configuration header file(config.h) generation | 
|  | 30 |  | 
|  | 31 | conf_data = configuration_data() | 
|  | 32 |  | 
|  | 33 | conf_data.set_quoted('DUMP_BUSNAME', get_option('DUMP_BUSNAME'), | 
|  | 34 | description : 'The Dbus busname to own' | 
|  | 35 | ) | 
|  | 36 | conf_data.set_quoted('DUMP_OBJPATH', get_option('DUMP_OBJPATH'), | 
|  | 37 | description : 'The Dump manager Dbus root' | 
|  | 38 | ) | 
| Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 39 | conf_data.set_quoted('BMC_DUMP_OBJPATH', get_option('BMC_DUMP_OBJPATH'), | 
|  | 40 | description : 'The BMC Dump manager Dbus path' | 
|  | 41 | ) | 
|  | 42 | conf_data.set_quoted('SYSTEM_DUMP_OBJPATH', get_option('SYSTEM_DUMP_OBJPATH'), | 
|  | 43 | description : 'The system Dump manager Dbus path' | 
|  | 44 | ) | 
| Dhruvaraj Subhashchandran | 62337a9 | 2020-11-22 21:24:30 -0600 | [diff] [blame] | 45 | conf_data.set_quoted('RESOURCE_DUMP_OBJPATH', get_option('RESOURCE_DUMP_OBJPATH'), | 
|  | 46 | description : 'The resource Dump manager Dbus path' | 
|  | 47 | ) | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 48 | conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'), | 
|  | 49 | description : 'Directory where core dumps are placed' | 
|  | 50 | ) | 
|  | 51 | conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'), | 
|  | 52 | description : 'Internal Dump manager Dbus object path' | 
|  | 53 | ) | 
| Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 54 | conf_data.set_quoted('SYSTEM_DUMP_OBJ_ENTRY', get_option('SYSTEM_DUMP_OBJ_ENTRY'), | 
|  | 55 | description : 'The system dump entry DBus object path' | 
|  | 56 | ) | 
| Dhruvaraj Subhashchandran | 62337a9 | 2020-11-22 21:24:30 -0600 | [diff] [blame] | 57 | conf_data.set_quoted('RESOURCE_DUMP_OBJ_ENTRY', get_option('RESOURCE_DUMP_OBJ_ENTRY'), | 
|  | 58 | description : 'The resource dump entry DBus object path' | 
|  | 59 | ) | 
| Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 60 | conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'), | 
|  | 61 | description : 'The BMC dump entry DBus object path' | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 62 | ) | 
|  | 63 | conf_data.set_quoted('BMC_DUMP_PATH', get_option('BMC_DUMP_PATH'), | 
|  | 64 | description : 'Directory where bmc dumps are placed') | 
|  | 65 | conf_data.set('BMC_DUMP_MAX_SIZE', get_option('BMC_DUMP_MAX_SIZE'), | 
|  | 66 | description : 'Maximum size of one bmc dump in kilo bytes' | 
|  | 67 | ) | 
|  | 68 | conf_data.set('BMC_DUMP_MIN_SPACE_REQD', get_option('BMC_DUMP_MIN_SPACE_REQD'), | 
|  | 69 | description : 'Minimum space required for one bmc dump in kilo bytes' | 
|  | 70 | ) | 
|  | 71 | conf_data.set('BMC_DUMP_TOTAL_SIZE', get_option('BMC_DUMP_TOTAL_SIZE'), | 
|  | 72 | description : 'Total size of the dump in kilo bytes' | 
|  | 73 | ) | 
|  | 74 | conf_data.set_quoted('OBJ_LOGGING', '/xyz/openbmc_project/logging', | 
|  | 75 | description : 'The log manager DBus object path' | 
|  | 76 | ) | 
|  | 77 | conf_data.set_quoted('ELOG_ID_PERSIST_PATH', get_option('ELOG_ID_PERSIST_PATH'), | 
|  | 78 | description : 'Path of file for storing elog id\'s, which have associated dumps' | 
|  | 79 | ) | 
|  | 80 | conf_data.set('CLASS_VERSION', get_option('CLASS_VERSION'), | 
|  | 81 | description : 'Class version to register with Cereal' | 
|  | 82 | ) | 
|  | 83 | conf_data.set('ERROR_MAP_YAML', get_option('ERROR_MAP_YAML'), | 
|  | 84 | description : 'YAML filepath containing error object paths' | 
|  | 85 | ) | 
| Chirag Sharma | e22aca7 | 2021-01-18 09:55:29 -0600 | [diff] [blame] | 86 | conf_data.set('JFFS_CORE_FILE_WORKAROUND', get_option('jffs-workaround').enabled(), | 
|  | 87 | description : 'Turn on jffs workaround for core file' | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 88 | ) | 
|  | 89 |  | 
|  | 90 | configure_file(configuration : conf_data, | 
|  | 91 | output : 'config.h' | 
|  | 92 | ) | 
|  | 93 |  | 
|  | 94 | subdir('xyz/openbmc_project/Dump/Internal/Create') | 
|  | 95 |  | 
|  | 96 | python = find_program('python3') | 
|  | 97 | errors_map_gen_file_loc = meson.source_root() | 
|  | 98 | errors_map_gen_file_loc += '/errors_map_gen.py' | 
|  | 99 |  | 
|  | 100 | errors_map_hpp = custom_target( | 
|  | 101 | 'errors_map.hpp', | 
|  | 102 | command : [ | 
|  | 103 | python, | 
|  | 104 | errors_map_gen_file_loc, | 
|  | 105 | '-i', | 
|  | 106 | get_option('ERROR_MAP_YAML') | 
|  | 107 | ], | 
|  | 108 | depend_files : [ 'errors_map.mako.hpp', | 
|  | 109 | 'errors_map_gen.py', | 
|  | 110 | get_option('ERROR_MAP_YAML') | 
|  | 111 | ], | 
|  | 112 | output : 'errors_map.hpp' | 
|  | 113 | ) | 
|  | 114 |  | 
|  | 115 | phosphor_dump_manager_sources = [ | 
|  | 116 | 'dump_entry.cpp', | 
|  | 117 | 'dump_manager.cpp', | 
| Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 118 | 'dump_manager_bmc.cpp', | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 119 | 'dump_manager_main.cpp', | 
|  | 120 | 'dump_serialize.cpp', | 
|  | 121 | 'elog_watch.cpp', | 
|  | 122 | errors_map_hpp, | 
|  | 123 | server_hpp, | 
|  | 124 | server_cpp, | 
|  | 125 | 'watch.cpp', | 
|  | 126 | 'bmc_dump_entry.cpp', | 
|  | 127 | 'dump_utils.cpp', | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 128 | 'dump_offload.cpp' | 
|  | 129 | ] | 
|  | 130 |  | 
|  | 131 | phosphor_dump_manager_dependency = [ | 
|  | 132 | phosphor_dbus_interfaces, | 
|  | 133 | sdbusplus, | 
|  | 134 | phosphor_logging, | 
|  | 135 | cppfs | 
|  | 136 | ] | 
|  | 137 |  | 
|  | 138 | phosphor_dump_manager_install = true | 
|  | 139 |  | 
| Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 140 | phosphor_dump_manager_incdir = [] | 
|  | 141 |  | 
| Ramesh Iyyar | 131994b | 2020-12-03 08:35:36 -0600 | [diff] [blame] | 142 | # To get host transport based interface to take respective host | 
|  | 143 | # dump actions. It will contain required sources and dependency | 
|  | 144 | # list for phosphor_dump_manager. | 
|  | 145 | subdir('host-transport-extensions') | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 146 |  | 
| Dhruvaraj Subhashchandran | 8b9b469 | 2020-09-24 11:59:42 -0500 | [diff] [blame] | 147 | #pick any architecture specific dumps | 
|  | 148 | subdir('dump-extensions') | 
|  | 149 |  | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 150 | phosphor_dump_monitor_sources = [ | 
|  | 151 | 'core_manager.cpp', | 
|  | 152 | 'core_manager_main.cpp', | 
|  | 153 | 'watch.cpp' | 
|  | 154 | ] | 
|  | 155 |  | 
|  | 156 | phosphor_dump_monitor_dependency = [ | 
|  | 157 | phosphor_dbus_interfaces, | 
|  | 158 | phosphor_logging, | 
|  | 159 | cppfs | 
|  | 160 | ] | 
|  | 161 |  | 
|  | 162 | phosphor_dump_monitor_install = true | 
|  | 163 |  | 
| Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 164 | phosphor_dump_monitor_incdir = [] | 
|  | 165 |  | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 166 | executables = [[ 'phosphor-dump-manager', | 
|  | 167 | phosphor_dump_manager_sources, | 
|  | 168 | phosphor_dump_manager_dependency, | 
| Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 169 | phosphor_dump_manager_install, | 
|  | 170 | phosphor_dump_manager_incdir | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 171 | ], | 
|  | 172 | [ 'phosphor-dump-monitor', | 
|  | 173 | phosphor_dump_monitor_sources, | 
|  | 174 | phosphor_dump_monitor_dependency, | 
| Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 175 | phosphor_dump_monitor_install, | 
|  | 176 | phosphor_dump_monitor_incdir | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 177 | ] | 
|  | 178 | ] | 
|  | 179 |  | 
|  | 180 | foreach executable : executables | 
|  | 181 | binary = executable( | 
|  | 182 | executable[0], | 
|  | 183 | executable[1], | 
|  | 184 | dependencies: executable[2], | 
| Ramesh Iyyar | 3af5c32 | 2020-12-04 00:38:42 -0600 | [diff] [blame] | 185 | install : executable[3], | 
|  | 186 | include_directories : executable[4] | 
| Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 187 | ) | 
|  | 188 | endforeach | 
| Chirag Sharma | 5042725 | 2020-08-11 12:11:38 -0500 | [diff] [blame] | 189 |  | 
|  | 190 | if get_option('tests').enabled() | 
|  | 191 | subdir('test') | 
|  | 192 | endif |