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') |
Allen.Wang | 79b4500 | 2022-02-10 17:59:20 +0800 | [diff] [blame] | 72 | fmt = dependency('fmt') |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 73 | |
| 74 | cppfs = meson.get_compiler('cpp').find_library('stdc++fs') |
| 75 | |
| 76 | executable('phosphor-host-state-manager', |
| 77 | 'host_state_manager.cpp', |
| 78 | 'host_state_manager_main.cpp', |
| 79 | 'settings.cpp', |
Andrew Geissler | 0d1c3f1 | 2021-07-27 16:21:01 -0400 | [diff] [blame] | 80 | 'host_check.cpp', |
Andrew Geissler | 1ab2b6c | 2022-03-10 16:16:15 -0600 | [diff] [blame] | 81 | 'utils.cpp', |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 82 | dependencies: [ |
| 83 | sdbusplus, sdeventplus, phosphorlogging, |
Allen.Wang | 79b4500 | 2022-02-10 17:59:20 +0800 | [diff] [blame] | 84 | phosphordbusinterfaces, cppfs, libgpiod, fmt |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 85 | ], |
| 86 | implicit_include_directories: true, |
| 87 | install: true |
| 88 | ) |
| 89 | |
Andrew Geissler | fe270d3 | 2021-01-27 14:06:46 -0600 | [diff] [blame] | 90 | executable('phosphor-hypervisor-state-manager', |
| 91 | 'hypervisor_state_manager.cpp', |
| 92 | 'hypervisor_state_manager_main.cpp', |
| 93 | 'settings.cpp', |
| 94 | dependencies: [ |
| 95 | sdbusplus, sdeventplus, phosphorlogging, |
| 96 | phosphordbusinterfaces, cppfs |
| 97 | ], |
| 98 | implicit_include_directories: true, |
| 99 | install: true |
| 100 | ) |
| 101 | |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 102 | executable('phosphor-chassis-state-manager', |
| 103 | 'chassis_state_manager.cpp', |
| 104 | 'chassis_state_manager_main.cpp', |
Andrew Geissler | f8ae6a0 | 2022-01-21 17:00:20 -0600 | [diff] [blame] | 105 | 'utils.cpp', |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 106 | dependencies: [ |
| 107 | sdbusplus, sdeventplus, phosphorlogging, |
Potin Lai | 70f36d8 | 2022-03-15 10:25:39 +0800 | [diff] [blame^] | 108 | phosphordbusinterfaces, cppfs, libgpiod, fmt |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 109 | ], |
| 110 | implicit_include_directories: true, |
| 111 | install: true |
| 112 | ) |
| 113 | |
Andrew Geissler | 378fe11 | 2022-02-03 16:39:44 -0600 | [diff] [blame] | 114 | executable('phosphor-chassis-check-power-status', |
| 115 | 'chassis_check_power_status.cpp', |
| 116 | 'utils.cpp', |
| 117 | dependencies: [ |
| 118 | sdbusplus, phosphorlogging, |
| 119 | phosphordbusinterfaces, cppfs, libgpiod |
| 120 | ], |
| 121 | implicit_include_directories: true, |
| 122 | install: true |
| 123 | ) |
| 124 | |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 125 | executable('phosphor-bmc-state-manager', |
| 126 | 'bmc_state_manager.cpp', |
| 127 | 'bmc_state_manager_main.cpp', |
Andrew Geissler | 98e64e6 | 2022-01-25 16:02:56 -0600 | [diff] [blame] | 128 | 'utils.cpp', |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 129 | dependencies: [ |
| 130 | sdbusplus, sdeventplus, phosphorlogging, |
Andrew Geissler | 98e64e6 | 2022-01-25 16:02:56 -0600 | [diff] [blame] | 131 | phosphordbusinterfaces, cppfs, libgpiod |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 132 | ], |
| 133 | implicit_include_directories: true, |
| 134 | install: true |
| 135 | ) |
| 136 | |
| 137 | executable('phosphor-discover-system-state', |
| 138 | 'discover_system_state.cpp', |
| 139 | 'settings.cpp', |
Andrew Geissler | 49e6713 | 2022-01-26 14:27:52 -0600 | [diff] [blame] | 140 | 'utils.cpp', |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 141 | dependencies: [ |
Andrew Geissler | 49e6713 | 2022-01-26 14:27:52 -0600 | [diff] [blame] | 142 | sdbusplus, phosphorlogging, libgpiod |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 143 | ], |
| 144 | implicit_include_directories: true, |
| 145 | install: true |
| 146 | ) |
| 147 | |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 148 | executable('phosphor-systemd-target-monitor', |
Andrew Geissler | 9e3afdf | 2022-02-10 15:06:16 -0600 | [diff] [blame] | 149 | 'systemd_service_parser.cpp', |
Andrew Geissler | f245410 | 2019-12-06 15:14:08 -0600 | [diff] [blame] | 150 | 'systemd_target_monitor.cpp', |
| 151 | 'systemd_target_parser.cpp', |
| 152 | 'systemd_target_signal.cpp', |
| 153 | dependencies: [ |
| 154 | sdbusplus, sdeventplus, phosphorlogging |
| 155 | ], |
| 156 | implicit_include_directories: true, |
| 157 | install: true |
| 158 | ) |
Andrew Geissler | 3f12563 | 2019-12-11 17:08:19 -0600 | [diff] [blame] | 159 | |
Carol Wang | 71230ef | 2020-02-18 17:39:49 +0800 | [diff] [blame] | 160 | executable('phosphor-scheduled-host-transition', |
| 161 | 'scheduled_host_transition_main.cpp', |
| 162 | 'scheduled_host_transition.cpp', |
Carol Wang | dc05939 | 2020-03-13 17:39:17 +0800 | [diff] [blame] | 163 | 'utils.cpp', |
Carol Wang | 71230ef | 2020-02-18 17:39:49 +0800 | [diff] [blame] | 164 | dependencies: [ |
Andrew Geissler | f8ae6a0 | 2022-01-21 17:00:20 -0600 | [diff] [blame] | 165 | sdbusplus, sdeventplus, phosphorlogging, libgpiod |
Carol Wang | 71230ef | 2020-02-18 17:39:49 +0800 | [diff] [blame] | 166 | ], |
| 167 | implicit_include_directories: true, |
| 168 | install: true |
| 169 | ) |
| 170 | |
Andrew Geissler | ba0163a | 2021-08-11 15:09:50 -0400 | [diff] [blame] | 171 | executable('phosphor-host-reset-recovery', |
| 172 | 'host_reset_recovery.cpp', |
| 173 | dependencies: [ |
| 174 | sdbusplus, phosphorlogging |
| 175 | ], |
| 176 | implicit_include_directories: true, |
| 177 | install: true |
| 178 | ) |
| 179 | |
Andrew Geissler | dfa75fc | 2019-12-11 17:26:42 -0600 | [diff] [blame] | 180 | install_data('obmcutil', |
| 181 | install_mode: 'rwxr-xr-x', |
| 182 | install_dir: get_option('bindir') |
| 183 | ) |
| 184 | |
Andrew Geissler | 179d38c | 2019-12-10 15:05:23 -0600 | [diff] [blame] | 185 | systemd = dependency('systemd') |
Andrew Geissler | 429100a | 2021-09-09 12:50:24 -0500 | [diff] [blame] | 186 | systemd_system_unit_dir = systemd.get_variable( |
| 187 | pkgconfig : 'systemdsystemunitdir') |
Andrew Geissler | 179d38c | 2019-12-10 15:05:23 -0600 | [diff] [blame] | 188 | subdir('service_files') |
Andrew Geissler | c101157 | 2020-01-27 15:09:50 -0600 | [diff] [blame] | 189 | subdir('target_files') |
Andrew Geissler | 179d38c | 2019-12-10 15:05:23 -0600 | [diff] [blame] | 190 | |
Thang Tran | ba2241c | 2021-10-26 17:47:09 +0700 | [diff] [blame] | 191 | if build_host_gpios.enabled() |
| 192 | subdir('host_condition_gpio') |
| 193 | endif |
| 194 | |
Andrew Geissler | efef970 | 2019-12-10 16:56:57 -0600 | [diff] [blame] | 195 | datadir = join_paths( |
| 196 | get_option('sysconfdir'), |
| 197 | 'phosphor-systemd-target-monitor' |
| 198 | ) |
| 199 | subdir('data') |
| 200 | |
Andrew Geissler | 3f12563 | 2019-12-11 17:08:19 -0600 | [diff] [blame] | 201 | build_tests = get_option('tests') |
| 202 | |
| 203 | # If test coverage of source files within the root directory are wanted, |
| 204 | # need to define and build the tests from here |
| 205 | if not build_tests.disabled() |
| 206 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
Carol Wang | 4ca6f3f | 2020-02-19 16:28:59 +0800 | [diff] [blame] | 207 | gmock = dependency('gmock', disabler: true, required: build_tests) |
Andrew Geissler | 3f12563 | 2019-12-11 17:08:19 -0600 | [diff] [blame] | 208 | test( |
| 209 | 'test_systemd_parser', |
| 210 | executable('test_systemd_parser', |
| 211 | './test/systemd_parser.cpp', |
| 212 | 'systemd_target_parser.cpp', |
| 213 | dependencies: [ |
| 214 | gtest, |
| 215 | ], |
| 216 | implicit_include_directories: true, |
| 217 | include_directories: '../' |
| 218 | ) |
| 219 | ) |
| 220 | |
| 221 | test( |
| 222 | 'test_systemd_signal', |
| 223 | executable('test_systemd_signal', |
| 224 | './test/systemd_signal.cpp', |
| 225 | 'systemd_target_signal.cpp', |
| 226 | dependencies: [ |
| 227 | gtest, sdbusplus, sdeventplus, phosphorlogging, |
| 228 | ], |
| 229 | implicit_include_directories: true, |
| 230 | include_directories: '../' |
| 231 | ) |
| 232 | ) |
Carol Wang | 4ca6f3f | 2020-02-19 16:28:59 +0800 | [diff] [blame] | 233 | |
| 234 | test( |
| 235 | 'test_scheduled_host_transition', |
| 236 | executable('test_scheduled_host_transition', |
| 237 | './test/test_scheduled_host_transition.cpp', |
| 238 | 'scheduled_host_transition.cpp', |
Carol Wang | dc05939 | 2020-03-13 17:39:17 +0800 | [diff] [blame] | 239 | 'utils.cpp', |
Carol Wang | 4ca6f3f | 2020-02-19 16:28:59 +0800 | [diff] [blame] | 240 | dependencies: [ |
Andrew Geissler | f8ae6a0 | 2022-01-21 17:00:20 -0600 | [diff] [blame] | 241 | gtest, gmock, sdbusplus, sdeventplus, phosphorlogging, libgpiod |
Carol Wang | 4ca6f3f | 2020-02-19 16:28:59 +0800 | [diff] [blame] | 242 | ], |
| 243 | implicit_include_directories: true, |
| 244 | include_directories: '../' |
| 245 | ) |
| 246 | ) |
Andrew Geissler | c74716e | 2021-02-09 15:11:10 -0600 | [diff] [blame] | 247 | |
| 248 | test( |
| 249 | 'test_hypervisor_state', |
| 250 | executable('test_hypervisor_state', |
| 251 | './test/hypervisor_state.cpp', |
| 252 | 'hypervisor_state_manager.cpp', |
| 253 | dependencies: [ |
| 254 | gtest, sdbusplus, sdeventplus, phosphorlogging, |
| 255 | ], |
| 256 | implicit_include_directories: true, |
| 257 | include_directories: '../' |
| 258 | ) |
| 259 | ) |
Andrew Geissler | 3f12563 | 2019-12-11 17:08:19 -0600 | [diff] [blame] | 260 | endif |