blob: 1fd04b5da19dc796a1e68652b1fbcec2ffec26d1 [file] [log] [blame]
Brad Bishop919e4082020-10-27 18:55:19 -04001project(
2 'openpower-proc-control',
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: '1.0',
11)
12add_project_arguments('-Wno-psabi', language: 'cpp')
13
14cxx = meson.get_compiler('cpp')
15
16extra_sources = []
17extra_dependencies = []
18extra_unit_files = []
19
20unit_subs = configuration_data()
21unit_subs.set('bindir', get_option('bindir'))
22unit_subs.set('ENABLE_PHAL_TRUE', '')
23
24if get_option('phal').enabled() and get_option('p9').enabled()
25 error('phal and p9 cannot be selected at the same time')
26endif
27
28build_p9 = not get_option('p9').disabled()
29build_openfsi = not get_option('openfsi').disabled()
30build_phal = get_option('phal').enabled()
31
32if get_option('phal').enabled() and not get_option('p9').disabled()
33 build_p9 = false
34endif
35
36summary('building p9', build_p9)
37summary('building openfsi', build_openfsi)
38summary('building phal', build_phal)
39
40if build_p9
41 extra_sources += [
42 'procedures/p9/cleanup_pcie.cpp',
43 'procedures/p9/set_sync_fsi_clock_mode.cpp',
44 'procedures/p9/start_host.cpp',
45 'procedures/p9/start_host_mpreboot.cpp',
46 ]
47endif
48if build_openfsi
49 extra_sources += [
50 'procedures/openfsi/scan.cpp',
51 ]
52endif
53if build_phal
54 extra_sources += [
55 'procedures/phal/start_host.cpp',
56 'procedures/phal/set_SPI_mux.cpp',
57 'phalerror/create_pel.cpp',
58 'phalerror/phal_error.cpp',
59 ]
60 extra_dependencies += [
61 dependency('libdt-api'),
62 dependency('fmt'),
63 cxx.find_library('ekb'),
64 cxx.find_library('ipl'),
65 ]
66 extra_unit_files = [
67 'set-spi-mux.service',
68 'phal-reinit-devtree.service',
69 ]
70 unit_subs.set('ENABLE_PHAL_TRUE', '#')
71endif
72
73executable(
74 'openpower-proc-control',
75 [
76 'cfam_access.cpp',
77 'ext_interface.cpp',
78 'filedescriptor.cpp',
79 'proc_control.cpp',
80 'registration.cpp',
81 'targeting.cpp',
82 'procedures/common/cfam_overrides.cpp',
83 'procedures/common/cfam_reset.cpp',
84 'procedures/common/enter_mpreboot.cpp',
85 'procedures/common/collect_sbe_hb_data.cpp',
86 ] + extra_sources,
87 dependencies: [
88 dependency('libgpiodcxx'),
89 cxx.find_library('pdbg'),
90 dependency('phosphor-dbus-interfaces'),
91 dependency('phosphor-logging'),
92 dependency('sdbusplus'),
93 dependency('threads'),
94 ] + extra_dependencies
95)
96
97executable(
98 'openpower-proc-nmi',
99 [
100 'nmi_main.cpp',
101 'nmi_interface.cpp',
102 ],
103 dependencies: [
104 cxx.find_library('pdbg'),
105 dependency('phosphor-dbus-interfaces'),
106 dependency('phosphor-logging'),
107 dependency('sdbusplus'),
108 ]
109)
110
111unit_files = [
112 'pcie-poweroff@.service',
113 'xyz.openbmc_project.Control.Host.NMI.service',
114 'op-stop-instructions@.service',
115 'op-cfam-reset.service',
116 'op-continue-mpreboot@.service',
117 'op-enter-mpreboot@.service',
118] + extra_unit_files
119
120systemd_system_unit_dir = dependency('systemd').get_pkgconfig_variable(
121 'systemdsystemunitdir',
122 define_variable: ['prefix', get_option('prefix')])
123foreach u : unit_files
124 configure_file(
125 configuration: unit_subs,
126 input: u + '.in',
127 install: true,
128 install_dir: systemd_system_unit_dir,
129 output: u
130 )
131endforeach
132
133if not get_option('tests').disabled()
134 gtest = dependency('gtest', main: true, disabler: true, required: false)
135 if not gtest.found() and build_tests.enabled()
136 cmake = import('cmake')
137 gtest_subproject = cmake.subproject('gtest')
138 cm_gtest = gtest_subproject.dependency('gtest')
139 cm_gtest_main = gtest_subproject.dependency('gtest_main')
140 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
141 endif
142
143 test(
144 'utest',
145 executable(
146 'utest',
147 'test/utest.cpp',
148 'targeting.cpp',
149 'filedescriptor.cpp',
150 dependencies: [
151 gtest,
152 dependency('phosphor-logging'),
153 ],
154 implicit_include_directories: false,
155 include_directories: '.',
156 )
157 )
158endif