1project( 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 13conf = configuration_data() 14conf.set_quoted( 15 'HOST_BUSNAME', get_option('host-busname')) 16conf.set_quoted( 17 'HOST_OBJPATH', get_option('host-objpath')) 18conf.set_quoted( 19 'CHASSIS_BUSNAME', get_option('chassis-busname')) 20conf.set_quoted( 21 'CHASSIS_OBJPATH', get_option('chassis-objpath')) 22conf.set_quoted( 23 'BMC_BUSNAME', get_option('bmc-busname')) 24conf.set_quoted( 25 'BMC_OBJPATH', get_option('bmc-objpath')) 26conf.set_quoted( 27 'HOST_RUNNING_FILE', get_option('host-running-file')) 28conf.set_quoted( 29 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path')) 30conf.set_quoted( 31 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path')) 32conf.set_quoted( 33 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path')) 34conf.set_quoted( 35 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname')) 36conf.set( 37 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed')) 38conf.set( 39 'CLASS_VERSION', get_option('class-version')) 40 41configure_file(output: 'config.h', configuration: conf) 42 43sdbusplus = dependency('sdbusplus') 44sdeventplus = dependency('sdeventplus') 45phosphorlogging = dependency('phosphor-logging') 46phosphordbusinterfaces = dependency('phosphor-dbus-interfaces') 47 48cppfs = meson.get_compiler('cpp').find_library('stdc++fs') 49 50executable('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 62executable('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 73executable('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 84executable('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 94executable('phosphor-host-check', 95 'host_check_main.cpp', 96 dependencies: [ 97 sdbusplus, phosphorlogging 98 ], 99 implicit_include_directories: true, 100 install: true 101) 102 103executable('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) 113 114executable('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 124install_data('obmcutil', 125 install_mode: 'rwxr-xr-x', 126 install_dir: get_option('bindir') 127) 128 129systemd = dependency('systemd') 130systemd_system_unit_dir = systemd.get_pkgconfig_variable( 131 'systemdsystemunitdir', 132 define_variable: ['prefix', get_option('prefix')]) 133subdir('service_files') 134subdir('target_files') 135 136datadir = join_paths( 137 get_option('sysconfdir'), 138 'phosphor-systemd-target-monitor' 139) 140subdir('data') 141 142build_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 146if not build_tests.disabled() 147gtest = dependency('gtest', main: true, disabler: true, required: build_tests) 148gmock = dependency('gmock', disabler: true, required: build_tests) 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 ) 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 ) 187endif 188