blob: 9dad57f66c7440e289156c600509730c00261580 [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 Geisslerf2454102019-12-06 15:14:08 -060080 dependencies: [
81 sdbusplus, sdeventplus, phosphorlogging,
82 phosphordbusinterfaces, cppfs
83 ],
84 implicit_include_directories: true,
85 install: true
86)
87
Andrew Geisslerfe270d32021-01-27 14:06:46 -060088executable('phosphor-hypervisor-state-manager',
89 'hypervisor_state_manager.cpp',
90 'hypervisor_state_manager_main.cpp',
91 'settings.cpp',
92 dependencies: [
93 sdbusplus, sdeventplus, phosphorlogging,
94 phosphordbusinterfaces, cppfs
95 ],
96 implicit_include_directories: true,
97 install: true
98)
99
Andrew Geisslerf2454102019-12-06 15:14:08 -0600100executable('phosphor-chassis-state-manager',
101 'chassis_state_manager.cpp',
102 'chassis_state_manager_main.cpp',
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600103 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600104 dependencies: [
105 sdbusplus, sdeventplus, phosphorlogging,
Ben Tyner2c36e5a2021-07-12 14:56:49 -0500106 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600107 ],
108 implicit_include_directories: true,
109 install: true
110)
111
112executable('phosphor-bmc-state-manager',
113 'bmc_state_manager.cpp',
114 'bmc_state_manager_main.cpp',
Andrew Geissler98e64e62022-01-25 16:02:56 -0600115 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600116 dependencies: [
117 sdbusplus, sdeventplus, phosphorlogging,
Andrew Geissler98e64e62022-01-25 16:02:56 -0600118 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600119 ],
120 implicit_include_directories: true,
121 install: true
122)
123
124executable('phosphor-discover-system-state',
125 'discover_system_state.cpp',
126 'settings.cpp',
Andrew Geissler49e67132022-01-26 14:27:52 -0600127 'utils.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -0600128 dependencies: [
Andrew Geissler49e67132022-01-26 14:27:52 -0600129 sdbusplus, phosphorlogging, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -0600130 ],
131 implicit_include_directories: true,
132 install: true
133)
134
Andrew Geisslerf2454102019-12-06 15:14:08 -0600135executable('phosphor-systemd-target-monitor',
136 'systemd_target_monitor.cpp',
137 'systemd_target_parser.cpp',
138 'systemd_target_signal.cpp',
139 dependencies: [
140 sdbusplus, sdeventplus, phosphorlogging
141 ],
142 implicit_include_directories: true,
143 install: true
144)
Andrew Geissler3f125632019-12-11 17:08:19 -0600145
Carol Wang71230ef2020-02-18 17:39:49 +0800146executable('phosphor-scheduled-host-transition',
147 'scheduled_host_transition_main.cpp',
148 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800149 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800150 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600151 sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang71230ef2020-02-18 17:39:49 +0800152 ],
153 implicit_include_directories: true,
154 install: true
155)
156
Andrew Geisslerba0163a2021-08-11 15:09:50 -0400157executable('phosphor-host-reset-recovery',
158 'host_reset_recovery.cpp',
159 dependencies: [
160 sdbusplus, phosphorlogging
161 ],
162 implicit_include_directories: true,
163 install: true
164)
165
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600166install_data('obmcutil',
167 install_mode: 'rwxr-xr-x',
168 install_dir: get_option('bindir')
169)
170
Andrew Geissler179d38c2019-12-10 15:05:23 -0600171systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500172systemd_system_unit_dir = systemd.get_variable(
173 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600174subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600175subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600176
Thang Tranba2241c2021-10-26 17:47:09 +0700177if build_host_gpios.enabled()
178 subdir('host_condition_gpio')
179endif
180
Andrew Geisslerefef9702019-12-10 16:56:57 -0600181datadir = join_paths(
182 get_option('sysconfdir'),
183 'phosphor-systemd-target-monitor'
184)
185subdir('data')
186
Andrew Geissler3f125632019-12-11 17:08:19 -0600187build_tests = get_option('tests')
188
189# If test coverage of source files within the root directory are wanted,
190# need to define and build the tests from here
191if not build_tests.disabled()
192gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800193gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600194 test(
195 'test_systemd_parser',
196 executable('test_systemd_parser',
197 './test/systemd_parser.cpp',
198 'systemd_target_parser.cpp',
199 dependencies: [
200 gtest,
201 ],
202 implicit_include_directories: true,
203 include_directories: '../'
204 )
205 )
206
207 test(
208 'test_systemd_signal',
209 executable('test_systemd_signal',
210 './test/systemd_signal.cpp',
211 'systemd_target_signal.cpp',
212 dependencies: [
213 gtest, sdbusplus, sdeventplus, phosphorlogging,
214 ],
215 implicit_include_directories: true,
216 include_directories: '../'
217 )
218 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800219
220 test(
221 'test_scheduled_host_transition',
222 executable('test_scheduled_host_transition',
223 './test/test_scheduled_host_transition.cpp',
224 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800225 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800226 dependencies: [
Andrew Geisslerf8ae6a02022-01-21 17:00:20 -0600227 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging, libgpiod
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800228 ],
229 implicit_include_directories: true,
230 include_directories: '../'
231 )
232 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600233
234 test(
235 'test_hypervisor_state',
236 executable('test_hypervisor_state',
237 './test/hypervisor_state.cpp',
238 'hypervisor_state_manager.cpp',
239 dependencies: [
240 gtest, sdbusplus, sdeventplus, phosphorlogging,
241 ],
242 implicit_include_directories: true,
243 include_directories: '../'
244 )
245 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600246endif