blob: 0d88e4f02ef9cbf60c0f12d46124667967dbadbf [file] [log] [blame]
Andrew Geisslerf2454102019-12-06 15:14:08 -06001project(
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(
Andrew Geisslerfe270d32021-01-27 14:06:46 -060019 'HYPERVISOR_BUSNAME', get_option('hypervisor-busname'))
20conf.set_quoted(
21 'HYPERVISOR_OBJPATH', get_option('hypervisor-objpath'))
22conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060023 'CHASSIS_BUSNAME', get_option('chassis-busname'))
24conf.set_quoted(
25 'CHASSIS_OBJPATH', get_option('chassis-objpath'))
26conf.set_quoted(
27 'BMC_BUSNAME', get_option('bmc-busname'))
28conf.set_quoted(
29 'BMC_OBJPATH', get_option('bmc-objpath'))
30conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060031 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path'))
32conf.set_quoted(
33 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path'))
34conf.set_quoted(
35 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path'))
Carol Wang71230ef2020-02-18 17:39:49 +080036conf.set_quoted(
Carol Wang1dbbef42020-03-09 11:51:23 +080037 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path'))
38conf.set_quoted(
Carol Wang71230ef2020-02-18 17:39:49 +080039 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname'))
Andrew Geisslerf2454102019-12-06 15:14:08 -060040conf.set(
41 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
42conf.set(
43 'CLASS_VERSION', get_option('class-version'))
44
Andrew Geissler343dbf82021-03-16 16:56:09 -050045# globals shared across applications
46conf.set_quoted(
47 'HOST_RUNNING_FILE', '/run/openbmc/host@%d-on')
48
Andrew Geisslerf2454102019-12-06 15:14:08 -060049configure_file(output: 'config.h', configuration: conf)
50
Andrew Geissler7fdad602020-06-22 13:46:16 -050051if(get_option('warm-reboot').enabled())
52 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
53endif
54
Andrew Geisslerf2454102019-12-06 15:14:08 -060055sdbusplus = dependency('sdbusplus')
56sdeventplus = dependency('sdeventplus')
57phosphorlogging = dependency('phosphor-logging')
58phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
59
60cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
61
62executable('phosphor-host-state-manager',
63 'host_state_manager.cpp',
64 'host_state_manager_main.cpp',
65 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040066 'host_check.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060067 dependencies: [
68 sdbusplus, sdeventplus, phosphorlogging,
69 phosphordbusinterfaces, cppfs
70 ],
71 implicit_include_directories: true,
72 install: true
73)
74
Andrew Geisslerfe270d32021-01-27 14:06:46 -060075executable('phosphor-hypervisor-state-manager',
76 'hypervisor_state_manager.cpp',
77 'hypervisor_state_manager_main.cpp',
78 'settings.cpp',
79 dependencies: [
80 sdbusplus, sdeventplus, phosphorlogging,
81 phosphordbusinterfaces, cppfs
82 ],
83 implicit_include_directories: true,
84 install: true
85)
86
Andrew Geisslerf2454102019-12-06 15:14:08 -060087executable('phosphor-chassis-state-manager',
88 'chassis_state_manager.cpp',
89 'chassis_state_manager_main.cpp',
90 dependencies: [
91 sdbusplus, sdeventplus, phosphorlogging,
92 phosphordbusinterfaces, cppfs
93 ],
94 implicit_include_directories: true,
95 install: true
96)
97
98executable('phosphor-bmc-state-manager',
99 'bmc_state_manager.cpp',
100 'bmc_state_manager_main.cpp',
101 dependencies: [
102 sdbusplus, sdeventplus, phosphorlogging,
103 phosphordbusinterfaces, cppfs
104 ],
105 implicit_include_directories: true,
106 install: true
107)
108
109executable('phosphor-discover-system-state',
110 'discover_system_state.cpp',
111 'settings.cpp',
112 dependencies: [
113 sdbusplus, phosphorlogging
114 ],
115 implicit_include_directories: true,
116 install: true
117)
118
Andrew Geisslerf2454102019-12-06 15:14:08 -0600119executable('phosphor-systemd-target-monitor',
120 'systemd_target_monitor.cpp',
121 'systemd_target_parser.cpp',
122 'systemd_target_signal.cpp',
123 dependencies: [
124 sdbusplus, sdeventplus, phosphorlogging
125 ],
126 implicit_include_directories: true,
127 install: true
128)
Andrew Geissler3f125632019-12-11 17:08:19 -0600129
Carol Wang71230ef2020-02-18 17:39:49 +0800130executable('phosphor-scheduled-host-transition',
131 'scheduled_host_transition_main.cpp',
132 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800133 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800134 dependencies: [
135 sdbusplus, sdeventplus, phosphorlogging
136 ],
137 implicit_include_directories: true,
138 install: true
139)
140
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600141install_data('obmcutil',
142 install_mode: 'rwxr-xr-x',
143 install_dir: get_option('bindir')
144)
145
Andrew Geissler179d38c2019-12-10 15:05:23 -0600146systemd = dependency('systemd')
147systemd_system_unit_dir = systemd.get_pkgconfig_variable(
148 'systemdsystemunitdir',
149 define_variable: ['prefix', get_option('prefix')])
150subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600151subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600152
Andrew Geisslerefef9702019-12-10 16:56:57 -0600153datadir = join_paths(
154 get_option('sysconfdir'),
155 'phosphor-systemd-target-monitor'
156)
157subdir('data')
158
Andrew Geissler3f125632019-12-11 17:08:19 -0600159build_tests = get_option('tests')
160
161# If test coverage of source files within the root directory are wanted,
162# need to define and build the tests from here
163if not build_tests.disabled()
164gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800165gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600166 test(
167 'test_systemd_parser',
168 executable('test_systemd_parser',
169 './test/systemd_parser.cpp',
170 'systemd_target_parser.cpp',
171 dependencies: [
172 gtest,
173 ],
174 implicit_include_directories: true,
175 include_directories: '../'
176 )
177 )
178
179 test(
180 'test_systemd_signal',
181 executable('test_systemd_signal',
182 './test/systemd_signal.cpp',
183 'systemd_target_signal.cpp',
184 dependencies: [
185 gtest, sdbusplus, sdeventplus, phosphorlogging,
186 ],
187 implicit_include_directories: true,
188 include_directories: '../'
189 )
190 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800191
192 test(
193 'test_scheduled_host_transition',
194 executable('test_scheduled_host_transition',
195 './test/test_scheduled_host_transition.cpp',
196 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800197 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800198 dependencies: [
199 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
200 ],
201 implicit_include_directories: true,
202 include_directories: '../'
203 )
204 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600205
206 test(
207 'test_hypervisor_state',
208 executable('test_hypervisor_state',
209 './test/hypervisor_state.cpp',
210 'hypervisor_state_manager.cpp',
211 dependencies: [
212 gtest, sdbusplus, sdeventplus, phosphorlogging,
213 ],
214 implicit_include_directories: true,
215 include_directories: '../'
216 )
217 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600218endif