blob: f64f9e71a88536ac8fdbdfee8ae32a0f9d2da888 [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()
Brad Bishop919e4082020-10-27 18:55:19 -0400134 test(
135 'utest',
136 executable(
137 'utest',
138 'test/utest.cpp',
139 'targeting.cpp',
140 'filedescriptor.cpp',
141 dependencies: [
Brad Bishop5d482d92020-11-08 09:45:18 -0500142 dependency('gtest', main: true),
Brad Bishop919e4082020-10-27 18:55:19 -0400143 dependency('phosphor-logging'),
144 ],
145 implicit_include_directories: false,
146 include_directories: '.',
147 )
148 )
149endif