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