blob: db159e8dab6b41e0520645d213c7e77309539027 [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'))
34conf.set(
35 'BOOT_COUNT_MAX_ALLOWED', get_option('boot-count-max-allowed'))
36conf.set(
37 'CLASS_VERSION', get_option('class-version'))
38
39configure_file(output: 'config.h', configuration: conf)
40
41sdbusplus = dependency('sdbusplus')
42sdeventplus = dependency('sdeventplus')
43phosphorlogging = dependency('phosphor-logging')
44phosphordbusinterfaces = dependency('phosphor-dbus-interfaces')
45
46cppfs = meson.get_compiler('cpp').find_library('stdc++fs')
47
48executable('phosphor-host-state-manager',
49 'host_state_manager.cpp',
50 'host_state_manager_main.cpp',
51 'settings.cpp',
52 dependencies: [
53 sdbusplus, sdeventplus, phosphorlogging,
54 phosphordbusinterfaces, cppfs
55 ],
56 implicit_include_directories: true,
57 install: true
58)
59
60executable('phosphor-chassis-state-manager',
61 'chassis_state_manager.cpp',
62 'chassis_state_manager_main.cpp',
63 dependencies: [
64 sdbusplus, sdeventplus, phosphorlogging,
65 phosphordbusinterfaces, cppfs
66 ],
67 implicit_include_directories: true,
68 install: true
69)
70
71executable('phosphor-bmc-state-manager',
72 'bmc_state_manager.cpp',
73 'bmc_state_manager_main.cpp',
74 dependencies: [
75 sdbusplus, sdeventplus, phosphorlogging,
76 phosphordbusinterfaces, cppfs
77 ],
78 implicit_include_directories: true,
79 install: true
80)
81
82executable('phosphor-discover-system-state',
83 'discover_system_state.cpp',
84 'settings.cpp',
85 dependencies: [
86 sdbusplus, phosphorlogging
87 ],
88 implicit_include_directories: true,
89 install: true
90)
91
92executable('phosphor-host-check',
93 'host_check_main.cpp',
94 dependencies: [
95 sdbusplus, phosphorlogging
96 ],
97 implicit_include_directories: true,
98 install: true
99)
100
101executable('phosphor-systemd-target-monitor',
102 'systemd_target_monitor.cpp',
103 'systemd_target_parser.cpp',
104 'systemd_target_signal.cpp',
105 dependencies: [
106 sdbusplus, sdeventplus, phosphorlogging
107 ],
108 implicit_include_directories: true,
109 install: true
110)
Andrew Geissler3f125632019-12-11 17:08:19 -0600111
Andrew Geisslerdfa75fc2019-12-11 17:26:42 -0600112install_data('obmcutil',
113 install_mode: 'rwxr-xr-x',
114 install_dir: get_option('bindir')
115)
116
Andrew Geissler179d38c2019-12-10 15:05:23 -0600117systemd = dependency('systemd')
118systemd_system_unit_dir = systemd.get_pkgconfig_variable(
119 'systemdsystemunitdir',
120 define_variable: ['prefix', get_option('prefix')])
121subdir('service_files')
122
Andrew Geisslerefef9702019-12-10 16:56:57 -0600123datadir = join_paths(
124 get_option('sysconfdir'),
125 'phosphor-systemd-target-monitor'
126)
127subdir('data')
128
Andrew Geissler3f125632019-12-11 17:08:19 -0600129build_tests = get_option('tests')
130
131# If test coverage of source files within the root directory are wanted,
132# need to define and build the tests from here
133if not build_tests.disabled()
134gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
135 test(
136 'test_systemd_parser',
137 executable('test_systemd_parser',
138 './test/systemd_parser.cpp',
139 'systemd_target_parser.cpp',
140 dependencies: [
141 gtest,
142 ],
143 implicit_include_directories: true,
144 include_directories: '../'
145 )
146 )
147
148 test(
149 'test_systemd_signal',
150 executable('test_systemd_signal',
151 './test/systemd_signal.cpp',
152 'systemd_target_signal.cpp',
153 dependencies: [
154 gtest, sdbusplus, sdeventplus, phosphorlogging,
155 ],
156 implicit_include_directories: true,
157 include_directories: '../'
158 )
159 )
160endif