blob: 1dd86c764a2cbb4c44e2f3a95386a58425c8615c [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',
Patrick Williams22ed4282021-10-06 15:33:01 -05007 'cpp_std=c++20'
Brad Bishopb4459912019-11-05 19:39:11 -05008 ],
9 license: 'Apache-2.0',
10 version: '0.1',
Patrick Williams22ed4282021-10-06 15:33:01 -050011 meson_version: '>=0.57.0',
Brad Bishopb4459912019-11-05 19:39:11 -050012)
Brad Bishopec984912020-10-01 10:24:55 -040013add_project_arguments('-Wno-psabi', language: 'cpp')
Brad Bishopb4459912019-11-05 19:39:11 -050014
15boost_args = [
16 '-DBOOST_SYSTEM_NO_DEPRECATED',
17 '-DBOOST_ERROR_CODE_HEADER_ONLY',
18 '-DBOOST_NO_RTTI',
19 '-DBOOST_NO_TYPEID',
20 '-DBOOST_ALL_NO_LIB',
Ed Tanous07d467b2021-02-23 14:48:37 -080021 '-DBOOST_ALLOW_DEPRECATED_HEADERS'
Brad Bishopb4459912019-11-05 19:39:11 -050022]
23build_tests = get_option('tests')
Brad Bishope3a12b62020-01-15 11:56:29 -050024cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050025boost = dependency('boost', required: false)
26if not boost.found()
27 subproject('boost', required: false)
28 boost = declare_dependency(
29 include_directories: 'subprojects/boost_1_71_0',
30 )
Ed Tanous07d467b2021-02-23 14:48:37 -080031 boost = boost.as_system('system')
Brad Bishop787e8282020-01-15 12:16:53 -050032endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050033if get_option('fru-device')
34 i2c = cpp.find_library('i2c')
35endif
Ed Tanous55ae5a82021-08-02 14:00:02 -070036if cpp.has_header('nlohmann/json.hpp')
37 nlohmann_json = declare_dependency()
38else
39 subproject('nlohmann', required: false)
40 nlohmann_json = declare_dependency(
41 include_directories: [
42 'subprojects/nlohmann/single_include',
43 'subprojects/nlohmann/single_include/nlohmann',
44 ]
45 )
46 nlohmann_json = nlohmann_json.as_system('system')
47endif
Brad Bishop6765d902020-01-15 12:31:41 -050048sdbusplus = dependency('sdbusplus', required: false)
49if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050050 sdbusplus_proj = subproject('sdbusplus', required: true)
51 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080052 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050053endif
Brad Bishopb4459912019-11-05 19:39:11 -050054systemd = dependency('systemd')
55systemd_system_unit_dir = systemd.get_pkgconfig_variable(
56 'systemdsystemunitdir',
57 define_variable: ['prefix', get_option('prefix')])
58packagedir = join_paths(
59 get_option('prefix'),
60 get_option('datadir'),
61 meson.project_name(),
62)
63threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070064if cpp.has_header('valijson/validator.hpp')
65 valijson = declare_dependency()
66else
67 subproject('valijson', required: false)
68 valijson = declare_dependency(
69 include_directories: 'subprojects/valijson/include'
70 )
71 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050072endif
Brad Bishopb4459912019-11-05 19:39:11 -050073
74install_data('blacklist.json')
75
76configs = [
77 '1Ux16 Riser.json',
78 '2Ux8 Riser.json',
79 '8X25 HSBP.json',
80 'A2UL16RISER.json',
81 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000082 'ACBELL_RICA_PSU.json',
Zev Weiss43e1d7a2021-09-08 16:30:39 -050083 'ASRock_E3C246D4I.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060084 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050085 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030086 'ASPOWER_U1A-D10550_PSU.json',
87 'ASPOWER_U1A-D10800_PSU.json',
88 'ASPOWER_U1A-D11200_PSU.json',
89 'ASPOWER_U1A-D11600_PSU.json',
90 'ASPOWER_U1D-D10800_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050091 'AXX1P100HSSI_AIC.json',
92 'AXX2PRTHDHD.json',
93 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060094 'Bellavista.json',
Brad Bishopb4459912019-11-05 19:39:11 -050095 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030096 'Delta_DPS-1600AB_PSU.json',
97 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060098 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -050099 'F1U12X25 HSBP.json',
100 'F1U4X25 HSBP.json',
101 'F2U12X35 HSBP.json',
102 'F2U8X25 HSBP.json',
103 'FBTP.json',
104 'FBYV2.json',
105 'Flextronics S-1100ADU00-201 PSU.json',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -0600106 'IBM 1000W CFFPS.json',
107 'IBM 1400W CFFPS.json',
108 'IBM 1600W CFFPS.json',
109 'IBM 2000W CFFPS.json',
110 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500111 'Intel Front Panel.json',
Mustafa Shehabi09929ac2021-07-28 17:32:05 -0500112 'Kudo_BMC.json',
113 'Kudo_Motherboard.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400114 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500115 'NVME P4000.json',
116 'PCIE SSD Retimer.json',
117 'PSSF132202A.json',
118 'PSSF162205A.json',
119 'PSSF212201A.json',
120 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400121 'Rainier 2U Chassis.json',
122 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600123 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500124 'R1000 Chassis.json',
125 'R2000 Chassis.json',
126 'SAS Module.json',
127 'SOLUM_PSSF162202_PSU.json',
128 'STP Baseboard.json',
129 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000130 'Tyan_S7106_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500131 'WFT Baseboard.json',
132]
133
134foreach c : configs
135 install_data(
136 join_paths('configurations', c),
137 install_dir: join_paths(
138 packagedir,
139 'configurations',
140 )
141 )
142endforeach
143
144schemas = [
145 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400146 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400147 'openbmc-dbus.json',
Brad Bishop4afe7082020-10-01 09:59:26 -0400148 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400149 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500150 'Pid.json',
151 'Pid.Zone.json',
152 'Stepwise.json',
Rashmica Guptae23af562021-07-29 15:12:16 +1000153 'VirtualSensor.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500154]
155
156foreach s : schemas
157 install_data(
158 join_paths('schemas', s),
159 install_dir: join_paths(
160 packagedir,
161 'configurations',
162 'schemas',
163 )
164 )
165endforeach
166
167subdir('service_files')
168subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400169
Jason M. Billsff58eba2020-04-14 16:05:30 -0700170if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800171 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400172 gtest = dependency('gtest', main: true, disabler: true, required: false)
173 if not gtest.found() and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700174 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400175 gtest_subproject = cmake.subproject('gtest')
176 cm_gtest = gtest_subproject.dependency('gtest')
177 cm_gtest_main = gtest_subproject.dependency('gtest_main')
178 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
179 endif
180
181 test(
182 'test_entity_manager',
183 executable(
184 'test_entity_manager',
185 'test/test_entity-manager.cpp',
186 'src/Utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800187 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400188 dependencies: [
189 boost,
190 gtest,
Ed Tanous55ae5a82021-08-02 14:00:02 -0700191 nlohmann_json,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400192 sdbusplus,
193 valijson,
194 ],
195 implicit_include_directories: false,
196 include_directories: 'include',
197 )
198 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800199
200 test(
201 'test_fru_utils',
202 executable(
203 'test_fru_utils',
204 'test/test_fru-utils.cpp',
205 'src/FruUtils.cpp',
206 cpp_args: test_boost_args,
207 dependencies: [
208 boost,
209 gtest,
210 ],
211 implicit_include_directories: false,
212 include_directories: 'include',
213 )
214 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700215endif