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