1project( 2 'phosphor-state-manager', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++20' 8 ], 9 meson_version: '>= 0.57.0', 10 license: 'Apache-2.0', 11 version: '0.1', 12) 13 14build_host_gpios = get_option('host-gpios') 15 16conf = configuration_data() 17conf.set_quoted( 18 'HOST_BUSNAME', get_option('host-busname')) 19conf.set_quoted( 20 'HOST_OBJPATH', get_option('host-objpath')) 21conf.set_quoted( 22 'HYPERVISOR_BUSNAME', get_option('hypervisor-busname')) 23conf.set_quoted( 24 'HYPERVISOR_OBJPATH', get_option('hypervisor-objpath')) 25conf.set_quoted( 26 'CHASSIS_BUSNAME', get_option('chassis-busname')) 27conf.set_quoted( 28 'CHASSIS_OBJPATH', get_option('chassis-objpath')) 29conf.set_quoted( 30 'BMC_BUSNAME', get_option('bmc-busname')) 31conf.set_quoted( 32 'BMC_OBJPATH', get_option('bmc-objpath')) 33conf.set_quoted( 34 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path')) 35conf.set_quoted( 36 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path')) 37conf.set_quoted( 38 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path')) 39conf.set_quoted( 40 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path')) 41conf.set_quoted( 42 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname')) 43conf.set( 44 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed')) 45conf.set( 46 'CLASS_VERSION', get_option('class-version')) 47if build_host_gpios.enabled() 48 conf.set_quoted( 49 'HOST_GPIOS_BUSNAME', get_option('host-gpios-busname')) 50 conf.set_quoted( 51 'HOST_GPIOS_OBJPATH', get_option('host-gpios-objpath')) 52endif 53 54# globals shared across applications 55conf.set_quoted( 56 'HOST_RUNNING_FILE', '/run/openbmc/host@%d-on') 57 58conf.set_quoted( 59 'CHASSIS_ON_FILE', '/run/openbmc/chassis@%d-on') 60 61configure_file(output: 'config.h', configuration: conf) 62 63if(get_option('warm-reboot').enabled()) 64 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp') 65endif 66 67sdbusplus = dependency('sdbusplus') 68sdeventplus = dependency('sdeventplus') 69phosphorlogging = dependency('phosphor-logging') 70phosphordbusinterfaces = dependency('phosphor-dbus-interfaces') 71libgpiod = dependency('libgpiod', version : '>=1.4.1') 72 73cppfs = meson.get_compiler('cpp').find_library('stdc++fs') 74 75executable('phosphor-host-state-manager', 76 'host_state_manager.cpp', 77 'host_state_manager_main.cpp', 78 'settings.cpp', 79 'host_check.cpp', 80 dependencies: [ 81 sdbusplus, sdeventplus, phosphorlogging, 82 phosphordbusinterfaces, cppfs 83 ], 84 implicit_include_directories: true, 85 install: true 86) 87 88executable('phosphor-hypervisor-state-manager', 89 'hypervisor_state_manager.cpp', 90 'hypervisor_state_manager_main.cpp', 91 'settings.cpp', 92 dependencies: [ 93 sdbusplus, sdeventplus, phosphorlogging, 94 phosphordbusinterfaces, cppfs 95 ], 96 implicit_include_directories: true, 97 install: true 98) 99 100executable('phosphor-chassis-state-manager', 101 'chassis_state_manager.cpp', 102 'chassis_state_manager_main.cpp', 103 dependencies: [ 104 sdbusplus, sdeventplus, phosphorlogging, 105 phosphordbusinterfaces, cppfs, libgpiod 106 ], 107 implicit_include_directories: true, 108 install: true 109) 110 111executable('phosphor-bmc-state-manager', 112 'bmc_state_manager.cpp', 113 'bmc_state_manager_main.cpp', 114 dependencies: [ 115 sdbusplus, sdeventplus, phosphorlogging, 116 phosphordbusinterfaces, cppfs 117 ], 118 implicit_include_directories: true, 119 install: true 120) 121 122executable('phosphor-discover-system-state', 123 'discover_system_state.cpp', 124 'settings.cpp', 125 dependencies: [ 126 sdbusplus, phosphorlogging 127 ], 128 implicit_include_directories: true, 129 install: true 130) 131 132executable('phosphor-systemd-target-monitor', 133 'systemd_target_monitor.cpp', 134 'systemd_target_parser.cpp', 135 'systemd_target_signal.cpp', 136 dependencies: [ 137 sdbusplus, sdeventplus, phosphorlogging 138 ], 139 implicit_include_directories: true, 140 install: true 141) 142 143executable('phosphor-scheduled-host-transition', 144 'scheduled_host_transition_main.cpp', 145 'scheduled_host_transition.cpp', 146 'utils.cpp', 147 dependencies: [ 148 sdbusplus, sdeventplus, phosphorlogging 149 ], 150 implicit_include_directories: true, 151 install: true 152) 153 154executable('phosphor-host-reset-recovery', 155 'host_reset_recovery.cpp', 156 dependencies: [ 157 sdbusplus, phosphorlogging 158 ], 159 implicit_include_directories: true, 160 install: true 161) 162 163install_data('obmcutil', 164 install_mode: 'rwxr-xr-x', 165 install_dir: get_option('bindir') 166) 167 168systemd = dependency('systemd') 169systemd_system_unit_dir = systemd.get_variable( 170 pkgconfig : 'systemdsystemunitdir') 171subdir('service_files') 172subdir('target_files') 173 174if build_host_gpios.enabled() 175 subdir('host_condition_gpio') 176endif 177 178datadir = join_paths( 179 get_option('sysconfdir'), 180 'phosphor-systemd-target-monitor' 181) 182subdir('data') 183 184build_tests = get_option('tests') 185 186# If test coverage of source files within the root directory are wanted, 187# need to define and build the tests from here 188if not build_tests.disabled() 189gtest = dependency('gtest', main: true, disabler: true, required: build_tests) 190gmock = dependency('gmock', disabler: true, required: build_tests) 191 test( 192 'test_systemd_parser', 193 executable('test_systemd_parser', 194 './test/systemd_parser.cpp', 195 'systemd_target_parser.cpp', 196 dependencies: [ 197 gtest, 198 ], 199 implicit_include_directories: true, 200 include_directories: '../' 201 ) 202 ) 203 204 test( 205 'test_systemd_signal', 206 executable('test_systemd_signal', 207 './test/systemd_signal.cpp', 208 'systemd_target_signal.cpp', 209 dependencies: [ 210 gtest, sdbusplus, sdeventplus, phosphorlogging, 211 ], 212 implicit_include_directories: true, 213 include_directories: '../' 214 ) 215 ) 216 217 test( 218 'test_scheduled_host_transition', 219 executable('test_scheduled_host_transition', 220 './test/test_scheduled_host_transition.cpp', 221 'scheduled_host_transition.cpp', 222 'utils.cpp', 223 dependencies: [ 224 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging, 225 ], 226 implicit_include_directories: true, 227 include_directories: '../' 228 ) 229 ) 230 231 test( 232 'test_hypervisor_state', 233 executable('test_hypervisor_state', 234 './test/hypervisor_state.cpp', 235 'hypervisor_state_manager.cpp', 236 dependencies: [ 237 gtest, sdbusplus, sdeventplus, phosphorlogging, 238 ], 239 implicit_include_directories: true, 240 include_directories: '../' 241 ) 242 ) 243endif 244