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