1project( 2 'phosphor-ipmi-flash', 3 'cpp', 4 version: '0.1', 5 meson_version: '>=0.57.0', 6 default_options: [ 7 'cpp_std=c++20', 8 'warning_level=3', 9 'werror=true', 10 ]) 11 12root_inc = include_directories('.') 13 14# Setting up config data 15conf_data = configuration_data() 16conf_data.set_quoted('STATIC_HANDLER_STAGED_NAME', get_option('static-handler-staged-name')) 17conf_data.set_quoted('PREPARATION_DBUS_SERVICE', get_option('preparation-dbus-service')) 18conf_data.set_quoted('VERIFY_DBUS_SERVICE', get_option('verify-dbus-service')) 19conf_data.set_quoted('UPDATE_DBUS_SERVICE', get_option('update-dbus-service')) 20conf_data.set_quoted('BIOS_STAGED_NAME', get_option('bios-staged-name')) 21conf_data.set_quoted('PREPARATION_BIOS_TARGET', get_option('preparation-bios-target')) 22conf_data.set_quoted('VERIFY_BIOS_TARGET', get_option('verify-bios-target')) 23conf_data.set_quoted('UPDATE_BIOS_TARGET', get_option('update-bios-target')) 24 25conf_data.set_quoted('TARBALL_STAGED_NAME', get_option('tarball-staged-name')) 26conf_data.set_quoted('HASH_FILENAME', get_option('hash-filename')) 27conf_data.set_quoted('VERIFY_STATUS_FILENAME', get_option('verify-status-filename')) 28conf_data.set_quoted('UPDATE_STATUS_FILENAME', get_option('update-status-filename')) 29conf_data.set_quoted('BIOS_VERIFY_STATUS_FILENAME', get_option('bios-verify-status-filename')) 30conf_data.set('MAPPED_ADDRESS', get_option('mapped-address')) 31 32 33conf_h = configure_file( 34 output: 'config.h', 35 configuration: conf_data) 36 37# Setup for the test config 38if not get_option('tests').disabled() 39 add_project_arguments('-DENABLE_STATIC_LAYOUT', language: 'cpp') 40 add_project_arguments('-DENABLE_TARBALL_UBI', language: 'cpp') 41 add_project_arguments('-DASPEED_P2A', language: 'cpp') 42 add_project_arguments('-DENABLE_PCI_BRIDGE', language: 'cpp') 43 add_project_arguments('-DASPEED_LPC', language: 'cpp') 44 add_project_arguments('-DNUVOTON_LPC', language: 'cpp') 45 add_project_arguments('-DENABLE_LPC_BRIDGE', language: 'cpp') 46 add_project_arguments('-DENABLE_HOST_BIOS', language: 'cpp') 47endif 48 49if get_option('lpc-type') != 'none' 50 add_project_arguments('-DENABLE_LPC_BRIDGE', language: 'cpp') 51endif 52 53# Enable LPC and PCI for tests only. 54assert( 55 not get_option('tests').disabled() \ 56 or get_option('lpc-type') == 'none' \ 57 or get_option('p2a-type') == 'none', 58 'Invalid configuration enabling both PCI and LPC.') 59 60if get_option('p2a-type') != 'none' 61 add_project_arguments('-DENABLE_PCI_BRIDGE', language: 'cpp') 62endif 63 64feature_map = { 65 'host-bios' : '-DENABLE_HOST_BIOS', 66 'ppc' : '-DENABLE_PPC', 67 'reboot-update' : '-DENABLE_REBOOT_UPDATE', 68 'update-status' : '-DENABLE_UPDATE_STATUS', 69 'net-bridge' : '-DENABLE_NET_BRIDGE', 70} 71 72# Get the options status and build a project summary to show which flags are 73# being enabled during the configuration time. 74 75foreach option_key, option_value : feature_map 76 if get_option(option_key) 77 add_project_arguments(option_value, language: 'cpp') 78 summary(option_key, option_value, section : 'Enabled Features') 79 endif 80endforeach 81 82 83update_type_combo_map = { 84 'static-layout' : '-DENABLE_STATIC_LAYOUT', 85 'tarball-ubi' : '-DENABLE_TARBALL_UBI', 86} 87 88foreach option_key, option_value : update_type_combo_map 89 if get_option('update-type') == option_key 90 add_project_arguments(option_value, language: 'cpp') 91 summary(option_key, option_value, section : 'Enabled Firmware Update Features') 92 endif 93endforeach 94 95lpc_type_combo_map = { 96 'aspeed-lpc' : '-DASPEED_LPC', 97 'nuvoton-lpc' : '-DASPEED_LPC', 98} 99 100foreach option_key, option_value : lpc_type_combo_map 101 if get_option('lpc-type') == option_key 102 add_project_arguments(option_value, language: 'cpp') 103 summary(option_key, option_value, section : 'Enabled LPC Features') 104 endif 105endforeach 106 107pci_type_combo_map = { 108 'aspeed-p2a' : '-DASPEED_P2A', 109 'nuvoton-p2a-vga' : '-DNUVOTON_P2A_VGA', 110 'nuvoton-p2a-mbox' : '-DNUVOTON_P2A_MBOX', 111} 112 113foreach option_key, option_value : pci_type_combo_map 114 if get_option('p2a-type') == option_key 115 add_project_arguments(option_value, language: 'cpp') 116 summary(option_key, option_value, section : 'Enabled PCI Features') 117 endif 118endforeach 119 120 121sys_lib = static_library( 122 'sys', 123 'internal/sys.cpp', 124 implicit_include_directories: false) 125 126sys_dep = declare_dependency( 127 link_with: sys_lib) 128 129phosphor_logging_dep = dependency( 130 'phosphor-logging', 131 fallback : [ 132 'phosphor-logging', 133 'phosphor_logging_dep']) 134 135blobs_dep = dependency('phosphor-ipmi-blobs') 136 137if not get_option('tests').disabled() 138 gtest = dependency('gtest', main: true, disabler: true, required: false) 139 gmock = dependency('gmock', disabler: true, required: false) 140 if not gtest.found() or not gmock.found() 141 gtest_opt = import('cmake').subproject_options() 142 gtest_opt.append_compile_args('c++', ['-DCMAKE_CXX_FLAGS=-Wno-pedantic']) 143 gtest_proj = cmake.subproject('googletest', options: gtest_opt, required: false) 144 fmt_depj.dependency('fmt') 145 146 if gtest_proj.found() 147 gtest = declare_dependency( 148 dependencies: [ 149 dependency('threads'), 150 gtest_proj.dependency('gtest'), 151 gtest_proj.dependency('gtest_main'), 152 ]) 153 gmock = gtest_proj.dependency('gmock') 154 endif 155 endif 156endif 157 158 159if not get_option('bmc-blob-handler').disabled() 160 subdir('bmc') 161endif 162 163if not get_option('host-tool').disabled() 164 subdir('tools') 165endif 166 167if not get_option('cleanup-delete').disabled() 168 subdir('cleanup') 169endif 170