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