blob: 311a93cdd4c72f4ec5aacc093c6a8d69f5b35d1a [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
Chris Sides2ab73412024-10-15 16:04:11 -050037if get_option('devicetree-vpd')
38 phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces', include_type: 'system')
39endif
40
Patrick Williams7e119822023-12-07 11:38:19 -060041nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Alexander Hansenc3db2c32024-08-20 15:01:38 +020042sdbusplus = dependency('sdbusplus', include_type: 'system')
43phosphor_logging_dep = dependency('phosphor-logging')
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093044
Brad Bishopb4459912019-11-05 19:39:11 -050045systemd = dependency('systemd')
Patrick Williamsee1db762023-04-12 08:05:58 -050046systemd_system_unit_dir = systemd.get_variable(
Brad Bishopb4459912019-11-05 19:39:11 -050047 'systemdsystemunitdir',
Patrick Williamsee1db762023-04-12 08:05:58 -050048 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopb4459912019-11-05 19:39:11 -050049packagedir = join_paths(
50 get_option('prefix'),
51 get_option('datadir'),
52 meson.project_name(),
53)
Andrew Jefferya9c58922021-06-01 09:28:59 +093054sysconfdir = join_paths(
55 get_option('prefix'),
56 get_option('sysconfdir'),
57 meson.project_name(),
58)
Brad Bishopb4459912019-11-05 19:39:11 -050059threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070060if cpp.has_header('valijson/validator.hpp')
61 valijson = declare_dependency()
62else
63 subproject('valijson', required: false)
64 valijson = declare_dependency(
65 include_directories: 'subprojects/valijson/include'
66 )
67 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050068endif
Brad Bishopb4459912019-11-05 19:39:11 -050069
70install_data('blacklist.json')
71
72configs = [
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040073 '1ux16_riser.json',
74 '2ux8_riser.json',
Ali El-Haj-Mahmoudffe7df42023-05-08 14:27:22 -040075 '3ypower_vast2112_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040076 '8x25_hsbp.json',
77 'a2ul16riser.json',
78 'a2ux8x4riser.json',
Alexander Hansen719432e2023-08-01 17:28:59 +020079 'acbel_r1ca2122a_psu.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -040080 'acbell_rica_psu.json',
81 'ahw1um2riser.json',
82 'aspower_u1a-d10550_psu.json',
83 'aspower_u1a-d10800_psu.json',
84 'aspower_u1a-d11200_psu.json',
85 'aspower_u1a-d11600_psu.json',
86 'aspower_u1d-d10800_psu.json',
Zev Weiss34195922024-02-20 08:06:33 +000087 'asrock_c3_medium_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040088 'asrock_e3c246d4i.json',
Zev Weiss0af35422023-11-07 03:24:33 +000089 'asrock_e3c256d4i.json',
Zev Weissfcd60112023-11-07 08:10:41 +000090 'asrock_m3_small_x86.json',
Zev Weiss86930a12023-11-07 08:10:41 +000091 'asrock_n3_xlarge_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040092 'asrock_romed8hm3.json',
Zev Weiss544d6ec2023-11-07 03:24:33 +000093 'asrock_spc621d8hm3.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -040094 'axx1p100hssi_aic.json',
95 'axx2prthdhd.json',
96 'bellavista.json',
Matt Spinler513976b2024-05-13 11:24:03 -050097 'blueridge_1s4u_chassis.json',
98 'blueridge_2u_chassis.json',
99 'blueridge_4u_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400100 'blyth.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400101 '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 Laiae326c72024-02-15 15:08:31 +0800105 'cx7_ocp.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400106 'delta_awf2dc3200w_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400107 'delta_dps-1600ab_psu.json',
108 'delta_dps-2000ab_psu.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400109 'delta_dps-750xb_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400110 'everest.json',
111 'f1u12x25_hsbp.json',
112 'f1u4x25_hsbp.json',
113 'f2u12x35_hsbp.json',
114 'f2u8x25_hsbp.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400115 'flextronics_s-1100adu00-201_psu.json',
George Liue65c37f2024-02-18 11:33:39 +0800116 'fp5280g3_chassis.json',
George Liuecaec952024-02-02 13:46:10 +0800117 'fp5280g3_fanboard.json',
Matt Spinler6ef5f712024-05-13 11:19:40 -0500118 'fuji.json',
Naresh Solankie3b65822022-11-02 10:29:38 +0100119 'genesis3_baseboard.json',
120 'genesis3_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400121 'genesis3_psu.json',
Alexander Hansenf60262d2023-07-26 13:28:15 +0200122 'gospower_g1136-1300wna_psu.json',
Andrew Geissler3a1cbe22023-02-17 13:57:15 -0600123 'ibm_tacoma_rack_controller.json',
Matt Spinler6028d132024-01-17 11:25:17 -0600124 'ingraham.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400125 'intel_front_panel.json',
126 'kudo_bmc.json',
127 'kudo_motherboard.json',
Patrick Williams1642b652024-09-05 22:29:08 -0400128 'meta/bletchley_baseboard.json',
129 'meta/bletchley_chassis.json',
130 'meta/bletchley_frontpanel.json',
131 'meta/bmc_storage_module.json',
132 'meta/catalina_fio.json',
133 'meta/catalina_hdd.json',
134 'meta/catalina_hdd_nvme.json',
135 'meta/catalina_osfp.json',
136 'meta/catalina_pdb.json',
137 'meta/catalina_scm.json',
138 'meta/fbtp.json',
139 'meta/fbyv2.json',
140 'meta/fbyv35.json',
141 'meta/fbyv35_nic_mellanox.json',
142 'meta/greatlakes.json',
143 'meta/greatlakes_nic_mellanox.json',
144 'meta/harma_bsm.json',
145 'meta/harma_fanboard.json',
146 'meta/harma_mb.json',
147 'meta/harma_mb_vr_infineon.json',
148 'meta/harma_scm.json',
149 'meta/minerva_cmm.json',
150 'meta/minerva_cmm_bsm.json',
151 'meta/minerva_cmm_hsc_infineon.json',
152 'meta/minerva_cmm_scm.json',
153 'meta/minerva_fanboard.json',
154 'meta/minerva_pdb.json',
155 'meta/minerva_pdb_hsc_xdp.json',
156 'meta/minerva_pttv.json',
157 'meta/minerva_sitv.json',
158 'meta/terminus_2x100g_nic_tsff.json',
159 'meta/twinlake.json',
160 'meta/ventura_fanboard.json',
161 'meta/ventura_ioboard.json',
162 'meta/ventura_ledboard.json',
163 'meta/ventura_rmc.json',
164 'meta/ventura_scm.json',
165 'meta/yosemite4.json',
166 'meta/yosemite4_chassis.json',
167 'meta/yosemite4_cpu.json',
168 'meta/yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_max.json',
169 'meta/yosemite4_fanboard_fsc_max_adc_ti_led_nxp_efuse_mps.json',
170 'meta/yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_max.json',
171 'meta/yosemite4_fanboard_fsc_nct_adc_max_led_ons_efuse_mps.json',
172 'meta/yosemite4_floatingfalls.json',
173 'meta/yosemite4_medusaboard_adc_rns_12vhsc_adi_48vhsc_inf.json',
174 'meta/yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_adi.json',
175 'meta/yosemite4_medusaboard_adc_rns_12vhsc_mps_48vhsc_inf.json',
176 'meta/yosemite4_medusaboard_adc_rns_hsc_adi.json',
177 'meta/yosemite4_medusaboard_adc_rns_isl_12vhsc_adi_48vhsc_inf.json',
Leo Yang2e981562024-12-03 11:10:44 +0800178 'meta/yosemite4_medusaboard_adc_rns_isl_12vhsc_mps_48vhsc_adi.json',
179 'meta/yosemite4_medusaboard_adc_rns_isl_12vhsc_mps_48vhsc_inf.json',
180 'meta/yosemite4_medusaboard_adc_rns_isl_hsc_adi.json',
Patrick Williams1642b652024-09-05 22:29:08 -0400181 'meta/yosemite4_medusaboard_adc_ti_12vhsc_adi_48vhsc_inf.json',
182 'meta/yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_adi.json',
183 'meta/yosemite4_medusaboard_adc_ti_12vhsc_mps_48vhsc_inf.json',
184 'meta/yosemite4_medusaboard_adc_ti_hsc_adi.json',
185 'meta/yosemite4_sentineldome_chassis.json',
186 'meta/yosemite4_sentineldome_t1.json',
187 'meta/yosemite4_sentineldome_t1_retimer.json',
188 'meta/yosemite4_sentineldome_t2.json',
189 'meta/yosemite4_sentineldome_t2_retimer.json',
190 'meta/yosemite4_spiderboard_adc_max_pwr_ti.json',
191 'meta/yosemite4_spiderboard_adc_ti_pwr_ti.json',
192 'meta/yosemite4_wailuafalls.json',
193 'meta/yosemite4n.json',
Andrew Jeffery8f163c02023-09-19 16:11:01 +0930194 'micron_7450.json',
Jonico Eustaquioaa9bb3d2023-04-18 15:24:24 -0500195 'mori_bmc.json',
Jonico Eustaquio8809d712023-05-03 11:49:00 -0500196 'mori_motherboard.json',
Thang Q. Nguyen79865952023-06-28 09:32:32 +0700197 'mtjade.json',
Hieu Huynh35a09912024-10-23 07:32:03 +0000198 'mtjefferson_bmc.json',
Hieu Huynhf3302c22024-11-05 07:36:05 +0000199 'mtjefferson_bp.json',
Hieu Huynh35a09912024-10-23 07:32:03 +0000200 'mtjefferson_mb.json',
Chau Lyd2928bd2024-10-24 08:01:21 +0000201 'mtmitchell_bmc.json',
202 'mtmitchell_bp.json',
203 'mtmitchell_mb.json',
204 'mtmitchell_riser.json',
Andrew Geissler4139c3a2023-10-12 04:34:33 -0600205 'mudflap.json',
Tao Lineb588b12024-06-06 15:42:05 +0800206 'nf5280m7_baseboard.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400207 'nisqually.json',
Tim Lee61735132024-04-29 09:59:38 +0800208 'nuvoton_npcm8xx_evb.json',
Potin Laia74d5432024-08-19 20:52:36 +0800209 'nvidia_gb200.json',
Patrick Williams9effc362024-11-09 06:18:18 -0500210 'nvidia_gb200_io_board.json',
Potin Lai7eaeb8b2024-08-19 20:49:55 +0800211 'nvidia_hmc.json',
Patrick Rudolphe89005d2024-02-06 16:06:06 +0100212 'nvme_intel_p_series.json',
Patrick Rudolph72e53ab2023-11-20 08:55:55 +0100213 'nvme_p4500_p5500.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400214 'pcie_ssd_retimer.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600215 'pennybacker.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400216 'pssf132202a.json',
217 'pssf162205a.json',
218 'pssf212201a.json',
219 'pssf222201a.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400220 'r1000_chassis.json',
221 'r2000_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400222 'rainier_1s4u_chassis.json',
223 'rainier_2u_chassis.json',
224 'rainier_4u_chassis.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400225 'sas_module.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200226 'sbp1_baseboard.json',
227 'sbp1_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400228 'sbp1_hbm.json',
Patrick Rudolphe2d550f2023-09-11 15:32:38 +0200229 'sbp1_nvme.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200230 'sbp1_psu.json',
Patrick Rudolph2e614742023-11-10 15:11:51 +0100231 'sbp1_rssd.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400232 'solum_pssf162202_psu.json',
233 'storm_king.json',
234 'stp_baseboard.json',
235 'stp_p4000_chassis.json',
Patrick Williams87c3fce2024-09-04 16:56:54 -0400236 'supermicro-pws-920p-sq_psu.json',
237 'system1_baseboard.json',
238 'system1_chassis.json',
Matt Spinler43b6b192024-01-17 11:26:10 -0600239 'tola.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400240 'tyan_s7106_baseboard.json',
241 'tyan_s8036_baseboard.json',
Andrei Kartashev9d455522022-01-11 13:27:29 +0300242 'vegman_n110_baseboard.json',
243 'vegman_rx20_baseboard.json',
244 'vegman_sx20_baseboard.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400245 'wft_baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500246]
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800247filepaths = []
Brad Bishopb4459912019-11-05 19:39:11 -0500248foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800249 file = join_paths('configurations', c)
Brad Bishopb4459912019-11-05 19:39:11 -0500250 install_data(
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800251 file,
Brad Bishopb4459912019-11-05 19:39:11 -0500252 install_dir: join_paths(
253 packagedir,
254 'configurations',
255 )
256 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800257 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500258endforeach
259
Matt Spinler7742c872024-05-02 14:13:21 -0500260if get_option('validate-json')
261 validate_script = files('scripts/validate_configs.py')
262 autojson = custom_target(
263 'check_syntax',
264 command: [
265 validate_script,
266 '-v',
267 '-k',
268 ],
269 depend_files: files(filepaths),
270 build_by_default: true,
271 capture: true,
272 output: 'validate_configs.log',
273 )
274endif
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800275
Brad Bishopb4459912019-11-05 19:39:11 -0500276schemas = [
277 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400278 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400279 'openbmc-dbus.json',
Brad Bishop7d05ee52022-05-26 16:27:48 -0400280 'ibm.json',
281 'intel.json',
282 'pid.json',
283 'pid_zone.json',
284 'stepwise.json',
285 'virtual_sensor.json',
Andrew Geissler48edf9a2023-02-21 10:44:14 -0600286 'satellite_controller.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500287]
288
289foreach s : schemas
290 install_data(
291 join_paths('schemas', s),
292 install_dir: join_paths(
293 packagedir,
294 'configurations',
295 'schemas',
296 )
297 )
298endforeach
299
300subdir('service_files')
301subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400302
Jason M. Billsff58eba2020-04-14 16:05:30 -0700303if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800304 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400305 gtest = dependency('gtest', main: true, disabler: true, required: false)
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000306 gmock = dependency('gmock', disabler: true, required: false)
307 if not (gtest.found() and gmock.found()) and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700308 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400309 gtest_subproject = cmake.subproject('gtest')
310 cm_gtest = gtest_subproject.dependency('gtest')
311 cm_gtest_main = gtest_subproject.dependency('gtest_main')
312 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000313 gmock = gtest_subproject.dependency('gmock')
314
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400315 endif
316
317 test(
318 'test_entity_manager',
319 executable(
320 'test_entity_manager',
321 'test/test_entity-manager.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400322 'src/expression.cpp',
323 'src/utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800324 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400325 dependencies: [
326 boost,
327 gtest,
Andrew Jeffery14a7bc92021-08-02 10:01:22 +0930328 nlohmann_json_dep,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200329 phosphor_logging_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400330 sdbusplus,
331 valijson,
332 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030333 include_directories: 'src',
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400334 )
335 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800336
337 test(
338 'test_fru_utils',
339 executable(
340 'test_fru_utils',
341 'test/test_fru-utils.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400342 'src/fru_utils.cpp',
Zev Weiss309c0b12022-02-25 01:44:12 +0000343 'src/fru_reader.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800344 cpp_args: test_boost_args,
345 dependencies: [
346 boost,
347 gtest,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200348 phosphor_logging_dep,
Andrew Jeffery5bda1822023-01-27 13:40:21 +1030349 sdbusplus,
Patrick Venturea62466c2021-02-08 14:55:18 -0800350 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030351 include_directories: 'src',
Patrick Venturea62466c2021-02-08 14:55:18 -0800352 )
353 )
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000354
355 test(
356 'test_topology',
357 executable(
358 'test_topology',
359 'test/test_topology.cpp',
360 'src/topology.cpp',
361 cpp_args: test_boost_args,
362 dependencies: [
363 gtest,
364 gmock,
Patrick Williamsaf293612023-04-19 10:27:37 -0500365 nlohmann_json_dep,
Alexander Hansenc3db2c32024-08-20 15:01:38 +0200366 phosphor_logging_dep,
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000367 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030368 include_directories: 'src',
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000369 )
370 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700371endif