blob: 610b4bae46318e708fb6815280c2e3a2076a71ef [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(
19 'CHASSIS_BUSNAME', get_option('chassis-busname'))
20conf.set_quoted(
21 'CHASSIS_OBJPATH', get_option('chassis-objpath'))
22conf.set_quoted(
23 'BMC_BUSNAME', get_option('bmc-busname'))
24conf.set_quoted(
25 'BMC_OBJPATH', get_option('bmc-objpath'))
26conf.set_quoted(
27 'HOST_RUNNING_FILE', get_option('host-running-file'))
28conf.set_quoted(
29 'HOST_STATE_PERSIST_PATH', get_option('host-state-persist-path'))
30conf.set_quoted(
31 'POH_COUNTER_PERSIST_PATH', get_option('poh-counter-persist-path'))
32conf.set_quoted(
33 'CHASSIS_STATE_CHANGE_PERSIST_PATH', get_option('chassis-state-change-persist-path'))
Carol Wang71230ef2020-02-18 17:39:49 +080034conf.set_quoted(
Carol Wang1dbbef42020-03-09 11:51:23 +080035 'SCHEDULED_HOST_TRANSITION_PERSIST_PATH', get_option('scheduled-host-transition-persist-path'))
36conf.set_quoted(
Carol Wang71230ef2020-02-18 17:39:49 +080037 'SCHEDULED_HOST_TRANSITION_BUSNAME', get_option('scheduled-host-transition-busname'))
Andrew Geisslerf2454102019-12-06 15:14:08 -060038conf.set(
39 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
40conf.set(
41 'CLASS_VERSION', get_option('class-version'))
42
43configure_file(output: 'config.h', configuration: conf)
44
Andrew Geissler7fdad602020-06-22 13:46:16 -050045if(get_option('warm-reboot').enabled())
46 add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
47endif
48
Andrew Geisslerf2454102019-12-06 15:14:08 -060049sdbusplus = dependency('sdbusplus')
50sdeventplus = dependency('sdeventplus')
51phosphorlogging = dependency('phosphor-logging')
52phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
53
54cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
55
56executable('phosphor-host-state-manager',
57 'host_state_manager.cpp',
58 'host_state_manager_main.cpp',
59 'settings.cpp',
60 dependencies: [
61 sdbusplus, sdeventplus, phosphorlogging,
62 phosphordbusinterfaces, cppfs
63 ],
64 implicit_include_directories: true,
65 install: true
66)
67
68executable('phosphor-chassis-state-manager',
69 'chassis_state_manager.cpp',
70 'chassis_state_manager_main.cpp',
71 dependencies: [
72 sdbusplus, sdeventplus, phosphorlogging,
73 phosphordbusinterfaces, cppfs
74 ],
75 implicit_include_directories: true,
76 install: true
77)
78
79executable('phosphor-bmc-state-manager',
80 'bmc_state_manager.cpp',
81 'bmc_state_manager_main.cpp',
82 dependencies: [
83 sdbusplus, sdeventplus, phosphorlogging,
84 phosphordbusinterfaces, cppfs
85 ],
86 implicit_include_directories: true,
87 install: true
88)
89
90executable('phosphor-discover-system-state',
91 'discover_system_state.cpp',
92 'settings.cpp',
93 dependencies: [
94 sdbusplus, phosphorlogging
95 ],
96 implicit_include_directories: true,
97 install: true
98)
99
100executable('phosphor-host-check',
101 'host_check_main.cpp',
102 dependencies: [
103 sdbusplus, phosphorlogging
104 ],
105 implicit_include_directories: true,
106 install: true
107)
108
109executable('phosphor-systemd-target-monitor',
110 'systemd_target_monitor.cpp',
111 'systemd_target_parser.cpp',
112 'systemd_target_signal.cpp',
113 dependencies: [
114 sdbusplus, sdeventplus, phosphorlogging
115 ],
116 implicit_include_directories: true,
117 install: true
118)
Andrew Geissler3f125632019-12-11 17:08:19 -0600119
Carol Wang71230ef2020-02-18 17:39:49 +0800120executable('phosphor-scheduled-host-transition',
121 'scheduled_host_transition_main.cpp',
122 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800123 'utils.cpp',
Carol Wang71230ef2020-02-18 17:39:49 +0800124 dependencies: [
125 sdbusplus, sdeventplus, phosphorlogging
126 ],
127 implicit_include_directories: true,
128 install: true
129)
130
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600131install_data('obmcutil',
132 install_mode: 'rwxr-xr-x',
133 install_dir: get_option('bindir')
134)
135
Andrew Geissler179d38c2019-12-10 15:05:23 -0600136systemd = dependency('systemd')
137systemd_system_unit_dir = systemd.get_pkgconfig_variable(
138 'systemdsystemunitdir',
139 define_variable: ['prefix', get_option('prefix')])
140subdir('service_files')
Andrew Geisslerc1011572020-01-27 15:09:50 -0600141subdir('target_files')
Andrew Geissler179d38c2019-12-10 15:05:23 -0600142
Andrew Geisslerefef9702019-12-10 16:56:57 -0600143datadir = join_paths(
144 get_option('sysconfdir'),
145 'phosphor-systemd-target-monitor'
146)
147subdir('data')
148
Andrew Geissler3f125632019-12-11 17:08:19 -0600149build_tests = get_option('tests')
150
151# If test coverage of source files within the root directory are wanted,
152# need to define and build the tests from here
153if not build_tests.disabled()
154gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800155gmock = dependency('gmock', disabler: true, required: build_tests)
Andrew Geissler3f125632019-12-11 17:08:19 -0600156 test(
157 'test_systemd_parser',
158 executable('test_systemd_parser',
159 './test/systemd_parser.cpp',
160 'systemd_target_parser.cpp',
161 dependencies: [
162 gtest,
163 ],
164 implicit_include_directories: true,
165 include_directories: '../'
166 )
167 )
168
169 test(
170 'test_systemd_signal',
171 executable('test_systemd_signal',
172 './test/systemd_signal.cpp',
173 'systemd_target_signal.cpp',
174 dependencies: [
175 gtest, sdbusplus, sdeventplus, phosphorlogging,
176 ],
177 implicit_include_directories: true,
178 include_directories: '../'
179 )
180 )
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800181
182 test(
183 'test_scheduled_host_transition',
184 executable('test_scheduled_host_transition',
185 './test/test_scheduled_host_transition.cpp',
186 'scheduled_host_transition.cpp',
Carol Wangdc059392020-03-13 17:39:17 +0800187 'utils.cpp',
Carol Wang4ca6f3f2020-02-19 16:28:59 +0800188 dependencies: [
189 gtest, gmock, sdbusplus, sdeventplus, phosphorlogging,
190 ],
191 implicit_include_directories: true,
192 include_directories: '../'
193 )
194 )
Andrew Geissler3f125632019-12-11 17:08:19 -0600195endif