blob: c0f649fe4080f54cf0645f21ac4931303fa98d93 [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 Williamsee1db762023-04-12 08:05:58 -050011 meson_version: '>=0.58.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
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093036
37nlohmann_json_dep = dependency('nlohmann_json',
38 fallback: [ 'nlohmann_json', 'nlohmann_json_dep'])
39
Brad Bishop6765d902020-01-15 12:31:41 -050040sdbusplus = dependency('sdbusplus', required: false)
41if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050042 sdbusplus_proj = subproject('sdbusplus', required: true)
43 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080044 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050045endif
Brad Bishopb4459912019-11-05 19:39:11 -050046systemd = dependency('systemd')
Patrick Williamsee1db762023-04-12 08:05:58 -050047systemd_system_unit_dir = systemd.get_variable(
Brad Bishopb4459912019-11-05 19:39:11 -050048 'systemdsystemunitdir',
Patrick Williamsee1db762023-04-12 08:05:58 -050049 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopb4459912019-11-05 19:39:11 -050050packagedir = join_paths(
51 get_option('prefix'),
52 get_option('datadir'),
53 meson.project_name(),
54)
Andrew Jefferya9c58922021-06-01 09:28:59 +093055sysconfdir = join_paths(
56 get_option('prefix'),
57 get_option('sysconfdir'),
58 meson.project_name(),
59)
Brad Bishopb4459912019-11-05 19:39:11 -050060threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070061if cpp.has_header('valijson/validator.hpp')
62 valijson = declare_dependency()
63else
64 subproject('valijson', required: false)
65 valijson = declare_dependency(
66 include_directories: 'subprojects/valijson/include'
67 )
68 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050069endif
Brad Bishopb4459912019-11-05 19:39:11 -050070
71install_data('blacklist.json')
72
73configs = [
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040074 '1ux16_riser.json',
75 '2ux8_riser.json',
Ali El-Haj-Mahmoudffe7df42023-05-08 14:27:22 -040076 '3ypower_vast2112_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040077 '8x25_hsbp.json',
78 'a2ul16riser.json',
79 'a2ux8x4riser.json',
80 'acbell_rica_psu.json',
Alexander Hansen719432e2023-08-01 17:28:59 +020081 'acbel_r1ca2122a_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040082 'asrock_e3c246d4i.json',
Zev Weiss86930a12023-11-07 08:10:41 +000083 'asrock_n3_xlarge_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040084 'asrock_romed8hm3.json',
Zev Weiss544d6ec2023-11-07 03:24:33 +000085 'asrock_spc621d8hm3.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040086 'bletchley_baseboard.json',
87 'bletchley_chassis.json',
Potin Lai546d3752022-11-10 08:57:47 +080088 'bletchley_frontpanel.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040089 'blyth.json',
90 'ahw1um2riser.json',
91 'aspower_u1a-d10550_psu.json',
92 'aspower_u1a-d10800_psu.json',
93 'aspower_u1a-d11200_psu.json',
94 'aspower_u1a-d11600_psu.json',
95 'aspower_u1d-d10800_psu.json',
96 'axx1p100hssi_aic.json',
97 'axx2prthdhd.json',
98 'bnp_baseboard.json',
99 'bellavista.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600100 'bonnell.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400101 'delta_awf2dc3200w_psu.json',
102 'delta_dps-750xb_psu.json',
103 'delta_dps-1600ab_psu.json',
104 'delta_dps-2000ab_psu.json',
Marvin Dreesac7bae32023-05-10 09:30:35 +0200105 'supermicro-pws-920p-sq_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400106 'everest.json',
107 'f1u12x25_hsbp.json',
108 'f1u4x25_hsbp.json',
109 'f2u12x35_hsbp.json',
110 'f2u8x25_hsbp.json',
111 'fbtp.json',
112 'fbyv2.json',
Jayashree Dhanapal90249e22022-06-13 15:00:57 +0530113 'fbyv35.json',
Jayashree Dhanapal8232a6a2022-06-21 15:50:50 +0530114 'fbyv35_nic_mellanox.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400115 'flextronics_s-1100adu00-201_psu.json',
Naresh Solankie3b65822022-11-02 10:29:38 +0100116 'genesis3_psu.json',
117 'genesis3_baseboard.json',
118 'genesis3_chassis.json',
Alexander Hansenf60262d2023-07-26 13:28:15 +0200119 'gospower_g1136-1300wna_psu.json',
BonnieLo-wiwynncbaec702022-11-17 15:42:46 +0800120 'greatlakes.json',
121 'greatlakes_nic_mellanox.json',
Andrew Geissler3a1cbe22023-02-17 13:57:15 -0600122 'ibm_tacoma_rack_controller.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400123 'intel_front_panel.json',
124 'kudo_bmc.json',
125 'kudo_motherboard.json',
Andrew Jeffery8f163c02023-09-19 16:11:01 +0930126 'micron_7450.json',
Jonico Eustaquioaa9bb3d2023-04-18 15:24:24 -0500127 'mori_bmc.json',
Jonico Eustaquio8809d712023-05-03 11:49:00 -0500128 'mori_motherboard.json',
Thang Q. Nguyen79865952023-06-28 09:32:32 +0700129 'mtjade.json',
Chau Lye2400c82022-12-16 04:15:43 +0000130 'mtmitchell_bmc.json',
131 'mtmitchell_mb.json',
Andrew Geissler4139c3a2023-10-12 04:34:33 -0600132 'mudflap.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400133 'nisqually.json',
134 'nvme_p4000.json',
135 'pcie_ssd_retimer.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600136 'pennybacker.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400137 'pssf132202a.json',
138 'pssf162205a.json',
139 'pssf212201a.json',
140 'pssf222201a.json',
141 'rainier_2u_chassis.json',
142 'rainier_4u_chassis.json',
143 'rainier_1s4u_chassis.json',
144 'r1000_chassis.json',
145 'r2000_chassis.json',
146 'sas_module.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200147 'sbp1_baseboard.json',
148 'sbp1_chassis.json',
Patrick Rudolphe2d550f2023-09-11 15:32:38 +0200149 'sbp1_nvme.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200150 'sbp1_psu.json',
Patrick Rudolph2e614742023-11-10 15:11:51 +0100151 'sbp1_rssd.json',
Andrew Geissler35215e92023-10-02 06:48:05 -0500152 'system1_baseboard.json',
Chris Caincb47a832023-11-17 12:19:20 -0600153 'system1_chassis.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400154 'solum_pssf162202_psu.json',
155 'storm_king.json',
156 'stp_baseboard.json',
157 'stp_p4000_chassis.json',
Jayashree Dhanapal10612f32022-11-02 16:12:41 +0530158 'twinlake.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400159 'tyan_s7106_baseboard.json',
160 'tyan_s8036_baseboard.json',
Andrei Kartashev9d455522022-01-11 13:27:29 +0300161 'vegman_n110_baseboard.json',
162 'vegman_rx20_baseboard.json',
163 'vegman_sx20_baseboard.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400164 'wft_baseboard.json',
Delphine CC Chiudf1eac92023-08-30 18:23:13 +0800165 'yosemite4_fanboard.json',
Delphine CC Chiue41b5cb2023-11-30 16:13:52 +0800166 'yosemite4_sentineldome.json',
167 'yosemite4_floatingfalls.json',
168 'yosemite4_wailuafalls.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500169]
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800170filepaths = []
Brad Bishopb4459912019-11-05 19:39:11 -0500171foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800172 file = join_paths('configurations', c)
Brad Bishopb4459912019-11-05 19:39:11 -0500173 install_data(
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800174 file,
Brad Bishopb4459912019-11-05 19:39:11 -0500175 install_dir: join_paths(
176 packagedir,
177 'configurations',
178 )
179 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800180 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500181endforeach
182
Brad Bishopbfc72962022-05-26 16:33:00 -0400183validate_script = files('scripts/validate_configs.py')
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800184autojson = custom_target(
185 'check_syntax',
186 command: [
187 validate_script,
188 '-v',
189 '-k',
190 ],
191 depend_files: files(filepaths),
192 build_by_default: true,
193 capture: true,
194 output: 'validate_configs.log',
195)
196
Brad Bishopb4459912019-11-05 19:39:11 -0500197schemas = [
198 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400199 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400200 'openbmc-dbus.json',
Brad Bishop7d05ee52022-05-26 16:27:48 -0400201 'ibm.json',
202 'intel.json',
203 'pid.json',
204 'pid_zone.json',
205 'stepwise.json',
206 'virtual_sensor.json',
Andrew Geissler48edf9a2023-02-21 10:44:14 -0600207 'satellite_controller.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500208]
209
210foreach s : schemas
211 install_data(
212 join_paths('schemas', s),
213 install_dir: join_paths(
214 packagedir,
215 'configurations',
216 'schemas',
217 )
218 )
219endforeach
220
221subdir('service_files')
222subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400223
Jason M. Billsff58eba2020-04-14 16:05:30 -0700224if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800225 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400226 gtest = dependency('gtest', main: true, disabler: true, required: false)
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000227 gmock = dependency('gmock', disabler: true, required: false)
228 if not (gtest.found() and gmock.found()) and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700229 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400230 gtest_subproject = cmake.subproject('gtest')
231 cm_gtest = gtest_subproject.dependency('gtest')
232 cm_gtest_main = gtest_subproject.dependency('gtest_main')
233 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000234 gmock = gtest_subproject.dependency('gmock')
235
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400236 endif
237
238 test(
239 'test_entity_manager',
240 executable(
241 'test_entity_manager',
242 'test/test_entity-manager.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400243 'src/expression.cpp',
244 'src/utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800245 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400246 dependencies: [
247 boost,
248 gtest,
Andrew Jeffery14a7bc92021-08-02 10:01:22 +0930249 nlohmann_json_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400250 sdbusplus,
251 valijson,
252 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030253 include_directories: 'src',
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400254 )
255 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800256
257 test(
258 'test_fru_utils',
259 executable(
260 'test_fru_utils',
261 'test/test_fru-utils.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400262 'src/fru_utils.cpp',
Zev Weiss309c0b12022-02-25 01:44:12 +0000263 'src/fru_reader.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800264 cpp_args: test_boost_args,
265 dependencies: [
266 boost,
267 gtest,
Andrew Jeffery5bda1822023-01-27 13:40:21 +1030268 sdbusplus,
Patrick Venturea62466c2021-02-08 14:55:18 -0800269 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030270 include_directories: 'src',
Patrick Venturea62466c2021-02-08 14:55:18 -0800271 )
272 )
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000273
274 test(
275 'test_topology',
276 executable(
277 'test_topology',
278 'test/test_topology.cpp',
279 'src/topology.cpp',
280 cpp_args: test_boost_args,
281 dependencies: [
282 gtest,
283 gmock,
Patrick Williamsaf293612023-04-19 10:27:37 -0500284 nlohmann_json_dep,
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000285 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030286 include_directories: 'src',
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000287 )
288 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700289endif