blob: 51a2dddb715e616e2814dc117ee0408890485217 [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 Geisslerf2454102019-12-06 15:14:08 -060050configure_file(output: 'config.h', configuration: conf)
51
Andrew Geissler7fdad602020-06-22 13:46:16 -050052if(get_option('warm-reboot').enabled())
53 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
54endif
55
Andrew Geisslerf2454102019-12-06 15:14:08 -060056sdbusplus = dependency('sdbusplus')
57sdeventplus = dependency('sdeventplus')
58phosphorlogging = dependency('phosphor-logging')
59phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
60
61cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
62
63executable('phosphor-host-state-manager',
64 'host_state_manager.cpp',
65 'host_state_manager_main.cpp',
66 'settings.cpp',
Andrew Geissler0d1c3f12021-07-27 16:21:01 -040067 'host_check.cpp',
Andrew Geisslerf2454102019-12-06 15:14:08 -060068 dependencies: [
69 sdbusplus, sdeventplus, phosphorlogging,
70 phosphordbusinterfaces, cppfs
71 ],
72 implicit_include_directories: true,
73 install: true
74)
75
Andrew Geisslerfe270d32021-01-27 14:06:46 -060076executable('phosphor-hypervisor-state-manager',
77 'hypervisor_state_manager.cpp',
78 'hypervisor_state_manager_main.cpp',
79 'settings.cpp',
80 dependencies: [
81 sdbusplus, sdeventplus, phosphorlogging,
82 phosphordbusinterfaces, cppfs
83 ],
84 implicit_include_directories: true,
85 install: true
86)
87
Andrew Geisslerf2454102019-12-06 15:14:08 -060088executable('phosphor-chassis-state-manager',
89 'chassis_state_manager.cpp',
90 'chassis_state_manager_main.cpp',
91 dependencies: [
92 sdbusplus, sdeventplus, phosphorlogging,
93 phosphordbusinterfaces, cppfs
94 ],
95 implicit_include_directories: true,
96 install: true
97)
98
99executable('phosphor-bmc-state-manager',
100 'bmc_state_manager.cpp',
101 'bmc_state_manager_main.cpp',
102 dependencies: [
103 sdbusplus, sdeventplus, phosphorlogging,
104 phosphordbusinterfaces, cppfs
105 ],
106 implicit_include_directories: true,
107 install: true
108)
109
110executable('phosphor-discover-system-state',
111 'discover_system_state.cpp',
112 'settings.cpp',
113 dependencies: [
114 sdbusplus, phosphorlogging
115 ],
116 implicit_include_directories: true,
117 install: true
118)
119
Andrew Geisslerf2454102019-12-06 15:14:08 -0600120executable('phosphor-systemd-target-monitor',
121 'systemd_target_monitor.cpp',
122 'systemd_target_parser.cpp',
123 'systemd_target_signal.cpp',
124 dependencies: [
125 sdbusplus, sdeventplus, phosphorlogging
126 ],
127 implicit_include_directories: true,
128 install: true
129)
Andrew Geissler3f125632019-12-11 17:08:19 -0600130
Carol Wang71230ef2020-02-18 17:39:49 +0800131executable('phosphor-scheduled-host-transition',
132 'scheduled_host_transition_main.cpp',
133 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800134 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800135 dependencies: [
136 sdbusplus, sdeventplus, phosphorlogging
137 ],
138 implicit_include_directories: true,
139 install: true
140)
141
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600142install_data('obmcutil',
143 install_mode: 'rwxr-xr-x',
144 install_dir: get_option('bindir')
145)
146
Andrew Geissler179d38c2019-12-10 15:05:23 -0600147systemd = dependency('systemd')
Andrew Geissler429100a2021-09-09 12:50:24 -0500148systemd_system_unit_dir = systemd.get_variable(
149 pkgconfig : 'systemdsystemunitdir')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600150subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600151subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600152
Andrew Geisslerefef9702019-12-10 16:56:57 -0600153datadir = join_paths(
154 get_option('sysconfdir'),
155 'phosphor-systemd-target-monitor'
156)
157subdir('data')
158
Andrew Geissler3f125632019-12-11 17:08:19 -0600159build_tests = get_option('tests')
160
161# If test coverage of source files within the root directory are wanted,
162# need to define and build the tests from here
163if not build_tests.disabled()
164gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800165gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600166 test(
167 'test_systemd_parser',
168 executable('test_systemd_parser',
169 './test/systemd_parser.cpp',
170 'systemd_target_parser.cpp',
171 dependencies: [
172 gtest,
173 ],
174 implicit_include_directories: true,
175 include_directories: '../'
176 )
177 )
178
179 test(
180 'test_systemd_signal',
181 executable('test_systemd_signal',
182 './test/systemd_signal.cpp',
183 'systemd_target_signal.cpp',
184 dependencies: [
185 gtest, sdbusplus, sdeventplus, phosphorlogging,
186 ],
187 implicit_include_directories: true,
188 include_directories: '../'
189 )
190 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800191
192 test(
193 'test_scheduled_host_transition',
194 executable('test_scheduled_host_transition',
195 './test/test_scheduled_host_transition.cpp',
196 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800197 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800198 dependencies: [
199 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
200 ],
201 implicit_include_directories: true,
202 include_directories: '../'
203 )
204 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600205
206 test(
207 'test_hypervisor_state',
208 executable('test_hypervisor_state',
209 './test/hypervisor_state.cpp',
210 'hypervisor_state_manager.cpp',
211 dependencies: [
212 gtest, sdbusplus, sdeventplus, phosphorlogging,
213 ],
214 implicit_include_directories: true,
215 include_directories: '../'
216 )
217 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600218endif