blob: b22eb7213a7432a5289dfef97201a72328a56d61 [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 Williamsa183f4a2023-08-23 06:31:19 -05007 'cpp_std=c++23'
Brad Bishopb4459912019-11-05 19:39:11 -05008 ],
9 license: 'Apache-2.0',
10 version: '0.1',
Patrick Williamsa183f4a2023-08-23 06:31:19 -050011 meson_version: '>=1.1.1',
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
Patrick Williams7e119822023-12-07 11:38:19 -060037nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Alexander Hansenc3db2c32024-08-20 15:01:38 +020038sdbusplus = dependency('sdbusplus', include_type: 'system')
39phosphor_logging_dep = dependency('phosphor-logging')
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093040
Brad Bishopb4459912019-11-05 19:39:11 -050041systemd = dependency('systemd')
Patrick Williamsee1db762023-04-12 08:05:58 -050042systemd_system_unit_dir = systemd.get_variable(
Brad Bishopb4459912019-11-05 19:39:11 -050043 'systemdsystemunitdir',
Patrick Williamsee1db762023-04-12 08:05:58 -050044 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopb4459912019-11-05 19:39:11 -050045packagedir = join_paths(
46 get_option('prefix'),
47 get_option('datadir'),
48 meson.project_name(),
49)
Andrew Jefferya9c58922021-06-01 09:28:59 +093050sysconfdir = join_paths(
51 get_option('prefix'),
52 get_option('sysconfdir'),
53 meson.project_name(),
54)
Brad Bishopb4459912019-11-05 19:39:11 -050055threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070056if cpp.has_header('valijson/validator.hpp')
57 valijson = declare_dependency()
58else
59 subproject('valijson', required: false)
60 valijson = declare_dependency(
61 include_directories: 'subprojects/valijson/include'
62 )
63 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050064endif
Brad Bishopb4459912019-11-05 19:39:11 -050065
66install_data('blacklist.json')
67
68configs = [
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040069 '1ux16_riser.json',
70 '2ux8_riser.json',
Ali El-Haj-Mahmoudffe7df42023-05-08 14:27:22 -040071 '3ypower_vast2112_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040072 '8x25_hsbp.json',
73 'a2ul16riser.json',
74 'a2ux8x4riser.json',
Alexander Hansen719432e2023-08-01 17:28:59 +020075 'acbel_r1ca2122a_psu.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -040076 'acbell_rica_psu.json',
77 'ahw1um2riser.json',
78 'aspower_u1a-d10550_psu.json',
79 'aspower_u1a-d10800_psu.json',
80 'aspower_u1a-d11200_psu.json',
81 'aspower_u1a-d11600_psu.json',
82 'aspower_u1d-d10800_psu.json',
Zev Weiss34195922024-02-20 08:06:33 +000083 'asrock_c3_medium_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040084 'asrock_e3c246d4i.json',
Zev Weiss0af35422023-11-07 03:24:33 +000085 'asrock_e3c256d4i.json',
Zev Weissfcd60112023-11-07 08:10:41 +000086 'asrock_m3_small_x86.json',
Zev Weiss86930a12023-11-07 08:10:41 +000087 'asrock_n3_xlarge_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040088 'asrock_romed8hm3.json',
Zev Weiss544d6ec2023-11-07 03:24:33 +000089 'asrock_spc621d8hm3.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -040090 'axx1p100hssi_aic.json',
91 'axx2prthdhd.json',
92 'bellavista.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040093 'bletchley_baseboard.json',
94 'bletchley_chassis.json',
Potin Lai546d3752022-11-10 08:57:47 +080095 'bletchley_frontpanel.json',
Matt Spinler513976b2024-05-13 11:24:03 -050096 'blueridge_1s4u_chassis.json',
97 'blueridge_2u_chassis.json',
98 'blueridge_4u_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -040099 'blyth.json',
100 'bmc_storage_module.json',
101 'bnp_baseboard.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600102 'bonnell.json',
Potin Lai6a504652024-04-23 15:34:51 +0800103 'brcm_100g_1p_ocp_mezz.json',
Daniel Hsu0249bbd2024-03-22 16:22:26 +0800104 'brcm_200g_1p_ocp_mezz.json',
Potin Laibdc76da2024-05-15 16:24:06 +0800105 'catalina_fio.json',
106 'catalina_hdd.json',
107 'catalina_osfp.json',
108 'catalina_pdb.json',
109 'catalina_scm.json',
Potin Laiae326c72024-02-15 15:08:31 +0800110 'cx7_ocp.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400111 'delta_awf2dc3200w_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400112 'delta_dps-1600ab_psu.json',
113 'delta_dps-2000ab_psu.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400114 'delta_dps-750xb_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400115 'everest.json',
116 'f1u12x25_hsbp.json',
117 'f1u4x25_hsbp.json',
118 'f2u12x35_hsbp.json',
119 'f2u8x25_hsbp.json',
120 'fbtp.json',
121 'fbyv2.json',
Jayashree Dhanapal90249e22022-06-13 15:00:57 +0530122 'fbyv35.json',
Jayashree Dhanapal8232a6a2022-06-21 15:50:50 +0530123 'fbyv35_nic_mellanox.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400124 'flextronics_s-1100adu00-201_psu.json',
George Liue65c37f2024-02-18 11:33:39 +0800125 'fp5280g3_chassis.json',
George Liuecaec952024-02-02 13:46:10 +0800126 'fp5280g3_fanboard.json',
Matt Spinler6ef5f712024-05-13 11:19:40 -0500127 'fuji.json',
Naresh Solankie3b65822022-11-02 10:29:38 +0100128 'genesis3_baseboard.json',
129 'genesis3_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400130 'genesis3_psu.json',
Alexander Hansenf60262d2023-07-26 13:28:15 +0200131 'gospower_g1136-1300wna_psu.json',
BonnieLo-wiwynncbaec702022-11-17 15:42:46 +0800132 'greatlakes.json',
133 'greatlakes_nic_mellanox.json',
Potin Lai16152b52023-10-31 18:48:02 +0800134 'harma_bsm.json',
135 'harma_fanboard.json',
136 'harma_mb.json',
Peter Yin96552402024-05-17 11:17:34 +0800137 'harma_mb_vr_infineon.json',
Potin Lai16152b52023-10-31 18:48:02 +0800138 'harma_scm.json',
Andrew Geissler3a1cbe22023-02-17 13:57:15 -0600139 'ibm_tacoma_rack_controller.json',
Matt Spinler6028d132024-01-17 11:25:17 -0600140 'ingraham.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400141 'intel_front_panel.json',
142 'kudo_bmc.json',
143 'kudo_motherboard.json',
Andrew Jeffery8f163c02023-09-19 16:11:01 +0930144 'micron_7450.json',
Yang Chen535568c2023-11-23 15:47:04 +0800145 'minerva_cmm.json',
Yang Chenbff584a2024-01-15 17:05:39 +0800146 'minerva_cmm_bsm.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400147 'minerva_cmm_hsc_infineon.json',
Yang Chen6254f082023-12-20 21:07:29 +0800148 'minerva_cmm_scm.json',
Yang Chen8d2ed842024-01-03 15:02:53 +0800149 'minerva_fanboard.json',
Potin Lai16152b52023-10-31 18:48:02 +0800150 'minerva_pdb.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400151 'minerva_pdb_hsc_xdp.json',
Potin Lai16152b52023-10-31 18:48:02 +0800152 'minerva_pttv.json',
Potin Lai16152b52023-10-31 18:48:02 +0800153 'minerva_sitv.json',
Jonico Eustaquioaa9bb3d2023-04-18 15:24:24 -0500154 'mori_bmc.json',
Jonico Eustaquio8809d712023-05-03 11:49:00 -0500155 'mori_motherboard.json',
Thang Q. Nguyen79865952023-06-28 09:32:32 +0700156 'mtjade.json',
Chau Lye2400c82022-12-16 04:15:43 +0000157 'mtmitchell_bmc.json',
158 'mtmitchell_mb.json',
Andrew Geissler4139c3a2023-10-12 04:34:33 -0600159 'mudflap.json',
Tao Lineb588b12024-06-06 15:42:05 +0800160 'nf5280m7_baseboard.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400161 'nisqually.json',
Tim Lee61735132024-04-29 09:59:38 +0800162 'nuvoton_npcm8xx_evb.json',
Patrick Rudolphe89005d2024-02-06 16:06:06 +0100163 'nvme_intel_p_series.json',
Patrick Rudolph72e53ab2023-11-20 08:55:55 +0100164 'nvme_p4500_p5500.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400165 'pcie_ssd_retimer.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600166 'pennybacker.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400167 'pssf132202a.json',
168 'pssf162205a.json',
169 'pssf212201a.json',
170 'pssf222201a.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400171 'r1000_chassis.json',
172 'r2000_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400173 'rainier_1s4u_chassis.json',
174 'rainier_2u_chassis.json',
175 'rainier_4u_chassis.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400176 'sas_module.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200177 'sbp1_baseboard.json',
178 'sbp1_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400179 'sbp1_hbm.json',
Patrick Rudolphe2d550f2023-09-11 15:32:38 +0200180 'sbp1_nvme.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200181 'sbp1_psu.json',
Patrick Rudolph2e614742023-11-10 15:11:51 +0100182 'sbp1_rssd.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400183 'solum_pssf162202_psu.json',
184 'storm_king.json',
185 'stp_baseboard.json',
186 'stp_p4000_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400187 'supermicro-pws-920p-sq_psu.json',
188 'system1_baseboard.json',
189 'system1_chassis.json',
Delphine CC Chiu4a2b2872024-06-07 18:18:12 +0800190 'terminus_2x100g_nic_tsff.json',
Matt Spinler43b6b192024-01-17 11:26:10 -0600191 'tola.json',
Jayashree Dhanapal10612f32022-11-02 16:12:41 +0530192 'twinlake.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400193 'tyan_s7106_baseboard.json',
194 'tyan_s8036_baseboard.json',
Andrei Kartashev9d455522022-01-11 13:27:29 +0300195 'vegman_n110_baseboard.json',
196 'vegman_rx20_baseboard.json',
197 'vegman_sx20_baseboard.json',
QuantaJasonHsu9c5a8c72024-09-30 18:50:56 +0800198 'ventura_fanboard.json',
199 'ventura_ioboard.json',
200 'ventura_ledboard.json',
201 'ventura_rmc.json',
202 'ventura_scm.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400203 'wft_baseboard.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400204 'yosemite4.json',
205 'yosemite4_chassis.json',
Ian Chien00907092024-08-14 15:02:59 +0800206 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_max.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400207 'yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_mps.json',
Ian Chien6fe52352024-08-14 15:19:43 +0800208 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_max.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400209 'yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_mps.json',
210 'yosemite4_floatingfalls.json',
211 'yosemite4_medusaboard_adc_rns_12vhsc_adi_48vhsc_inf.json',
212 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_adi.json',
213 'yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_inf.json',
214 'yosemite4_medusaboard_adc_rns_hsc_adi.json',
Yikai Tsai552e7632024-09-12 14:56:21 +0800215 'yosemite4_medusaboard_adc_rns_isl_12vhsc_adi_48vhsc_inf.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400216 'yosemite4_medusaboard_adc_ti_12vhsc_adi_48vhsc_inf.json',
217 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_adi.json',
218 'yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_inf.json',
219 'yosemite4_medusaboard_adc_ti_hsc_adi.json',
220 'yosemite4_sentineldome_chassis.json',
Delphine CC Chiu4a1eed82024-06-28 16:51:30 +0800221 'yosemite4_sentineldome_t1.json',
Ricky CX Wu0f9545f2024-08-05 10:01:07 +0800222 'yosemite4_sentineldome_t1_retimer.json',
Delphine CC Chiu4a1eed82024-06-28 16:51:30 +0800223 'yosemite4_sentineldome_t2.json',
Ricky CX Wu0f9545f2024-08-05 10:01:07 +0800224 'yosemite4_sentineldome_t2_retimer.json',
Ian Chien7ee8c022024-08-16 15:12:18 +0800225 'yosemite4_spiderboard_adc_max_pwr_ti.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400226 'yosemite4_spiderboard_adc_ti_pwr_ti.json',
227 'yosemite4_wailuafalls.json',
228 'yosemite4n.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500229]
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800230filepaths = []
Brad Bishopb4459912019-11-05 19:39:11 -0500231foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800232 file = join_paths('configurations', c)
Brad Bishopb4459912019-11-05 19:39:11 -0500233 install_data(
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800234 file,
Brad Bishopb4459912019-11-05 19:39:11 -0500235 install_dir: join_paths(
236 packagedir,
237 'configurations',
238 )
239 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800240 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500241endforeach
242
Matt Spinler7742c872024-05-02 14:13:21 -0500243if get_option('validate-json')
244 validate_script = files('scripts/validate_configs.py')
245 autojson = custom_target(
246 'check_syntax',
247 command: [
248 validate_script,
249 '-v',
250 '-k',
251 ],
252 depend_files: files(filepaths),
253 build_by_default: true,
254 capture: true,
255 output: 'validate_configs.log',
256 )
257endif
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800258
Brad Bishopb4459912019-11-05 19:39:11 -0500259schemas = [
260 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400261 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400262 'openbmc-dbus.json',
Brad Bishop7d05ee52022-05-26 16:27:48 -0400263 'ibm.json',
264 'intel.json',
265 'pid.json',
266 'pid_zone.json',
267 'stepwise.json',
268 'virtual_sensor.json',
Andrew Geissler48edf9a2023-02-21 10:44:14 -0600269 'satellite_controller.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500270]
271
272foreach s : schemas
273 install_data(
274 join_paths('schemas', s),
275 install_dir: join_paths(
276 packagedir,
277 'configurations',
278 'schemas',
279 )
280 )
281endforeach
282
283subdir('service_files')
284subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400285
Jason M. Billsff58eba2020-04-14 16:05:30 -0700286if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800287 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400288 gtest = dependency('gtest', main: true, disabler: true, required: false)
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000289 gmock = dependency('gmock', disabler: true, required: false)
290 if not (gtest.found() and gmock.found()) and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700291 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400292 gtest_subproject = cmake.subproject('gtest')
293 cm_gtest = gtest_subproject.dependency('gtest')
294 cm_gtest_main = gtest_subproject.dependency('gtest_main')
295 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000296 gmock = gtest_subproject.dependency('gmock')
297
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400298 endif
299
300 test(
301 'test_entity_manager',
302 executable(
303 'test_entity_manager',
304 'test/test_entity-manager.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400305 'src/expression.cpp',
306 'src/utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800307 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400308 dependencies: [
309 boost,
310 gtest,
Andrew Jeffery14a7bc92021-08-02 10:01:22 +0930311 nlohmann_json_dep,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200312 phosphor_logging_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400313 sdbusplus,
314 valijson,
315 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030316 include_directories: 'src',
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400317 )
318 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800319
320 test(
321 'test_fru_utils',
322 executable(
323 'test_fru_utils',
324 'test/test_fru-utils.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400325 'src/fru_utils.cpp',
Zev Weiss309c0b12022-02-25 01:44:12 +0000326 'src/fru_reader.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800327 cpp_args: test_boost_args,
328 dependencies: [
329 boost,
330 gtest,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200331 phosphor_logging_dep,
Andrew Jeffery5bda1822023-01-27 13:40:21 +1030332 sdbusplus,
Patrick Venturea62466c2021-02-08 14:55:18 -0800333 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030334 include_directories: 'src',
Patrick Venturea62466c2021-02-08 14:55:18 -0800335 )
336 )
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000337
338 test(
339 'test_topology',
340 executable(
341 'test_topology',
342 'test/test_topology.cpp',
343 'src/topology.cpp',
344 cpp_args: test_boost_args,
345 dependencies: [
346 gtest,
347 gmock,
Patrick Williamsaf293612023-04-19 10:27:37 -0500348 nlohmann_json_dep,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200349 phosphor_logging_dep,
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000350 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030351 include_directories: 'src',
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000352 )
353 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700354endif