blob: 357ada1b234585dc3deb70a0690097259a361ebf [file] [log] [blame]
Brad Bishopb4459912019-11-05 19:39:11 -05001project(
2 'entity-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)
Brad Bishopec984912020-10-01 10:24:55 -040012add_project_arguments('-Wno-psabi', language: 'cpp')
Brad Bishopb4459912019-11-05 19:39:11 -050013
14boost_args = [
15 '-DBOOST_SYSTEM_NO_DEPRECATED',
16 '-DBOOST_ERROR_CODE_HEADER_ONLY',
17 '-DBOOST_NO_RTTI',
18 '-DBOOST_NO_TYPEID',
19 '-DBOOST_ALL_NO_LIB',
Ed Tanous07d467b2021-02-23 14:48:37 -080020 '-DBOOST_ALLOW_DEPRECATED_HEADERS'
Brad Bishopb4459912019-11-05 19:39:11 -050021]
22build_tests = get_option('tests')
Brad Bishope3a12b62020-01-15 11:56:29 -050023cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050024boost = dependency('boost', required: false)
25if not boost.found()
26 subproject('boost', required: false)
27 boost = declare_dependency(
28 include_directories: 'subprojects/boost_1_71_0',
29 )
Ed Tanous07d467b2021-02-23 14:48:37 -080030 boost = boost.as_system('system')
Brad Bishop787e8282020-01-15 12:16:53 -050031endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050032if get_option('fru-device')
33 i2c = cpp.find_library('i2c')
34endif
Ed Tanous55ae5a82021-08-02 14:00:02 -070035if cpp.has_header('nlohmann/json.hpp')
36 nlohmann_json = declare_dependency()
37else
38 subproject('nlohmann', required: false)
39 nlohmann_json = declare_dependency(
40 include_directories: [
41 'subprojects/nlohmann/single_include',
42 'subprojects/nlohmann/single_include/nlohmann',
43 ]
44 )
45 nlohmann_json = nlohmann_json.as_system('system')
46endif
Brad Bishop6765d902020-01-15 12:31:41 -050047sdbusplus = dependency('sdbusplus', required: false)
48if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050049 sdbusplus_proj = subproject('sdbusplus', required: true)
50 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080051 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050052endif
Brad Bishopb4459912019-11-05 19:39:11 -050053systemd = dependency('systemd')
54systemd_system_unit_dir = systemd.get_pkgconfig_variable(
55 'systemdsystemunitdir',
56 define_variable: ['prefix', get_option('prefix')])
57packagedir = join_paths(
58 get_option('prefix'),
59 get_option('datadir'),
60 meson.project_name(),
61)
62threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070063if cpp.has_header('valijson/validator.hpp')
64 valijson = declare_dependency()
65else
66 subproject('valijson', required: false)
67 valijson = declare_dependency(
68 include_directories: 'subprojects/valijson/include'
69 )
70 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050071endif
Brad Bishopb4459912019-11-05 19:39:11 -050072
73install_data('blacklist.json')
74
75configs = [
76 '1Ux16 Riser.json',
77 '2Ux8 Riser.json',
78 '8X25 HSBP.json',
79 'A2UL16RISER.json',
80 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000081 'ACBELL_RICA_PSU.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060082 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050083 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030084 'ASPOWER_U1A-D10550_PSU.json',
85 'ASPOWER_U1A-D10800_PSU.json',
86 'ASPOWER_U1A-D11200_PSU.json',
87 'ASPOWER_U1A-D11600_PSU.json',
88 'ASPOWER_U1D-D10800_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050089 'AXX1P100HSSI_AIC.json',
90 'AXX2PRTHDHD.json',
91 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060092 'Bellavista.json',
Brad Bishopb4459912019-11-05 19:39:11 -050093 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030094 'Delta_DPS-1600AB_PSU.json',
95 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060096 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -050097 'F1U12X25 HSBP.json',
98 'F1U4X25 HSBP.json',
99 'F2U12X35 HSBP.json',
100 'F2U8X25 HSBP.json',
101 'FBTP.json',
102 'FBYV2.json',
103 'Flextronics S-1100ADU00-201 PSU.json',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -0600104 'IBM 1000W CFFPS.json',
105 'IBM 1400W CFFPS.json',
106 'IBM 1600W CFFPS.json',
107 'IBM 2000W CFFPS.json',
108 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500109 'Intel Front Panel.json',
Mustafa Shehabi09929ac2021-07-28 17:32:05 -0500110 'Kudo_BMC.json',
111 'Kudo_Motherboard.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400112 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500113 'NVME P4000.json',
114 'PCIE SSD Retimer.json',
115 'PSSF132202A.json',
116 'PSSF162205A.json',
117 'PSSF212201A.json',
118 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400119 'Rainier 2U Chassis.json',
120 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600121 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500122 'R1000 Chassis.json',
123 'R2000 Chassis.json',
124 'SAS Module.json',
125 'SOLUM_PSSF162202_PSU.json',
126 'STP Baseboard.json',
127 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000128 'Tyan_S7106_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500129 'WFT Baseboard.json',
130]
131
132foreach c : configs
133 install_data(
134 join_paths('configurations', c),
135 install_dir: join_paths(
136 packagedir,
137 'configurations',
138 )
139 )
140endforeach
141
142schemas = [
143 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400144 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400145 'openbmc-dbus.json',
Brad Bishop4afe7082020-10-01 09:59:26 -0400146 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400147 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500148 'Pid.json',
149 'Pid.Zone.json',
150 'Stepwise.json',
151]
152
153foreach s : schemas
154 install_data(
155 join_paths('schemas', s),
156 install_dir: join_paths(
157 packagedir,
158 'configurations',
159 'schemas',
160 )
161 )
162endforeach
163
164subdir('service_files')
165subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400166
Jason M. Billsff58eba2020-04-14 16:05:30 -0700167if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800168 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400169 gtest = dependency('gtest', main: true, disabler: true, required: false)
170 if not gtest.found() and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700171 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400172 gtest_subproject = cmake.subproject('gtest')
173 cm_gtest = gtest_subproject.dependency('gtest')
174 cm_gtest_main = gtest_subproject.dependency('gtest_main')
175 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
176 endif
177
178 test(
179 'test_entity_manager',
180 executable(
181 'test_entity_manager',
182 'test/test_entity-manager.cpp',
183 'src/Utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800184 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400185 dependencies: [
186 boost,
187 gtest,
Ed Tanous55ae5a82021-08-02 14:00:02 -0700188 nlohmann_json,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400189 sdbusplus,
190 valijson,
191 ],
192 implicit_include_directories: false,
193 include_directories: 'include',
194 )
195 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800196
197 test(
198 'test_fru_utils',
199 executable(
200 'test_fru_utils',
201 'test/test_fru-utils.cpp',
202 'src/FruUtils.cpp',
203 cpp_args: test_boost_args,
204 dependencies: [
205 boost,
206 gtest,
207 ],
208 implicit_include_directories: false,
209 include_directories: 'include',
210 )
211 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700212endif