blob: 53df188d5f866efa317c43e56ff99323bca37286 [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',
7 'cpp_std=c++17'
8 ],
9 license: 'Apache-2.0',
10 version: '0.1',
11)
12
13conf = configuration_data()
14conf.set_quoted(
15 'HOST_BUSNAME', get_option('host-busname'))
16conf.set_quoted(
17 'HOST_OBJPATH', get_option('host-objpath'))
18conf.set_quoted(
Andrew Geisslerfe270d32021-01-27 14:06:46 -060019 'HYPERVISOR_BUSNAME', get_option('hypervisor-busname'))
20conf.set_quoted(
21 'HYPERVISOR_OBJPATH', get_option('hypervisor-objpath'))
22conf.set_quoted(
Andrew Geisslerf2454102019-12-06 15:14:08 -060023 'CHASSIS_BUSNAME', get_option('chassis-busname'))
24conf.set_quoted(
25 'CHASSIS_OBJPATH', get_option('chassis-objpath'))
26conf.set_quoted(
27 'BMC_BUSNAME', get_option('bmc-busname'))
28conf.set_quoted(
29 'BMC_OBJPATH', get_option('bmc-objpath'))
30conf.set_quoted(
31 'HOST_RUNNING_FILE', get_option('host-running-file'))
32conf.set_quoted(
33 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path'))
34conf.set_quoted(
35 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path'))
36conf.set_quoted(
37 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path'))
Carol Wang71230ef2020-02-18 17:39:49 +080038conf.set_quoted(
Carol Wang1dbbef42020-03-09 11:51:23 +080039 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path'))
40conf.set_quoted(
Carol Wang71230ef2020-02-18 17:39:49 +080041 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname'))
Andrew Geisslerf2454102019-12-06 15:14:08 -060042conf.set(
43 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
44conf.set(
45 'CLASS_VERSION', get_option('class-version'))
46
47configure_file(output: 'config.h', configuration: conf)
48
Andrew Geissler7fdad602020-06-22 13:46:16 -050049if(get_option('warm-reboot').enabled())
50 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
51endif
52
Andrew Geisslerf2454102019-12-06 15:14:08 -060053sdbusplus = dependency('sdbusplus')
54sdeventplus = dependency('sdeventplus')
55phosphorlogging = dependency('phosphor-logging')
56phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
57
58cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
59
60executable('phosphor-host-state-manager',
61 'host_state_manager.cpp',
62 'host_state_manager_main.cpp',
63 'settings.cpp',
64 dependencies: [
65 sdbusplus, sdeventplus, phosphorlogging,
66 phosphordbusinterfaces, cppfs
67 ],
68 implicit_include_directories: true,
69 install: true
70)
71
Andrew Geisslerfe270d32021-01-27 14:06:46 -060072executable('phosphor-hypervisor-state-manager',
73 'hypervisor_state_manager.cpp',
74 'hypervisor_state_manager_main.cpp',
75 'settings.cpp',
76 dependencies: [
77 sdbusplus, sdeventplus, phosphorlogging,
78 phosphordbusinterfaces, cppfs
79 ],
80 implicit_include_directories: true,
81 install: true
82)
83
Andrew Geisslerf2454102019-12-06 15:14:08 -060084executable('phosphor-chassis-state-manager',
85 'chassis_state_manager.cpp',
86 'chassis_state_manager_main.cpp',
87 dependencies: [
88 sdbusplus, sdeventplus, phosphorlogging,
89 phosphordbusinterfaces, cppfs
90 ],
91 implicit_include_directories: true,
92 install: true
93)
94
95executable('phosphor-bmc-state-manager',
96 'bmc_state_manager.cpp',
97 'bmc_state_manager_main.cpp',
98 dependencies: [
99 sdbusplus, sdeventplus, phosphorlogging,
100 phosphordbusinterfaces, cppfs
101 ],
102 implicit_include_directories: true,
103 install: true
104)
105
106executable('phosphor-discover-system-state',
107 'discover_system_state.cpp',
108 'settings.cpp',
109 dependencies: [
110 sdbusplus, phosphorlogging
111 ],
112 implicit_include_directories: true,
113 install: true
114)
115
116executable('phosphor-host-check',
117 'host_check_main.cpp',
118 dependencies: [
119 sdbusplus, phosphorlogging
120 ],
121 implicit_include_directories: true,
122 install: true
123)
124
125executable('phosphor-systemd-target-monitor',
126 'systemd_target_monitor.cpp',
127 'systemd_target_parser.cpp',
128 'systemd_target_signal.cpp',
129 dependencies: [
130 sdbusplus, sdeventplus, phosphorlogging
131 ],
132 implicit_include_directories: true,
133 install: true
134)
Andrew Geissler3f125632019-12-11 17:08:19 -0600135
Carol Wang71230ef2020-02-18 17:39:49 +0800136executable('phosphor-scheduled-host-transition',
137 'scheduled_host_transition_main.cpp',
138 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800139 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800140 dependencies: [
141 sdbusplus, sdeventplus, phosphorlogging
142 ],
143 implicit_include_directories: true,
144 install: true
145)
146
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600147install_data('obmcutil',
148 install_mode: 'rwxr-xr-x',
149 install_dir: get_option('bindir')
150)
151
Andrew Geissler179d38c2019-12-10 15:05:23 -0600152systemd = dependency('systemd')
153systemd_system_unit_dir = systemd.get_pkgconfig_variable(
154 'systemdsystemunitdir',
155 define_variable: ['prefix', get_option('prefix')])
156subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600157subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600158
Andrew Geisslerefef9702019-12-10 16:56:57 -0600159datadir = join_paths(
160 get_option('sysconfdir'),
161 'phosphor-systemd-target-monitor'
162)
163subdir('data')
164
Andrew Geissler3f125632019-12-11 17:08:19 -0600165build_tests = get_option('tests')
166
167# If test coverage of source files within the root directory are wanted,
168# need to define and build the tests from here
169if not build_tests.disabled()
170gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800171gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600172 test(
173 'test_systemd_parser',
174 executable('test_systemd_parser',
175 './test/systemd_parser.cpp',
176 'systemd_target_parser.cpp',
177 dependencies: [
178 gtest,
179 ],
180 implicit_include_directories: true,
181 include_directories: '../'
182 )
183 )
184
185 test(
186 'test_systemd_signal',
187 executable('test_systemd_signal',
188 './test/systemd_signal.cpp',
189 'systemd_target_signal.cpp',
190 dependencies: [
191 gtest, sdbusplus, sdeventplus, phosphorlogging,
192 ],
193 implicit_include_directories: true,
194 include_directories: '../'
195 )
196 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800197
198 test(
199 'test_scheduled_host_transition',
200 executable('test_scheduled_host_transition',
201 './test/test_scheduled_host_transition.cpp',
202 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800203 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800204 dependencies: [
205 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
206 ],
207 implicit_include_directories: true,
208 include_directories: '../'
209 )
210 )
Andrew Geisslerc74716e2021-02-09 15:11:10 -0600211
212 test(
213 'test_hypervisor_state',
214 executable('test_hypervisor_state',
215 './test/hypervisor_state.cpp',
216 'hypervisor_state_manager.cpp',
217 dependencies: [
218 gtest, sdbusplus, sdeventplus, phosphorlogging,
219 ],
220 implicit_include_directories: true,
221 include_directories: '../'
222 )
223 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600224endif