blob: fe898d496a849e3fc3ae6e0effd1f744a1c57fe9 [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')
Ben Tyner2c36e5a2021-07-12 14:56:49 -050063libgpiod = dependency('libgpiod', version : '>=1.4.1')
Andrew Geisslerf2454102019-12-06 15:14:08 -060064
65cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
66
67executable('phosphor-host-state-manager',
68 'host_state_manager.cpp',
69 'host_state_manager_main.cpp',
70 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040071 'host_check.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060072 dependencies: [
73 sdbusplus, sdeventplus, phosphorlogging,
74 phosphordbusinterfaces, cppfs
75 ],
76 implicit_include_directories: true,
77 install: true
78)
79
Andrew Geisslerfe270d32021-01-27 14:06:46 -060080executable('phosphor-hypervisor-state-manager',
81 'hypervisor_state_manager.cpp',
82 'hypervisor_state_manager_main.cpp',
83 'settings.cpp',
84 dependencies: [
85 sdbusplus, sdeventplus, phosphorlogging,
86 phosphordbusinterfaces, cppfs
87 ],
88 implicit_include_directories: true,
89 install: true
90)
91
Andrew Geisslerf2454102019-12-06 15:14:08 -060092executable('phosphor-chassis-state-manager',
93 'chassis_state_manager.cpp',
94 'chassis_state_manager_main.cpp',
95 dependencies: [
96 sdbusplus, sdeventplus, phosphorlogging,
Ben Tyner2c36e5a2021-07-12 14:56:49 -050097 phosphordbusinterfaces, cppfs, libgpiod
Andrew Geisslerf2454102019-12-06 15:14:08 -060098 ],
99 implicit_include_directories: true,
100 install: true
101)
102
103executable('phosphor-bmc-state-manager',
104 'bmc_state_manager.cpp',
105 'bmc_state_manager_main.cpp',
106 dependencies: [
107 sdbusplus, sdeventplus, phosphorlogging,
108 phosphordbusinterfaces, cppfs
109 ],
110 implicit_include_directories: true,
111 install: true
112)
113
114executable('phosphor-discover-system-state',
115 'discover_system_state.cpp',
116 'settings.cpp',
117 dependencies: [
118 sdbusplus, phosphorlogging
119 ],
120 implicit_include_directories: true,
121 install: true
122)
123
Andrew Geisslerf2454102019-12-06 15:14:08 -0600124executable('phosphor-systemd-target-monitor',
125 'systemd_target_monitor.cpp',
126 'systemd_target_parser.cpp',
127 'systemd_target_signal.cpp',
128 dependencies: [
129 sdbusplus, sdeventplus, phosphorlogging
130 ],
131 implicit_include_directories: true,
132 install: true
133)
Andrew Geissler3f125632019-12-11 17:08:19 -0600134
Carol Wang71230ef2020-02-18 17:39:49 +0800135executable('phosphor-scheduled-host-transition',
136 'scheduled_host_transition_main.cpp',
137 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800138 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800139 dependencies: [
140 sdbusplus, sdeventplus, phosphorlogging
141 ],
142 implicit_include_directories: true,
143 install: true
144)
145
Andrew Geisslerba0163a2021-08-11 15:09:50 -0400146executable('phosphor-host-reset-recovery',
147 'host_reset_recovery.cpp',
148 dependencies: [
149 sdbusplus, phosphorlogging
150 ],
151 implicit_include_directories: true,
152 install: true
153)
154
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600155install_data('obmcutil',
156 install_mode: 'rwxr-xr-x',
157 install_dir: get_option('bindir')
158)
159
Andrew Geissler179d38c2019-12-10 15:05:23 -0600160systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500161systemd_system_unit_dir = systemd.get_variable(
162 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600163subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600164subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600165
Andrew Geisslerefef9702019-12-10 16:56:57 -0600166datadir = join_paths(
167 get_option('sysconfdir'),
168 'phosphor-systemd-target-monitor'
169)
170subdir('data')
171
Andrew Geissler3f125632019-12-11 17:08:19 -0600172build_tests = get_option('tests')
173
174# If test coverage of source files within the root directory are wanted,
175# need to define and build the tests from here
176if not build_tests.disabled()
177gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800178gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600179 test(
180 'test_systemd_parser',
181 executable('test_systemd_parser',
182 './test/systemd_parser.cpp',
183 'systemd_target_parser.cpp',
184 dependencies: [
185 gtest,
186 ],
187 implicit_include_directories: true,
188 include_directories: '../'
189 )
190 )
191
192 test(
193 'test_systemd_signal',
194 executable('test_systemd_signal',
195 './test/systemd_signal.cpp',
196 'systemd_target_signal.cpp',
197 dependencies: [
198 gtest, sdbusplus, sdeventplus, phosphorlogging,
199 ],
200 implicit_include_directories: true,
201 include_directories: '../'
202 )
203 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800204
205 test(
206 'test_scheduled_host_transition',
207 executable('test_scheduled_host_transition',
208 './test/test_scheduled_host_transition.cpp',
209 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800210 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800211 dependencies: [
212 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
213 ],
214 implicit_include_directories: true,
215 include_directories: '../'
216 )
217 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600218
219 test(
220 'test_hypervisor_state',
221 executable('test_hypervisor_state',
222 './test/hypervisor_state.cpp',
223 'hypervisor_state_manager.cpp',
224 dependencies: [
225 gtest, sdbusplus, sdeventplus, phosphorlogging,
226 ],
227 implicit_include_directories: true,
228 include_directories: '../'
229 )
230 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600231endif