blob: 9f69d5e41fc9c95aac8f4c73b7234a9e9b3c1685 [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
Thang Tranba2241c2021-10-26 17:47:09 +070014build_host_gpios = get_option('host-gpios')
15
Andrew Geisslerf2454102019-12-06 15:14:08 -060016conf = configuration_data()
17conf.set_quoted(
18 'HOST_BUSNAME', get_option('host-busname'))
19conf.set_quoted(
20 'HOST_OBJPATH', get_option('host-objpath'))
21conf.set_quoted(
Andrew Geisslerfe270d32021-01-27 14:06:46 -060022 'HYPERVISOR_BUSNAME', get_option('hypervisor-busname'))
23conf.set_quoted(
24 'HYPERVISOR_OBJPATH', get_option('hypervisor-objpath'))
25conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060026 'CHASSIS_BUSNAME', get_option('chassis-busname'))
27conf.set_quoted(
28 'CHASSIS_OBJPATH', get_option('chassis-objpath'))
29conf.set_quoted(
30 'BMC_BUSNAME', get_option('bmc-busname'))
31conf.set_quoted(
32 'BMC_OBJPATH', get_option('bmc-objpath'))
33conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060034 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path'))
35conf.set_quoted(
36 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path'))
37conf.set_quoted(
38 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path'))
Carol Wang71230ef2020-02-18 17:39:49 +080039conf.set_quoted(
Carol Wang1dbbef42020-03-09 11:51:23 +080040 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path'))
41conf.set_quoted(
Carol Wang71230ef2020-02-18 17:39:49 +080042 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname'))
Andrew Geisslerf2454102019-12-06 15:14:08 -060043conf.set(
44 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
45conf.set(
46 'CLASS_VERSION', get_option('class-version'))
Thang Tranba2241c2021-10-26 17:47:09 +070047if build_host_gpios.enabled()
48 conf.set_quoted(
49 'HOST_GPIOS_BUSNAME', get_option('host-gpios-busname'))
50 conf.set_quoted(
51 'HOST_GPIOS_OBJPATH', get_option('host-gpios-objpath'))
52endif
Andrew Geisslerf2454102019-12-06 15:14:08 -060053
Andrew Geissler343dbf82021-03-16 16:56:09 -050054# globals shared across applications
55conf.set_quoted(
56 'HOST_RUNNING_FILE', '/run/openbmc/host@%d-on')
57
Andrew Geissler5259f972021-08-30 15:46:55 -050058conf.set_quoted(
59 'CHASSIS_ON_FILE', '/run/openbmc/chassis@%d-on')
60
Andrew Geisslerf2454102019-12-06 15:14:08 -060061configure_file(output: 'config.h', configuration: conf)
62
Andrew Geissler7fdad602020-06-22 13:46:16 -050063if(get_option('warm-reboot').enabled())
64 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
65endif
66
Andrew Geisslerf2454102019-12-06 15:14:08 -060067sdbusplus = dependency('sdbusplus')
68sdeventplus = dependency('sdeventplus')
69phosphorlogging = dependency('phosphor-logging')
70phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
Ben Tyner2c36e5a2021-07-12 14:56:49 -050071libgpiod = dependency('libgpiod', version : '>=1.4.1')
Andrew Geisslerf2454102019-12-06 15:14:08 -060072
73cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
74
75executable('phosphor-host-state-manager',
76 'host_state_manager.cpp',
77 'host_state_manager_main.cpp',
78 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040079 'host_check.cpp',
Andrew Geissler1ab2b6c2022-03-10 16:16:15 -060080 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060081 dependencies: [
82 sdbusplus, sdeventplus, phosphorlogging,
Andrew Geissler1ab2b6c2022-03-10 16:16:15 -060083 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -060084 ],
85 implicit_include_directories: true,
86 install: true
87)
88
Andrew Geisslerfe270d32021-01-27 14:06:46 -060089executable('phosphor-hypervisor-state-manager',
90 'hypervisor_state_manager.cpp',
91 'hypervisor_state_manager_main.cpp',
92 'settings.cpp',
93 dependencies: [
94 sdbusplus, sdeventplus, phosphorlogging,
95 phosphordbusinterfaces, cppfs
96 ],
97 implicit_include_directories: true,
98 install: true
99)
100
Andrew Geisslerf2454102019-12-06 15:14:08 -0600101executable('phosphor-chassis-state-manager',
102 'chassis_state_manager.cpp',
103 'chassis_state_manager_main.cpp',
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600104 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600105 dependencies: [
106 sdbusplus, sdeventplus, phosphorlogging,
Ben Tyner2c36e5a2021-07-12 14:56:49 -0500107 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600108 ],
109 implicit_include_directories: true,
110 install: true
111)
112
Andrew Geissler378fe112022-02-03 16:39:44 -0600113executable('phosphor-chassis-check-power-status',
114 'chassis_check_power_status.cpp',
115 'utils.cpp',
116 dependencies: [
117 sdbusplus, phosphorlogging,
118 phosphordbusinterfaces, cppfs, libgpiod
119 ],
120 implicit_include_directories: true,
121 install: true
122)
123
Andrew Geisslerf2454102019-12-06 15:14:08 -0600124executable('phosphor-bmc-state-manager',
125 'bmc_state_manager.cpp',
126 'bmc_state_manager_main.cpp',
Andrew Geissler98e64e62022-01-25 16:02:56 -0600127 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600128 dependencies: [
129 sdbusplus, sdeventplus, phosphorlogging,
Andrew Geissler98e64e62022-01-25 16:02:56 -0600130 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600131 ],
132 implicit_include_directories: true,
133 install: true
134)
135
136executable('phosphor-discover-system-state',
137 'discover_system_state.cpp',
138 'settings.cpp',
Andrew Geissler49e67132022-01-26 14:27:52 -0600139 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600140 dependencies: [
Andrew Geissler49e67132022-01-26 14:27:52 -0600141 sdbusplus, phosphorlogging, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600142 ],
143 implicit_include_directories: true,
144 install: true
145)
146
Andrew Geisslerf2454102019-12-06 15:14:08 -0600147executable('phosphor-systemd-target-monitor',
Andrew Geissler9e3afdf2022-02-10 15:06:16 -0600148 'systemd_service_parser.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600149 'systemd_target_monitor.cpp',
150 'systemd_target_parser.cpp',
151 'systemd_target_signal.cpp',
152 dependencies: [
153 sdbusplus, sdeventplus, phosphorlogging
154 ],
155 implicit_include_directories: true,
156 install: true
157)
Andrew Geissler3f125632019-12-11 17:08:19 -0600158
Carol Wang71230ef2020-02-18 17:39:49 +0800159executable('phosphor-scheduled-host-transition',
160 'scheduled_host_transition_main.cpp',
161 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800162 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800163 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600164 sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang71230ef2020-02-18 17:39:49 +0800165 ],
166 implicit_include_directories: true,
167 install: true
168)
169
Andrew Geisslerba0163a2021-08-11 15:09:50 -0400170executable('phosphor-host-reset-recovery',
171 'host_reset_recovery.cpp',
172 dependencies: [
173 sdbusplus, phosphorlogging
174 ],
175 implicit_include_directories: true,
176 install: true
177)
178
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600179install_data('obmcutil',
180 install_mode: 'rwxr-xr-x',
181 install_dir: get_option('bindir')
182)
183
Andrew Geissler179d38c2019-12-10 15:05:23 -0600184systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500185systemd_system_unit_dir = systemd.get_variable(
186 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600187subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600188subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600189
Thang Tranba2241c2021-10-26 17:47:09 +0700190if build_host_gpios.enabled()
191 subdir('host_condition_gpio')
192endif
193
Andrew Geisslerefef9702019-12-10 16:56:57 -0600194datadir = join_paths(
195 get_option('sysconfdir'),
196 'phosphor-systemd-target-monitor'
197)
198subdir('data')
199
Andrew Geissler3f125632019-12-11 17:08:19 -0600200build_tests = get_option('tests')
201
202# If test coverage of source files within the root directory are wanted,
203# need to define and build the tests from here
204if not build_tests.disabled()
205gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800206gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600207 test(
208 'test_systemd_parser',
209 executable('test_systemd_parser',
210 './test/systemd_parser.cpp',
211 'systemd_target_parser.cpp',
212 dependencies: [
213 gtest,
214 ],
215 implicit_include_directories: true,
216 include_directories: '../'
217 )
218 )
219
220 test(
221 'test_systemd_signal',
222 executable('test_systemd_signal',
223 './test/systemd_signal.cpp',
224 'systemd_target_signal.cpp',
225 dependencies: [
226 gtest, sdbusplus, sdeventplus, phosphorlogging,
227 ],
228 implicit_include_directories: true,
229 include_directories: '../'
230 )
231 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800232
233 test(
234 'test_scheduled_host_transition',
235 executable('test_scheduled_host_transition',
236 './test/test_scheduled_host_transition.cpp',
237 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800238 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800239 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600240 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800241 ],
242 implicit_include_directories: true,
243 include_directories: '../'
244 )
245 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600246
247 test(
248 'test_hypervisor_state',
249 executable('test_hypervisor_state',
250 './test/hypervisor_state.cpp',
251 'hypervisor_state_manager.cpp',
252 dependencies: [
253 gtest, sdbusplus, sdeventplus, phosphorlogging,
254 ],
255 implicit_include_directories: true,
256 include_directories: '../'
257 )
258 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600259endif