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