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