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