blob: 4944c138bad7d023e888b4118d9d89e04d55e4b3 [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',
Andrew Geissler429100a2021-09-09 12:50:24 -05007 'cpp_std=c++20'
Andrew Geisslerf2454102019-12-06 15:14:08 -06008 ],
Andrew Geissler429100a2021-09-09 12:50:24 -05009 meson_version: '>= 0.57.0',
Andrew Geisslerf2454102019-12-06 15:14:08 -060010 license: 'Apache-2.0',
11 version: '0.1',
12)
13
14conf = configuration_data()
15conf.set_quoted(
16 'HOST_BUSNAME', get_option('host-busname'))
17conf.set_quoted(
18 'HOST_OBJPATH', get_option('host-objpath'))
19conf.set_quoted(
Andrew Geisslerfe270d32021-01-27 14:06:46 -060020 'HYPERVISOR_BUSNAME', get_option('hypervisor-busname'))
21conf.set_quoted(
22 'HYPERVISOR_OBJPATH', get_option('hypervisor-objpath'))
23conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060024 'CHASSIS_BUSNAME', get_option('chassis-busname'))
25conf.set_quoted(
26 'CHASSIS_OBJPATH', get_option('chassis-objpath'))
27conf.set_quoted(
28 'BMC_BUSNAME', get_option('bmc-busname'))
29conf.set_quoted(
30 'BMC_OBJPATH', get_option('bmc-objpath'))
31conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060032 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path'))
33conf.set_quoted(
34 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path'))
35conf.set_quoted(
36 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path'))
Carol Wang71230ef2020-02-18 17:39:49 +080037conf.set_quoted(
Carol Wang1dbbef42020-03-09 11:51:23 +080038 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path'))
39conf.set_quoted(
Carol Wang71230ef2020-02-18 17:39:49 +080040 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname'))
Andrew Geisslerf2454102019-12-06 15:14:08 -060041conf.set(
42 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
43conf.set(
44 'CLASS_VERSION', get_option('class-version'))
45
Andrew Geissler343dbf82021-03-16 16:56:09 -050046# globals shared across applications
47conf.set_quoted(
48 'HOST_RUNNING_FILE', '/run/openbmc/host@%d-on')
49
Andrew Geissler5259f972021-08-30 15:46:55 -050050conf.set_quoted(
51 'CHASSIS_ON_FILE', '/run/openbmc/chassis@%d-on')
52
Andrew Geisslerf2454102019-12-06 15:14:08 -060053configure_file(output: 'config.h', configuration: conf)
54
Andrew Geissler7fdad602020-06-22 13:46:16 -050055if(get_option('warm-reboot').enabled())
56 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
57endif
58
Andrew Geisslerf2454102019-12-06 15:14:08 -060059sdbusplus = dependency('sdbusplus')
60sdeventplus = dependency('sdeventplus')
61phosphorlogging = dependency('phosphor-logging')
62phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
63
64cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
65
66executable('phosphor-host-state-manager',
67 'host_state_manager.cpp',
68 'host_state_manager_main.cpp',
69 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040070 'host_check.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060071 dependencies: [
72 sdbusplus, sdeventplus, phosphorlogging,
73 phosphordbusinterfaces, cppfs
74 ],
75 implicit_include_directories: true,
76 install: true
77)
78
Andrew Geisslerfe270d32021-01-27 14:06:46 -060079executable('phosphor-hypervisor-state-manager',
80 'hypervisor_state_manager.cpp',
81 'hypervisor_state_manager_main.cpp',
82 'settings.cpp',
83 dependencies: [
84 sdbusplus, sdeventplus, phosphorlogging,
85 phosphordbusinterfaces, cppfs
86 ],
87 implicit_include_directories: true,
88 install: true
89)
90
Andrew Geisslerf2454102019-12-06 15:14:08 -060091executable('phosphor-chassis-state-manager',
92 'chassis_state_manager.cpp',
93 'chassis_state_manager_main.cpp',
94 dependencies: [
95 sdbusplus, sdeventplus, phosphorlogging,
96 phosphordbusinterfaces, cppfs
97 ],
98 implicit_include_directories: true,
99 install: true
100)
101
102executable('phosphor-bmc-state-manager',
103 'bmc_state_manager.cpp',
104 'bmc_state_manager_main.cpp',
105 dependencies: [
106 sdbusplus, sdeventplus, phosphorlogging,
107 phosphordbusinterfaces, cppfs
108 ],
109 implicit_include_directories: true,
110 install: true
111)
112
113executable('phosphor-discover-system-state',
114 'discover_system_state.cpp',
115 'settings.cpp',
116 dependencies: [
117 sdbusplus, phosphorlogging
118 ],
119 implicit_include_directories: true,
120 install: true
121)
122
Andrew Geisslerf2454102019-12-06 15:14:08 -0600123executable('phosphor-systemd-target-monitor',
124 'systemd_target_monitor.cpp',
125 'systemd_target_parser.cpp',
126 'systemd_target_signal.cpp',
127 dependencies: [
128 sdbusplus, sdeventplus, phosphorlogging
129 ],
130 implicit_include_directories: true,
131 install: true
132)
Andrew Geissler3f125632019-12-11 17:08:19 -0600133
Carol Wang71230ef2020-02-18 17:39:49 +0800134executable('phosphor-scheduled-host-transition',
135 'scheduled_host_transition_main.cpp',
136 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800137 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800138 dependencies: [
139 sdbusplus, sdeventplus, phosphorlogging
140 ],
141 implicit_include_directories: true,
142 install: true
143)
144
Andrew Geisslerba0163a2021-08-11 15:09:50 -0400145executable('phosphor-host-reset-recovery',
146 'host_reset_recovery.cpp',
147 dependencies: [
148 sdbusplus, phosphorlogging
149 ],
150 implicit_include_directories: true,
151 install: true
152)
153
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600154install_data('obmcutil',
155 install_mode: 'rwxr-xr-x',
156 install_dir: get_option('bindir')
157)
158
Andrew Geissler179d38c2019-12-10 15:05:23 -0600159systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500160systemd_system_unit_dir = systemd.get_variable(
161 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600162subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600163subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600164
Andrew Geisslerefef9702019-12-10 16:56:57 -0600165datadir = join_paths(
166 get_option('sysconfdir'),
167 'phosphor-systemd-target-monitor'
168)
169subdir('data')
170
Andrew Geissler3f125632019-12-11 17:08:19 -0600171build_tests = get_option('tests')
172
173# If test coverage of source files within the root directory are wanted,
174# need to define and build the tests from here
175if not build_tests.disabled()
176gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800177gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600178 test(
179 'test_systemd_parser',
180 executable('test_systemd_parser',
181 './test/systemd_parser.cpp',
182 'systemd_target_parser.cpp',
183 dependencies: [
184 gtest,
185 ],
186 implicit_include_directories: true,
187 include_directories: '../'
188 )
189 )
190
191 test(
192 'test_systemd_signal',
193 executable('test_systemd_signal',
194 './test/systemd_signal.cpp',
195 'systemd_target_signal.cpp',
196 dependencies: [
197 gtest, sdbusplus, sdeventplus, phosphorlogging,
198 ],
199 implicit_include_directories: true,
200 include_directories: '../'
201 )
202 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800203
204 test(
205 'test_scheduled_host_transition',
206 executable('test_scheduled_host_transition',
207 './test/test_scheduled_host_transition.cpp',
208 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800209 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800210 dependencies: [
211 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
212 ],
213 implicit_include_directories: true,
214 include_directories: '../'
215 )
216 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600217
218 test(
219 'test_hypervisor_state',
220 executable('test_hypervisor_state',
221 './test/hypervisor_state.cpp',
222 'hypervisor_state_manager.cpp',
223 dependencies: [
224 gtest, sdbusplus, sdeventplus, phosphorlogging,
225 ],
226 implicit_include_directories: true,
227 include_directories: '../'
228 )
229 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600230endif