blob: cf019df229cac69e09a356f2b0b9ccbe5cc0691b [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')
Allen.Wang79b45002022-02-10 17:59:20 +080072fmt = dependency('fmt')
Andrew Geisslerf2454102019-12-06 15:14:08 -060073
74cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
75
76executable('phosphor-host-state-manager',
77 'host_state_manager.cpp',
78 'host_state_manager_main.cpp',
79 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040080 'host_check.cpp',
Andrew Geissler1ab2b6c2022-03-10 16:16:15 -060081 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060082 dependencies: [
83 sdbusplus, sdeventplus, phosphorlogging,
Allen.Wang79b45002022-02-10 17:59:20 +080084 phosphordbusinterfaces, cppfs, libgpiod, fmt
Andrew Geisslerf2454102019-12-06 15:14:08 -060085 ],
86 implicit_include_directories: true,
87 install: true
88)
89
Andrew Geisslerfe270d32021-01-27 14:06:46 -060090executable('phosphor-hypervisor-state-manager',
91 'hypervisor_state_manager.cpp',
92 'hypervisor_state_manager_main.cpp',
93 'settings.cpp',
94 dependencies: [
95 sdbusplus, sdeventplus, phosphorlogging,
96 phosphordbusinterfaces, cppfs
97 ],
98 implicit_include_directories: true,
99 install: true
100)
101
Andrew Geisslerf2454102019-12-06 15:14:08 -0600102executable('phosphor-chassis-state-manager',
103 'chassis_state_manager.cpp',
104 'chassis_state_manager_main.cpp',
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600105 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600106 dependencies: [
107 sdbusplus, sdeventplus, phosphorlogging,
Potin Lai70f36d82022-03-15 10:25:39 +0800108 phosphordbusinterfaces, cppfs, libgpiod, fmt
Andrew Geisslerf2454102019-12-06 15:14:08 -0600109 ],
110 implicit_include_directories: true,
111 install: true
112)
113
Andrew Geissler378fe112022-02-03 16:39:44 -0600114executable('phosphor-chassis-check-power-status',
115 'chassis_check_power_status.cpp',
116 'utils.cpp',
117 dependencies: [
118 sdbusplus, phosphorlogging,
119 phosphordbusinterfaces, cppfs, libgpiod
120 ],
121 implicit_include_directories: true,
122 install: true
123)
124
Andrew Geisslerf2454102019-12-06 15:14:08 -0600125executable('phosphor-bmc-state-manager',
126 'bmc_state_manager.cpp',
127 'bmc_state_manager_main.cpp',
Andrew Geissler98e64e62022-01-25 16:02:56 -0600128 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600129 dependencies: [
130 sdbusplus, sdeventplus, phosphorlogging,
Andrew Geissler98e64e62022-01-25 16:02:56 -0600131 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600132 ],
133 implicit_include_directories: true,
134 install: true
135)
136
137executable('phosphor-discover-system-state',
138 'discover_system_state.cpp',
139 'settings.cpp',
Andrew Geissler49e67132022-01-26 14:27:52 -0600140 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600141 dependencies: [
Andrew Geissler49e67132022-01-26 14:27:52 -0600142 sdbusplus, phosphorlogging, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600143 ],
144 implicit_include_directories: true,
145 install: true
146)
147
Andrew Geisslerf2454102019-12-06 15:14:08 -0600148executable('phosphor-systemd-target-monitor',
Andrew Geissler9e3afdf2022-02-10 15:06:16 -0600149 'systemd_service_parser.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600150 'systemd_target_monitor.cpp',
151 'systemd_target_parser.cpp',
152 'systemd_target_signal.cpp',
153 dependencies: [
154 sdbusplus, sdeventplus, phosphorlogging
155 ],
156 implicit_include_directories: true,
157 install: true
158)
Andrew Geissler3f125632019-12-11 17:08:19 -0600159
Carol Wang71230ef2020-02-18 17:39:49 +0800160executable('phosphor-scheduled-host-transition',
161 'scheduled_host_transition_main.cpp',
162 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800163 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800164 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600165 sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang71230ef2020-02-18 17:39:49 +0800166 ],
167 implicit_include_directories: true,
168 install: true
169)
170
Andrew Geisslerba0163a2021-08-11 15:09:50 -0400171executable('phosphor-host-reset-recovery',
172 'host_reset_recovery.cpp',
173 dependencies: [
174 sdbusplus, phosphorlogging
175 ],
176 implicit_include_directories: true,
177 install: true
178)
179
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600180install_data('obmcutil',
181 install_mode: 'rwxr-xr-x',
182 install_dir: get_option('bindir')
183)
184
Andrew Geissler179d38c2019-12-10 15:05:23 -0600185systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500186systemd_system_unit_dir = systemd.get_variable(
187 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600188subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600189subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600190
Thang Tranba2241c2021-10-26 17:47:09 +0700191if build_host_gpios.enabled()
192 subdir('host_condition_gpio')
193endif
194
Andrew Geisslerefef9702019-12-10 16:56:57 -0600195datadir = join_paths(
196 get_option('sysconfdir'),
197 'phosphor-systemd-target-monitor'
198)
199subdir('data')
200
Andrew Geissler3f125632019-12-11 17:08:19 -0600201build_tests = get_option('tests')
202
203# If test coverage of source files within the root directory are wanted,
204# need to define and build the tests from here
205if not build_tests.disabled()
206gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800207gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600208 test(
209 'test_systemd_parser',
210 executable('test_systemd_parser',
211 './test/systemd_parser.cpp',
212 'systemd_target_parser.cpp',
213 dependencies: [
214 gtest,
215 ],
216 implicit_include_directories: true,
217 include_directories: '../'
218 )
219 )
220
221 test(
222 'test_systemd_signal',
223 executable('test_systemd_signal',
224 './test/systemd_signal.cpp',
225 'systemd_target_signal.cpp',
226 dependencies: [
227 gtest, sdbusplus, sdeventplus, phosphorlogging,
228 ],
229 implicit_include_directories: true,
230 include_directories: '../'
231 )
232 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800233
234 test(
235 'test_scheduled_host_transition',
236 executable('test_scheduled_host_transition',
237 './test/test_scheduled_host_transition.cpp',
238 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800239 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800240 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600241 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800242 ],
243 implicit_include_directories: true,
244 include_directories: '../'
245 )
246 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600247
248 test(
249 'test_hypervisor_state',
250 executable('test_hypervisor_state',
251 './test/hypervisor_state.cpp',
252 'hypervisor_state_manager.cpp',
253 dependencies: [
254 gtest, sdbusplus, sdeventplus, phosphorlogging,
255 ],
256 implicit_include_directories: true,
257 include_directories: '../'
258 )
259 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600260endif