blob: 1aaa7057db69ff507d0dc00ff8902adfd1bec342 [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
Patrick Williams7e119822023-12-07 11:38:19 -060037nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Andrew Jeffery14a7bc92021-08-02 10:01:22 +093038
Brad Bishop6765d902020-01-15 12:31:41 -050039sdbusplus = dependency('sdbusplus', required: false)
40if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050041 sdbusplus_proj = subproject('sdbusplus', required: true)
42 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080043 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050044endif
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',
79 'acbell_rica_psu.json',
Alexander Hansen719432e2023-08-01 17:28:59 +020080 'acbel_r1ca2122a_psu.json',
Zev Weiss34195922024-02-20 08:06:33 +000081 'asrock_c3_medium_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040082 'asrock_e3c246d4i.json',
Zev Weiss0af35422023-11-07 03:24:33 +000083 'asrock_e3c256d4i.json',
Zev Weissfcd60112023-11-07 08:10:41 +000084 'asrock_m3_small_x86.json',
Zev Weiss86930a12023-11-07 08:10:41 +000085 'asrock_n3_xlarge_x86.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040086 'asrock_romed8hm3.json',
Zev Weiss544d6ec2023-11-07 03:24:33 +000087 'asrock_spc621d8hm3.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040088 'bletchley_baseboard.json',
89 'bletchley_chassis.json',
Potin Lai546d3752022-11-10 08:57:47 +080090 'bletchley_frontpanel.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -040091 'blyth.json',
92 'ahw1um2riser.json',
93 'aspower_u1a-d10550_psu.json',
94 'aspower_u1a-d10800_psu.json',
95 'aspower_u1a-d11200_psu.json',
96 'aspower_u1a-d11600_psu.json',
97 'aspower_u1d-d10800_psu.json',
98 'axx1p100hssi_aic.json',
99 'axx2prthdhd.json',
Delphine CC Chiub64a3ae2024-01-17 11:17:18 +0800100 'bmc_storage_module.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400101 'bnp_baseboard.json',
102 'bellavista.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600103 'bonnell.json',
Potin Lai6a504652024-04-23 15:34:51 +0800104 'brcm_100g_1p_ocp_mezz.json',
Daniel Hsu0249bbd2024-03-22 16:22:26 +0800105 'brcm_200g_1p_ocp_mezz.json',
Potin Laiae326c72024-02-15 15:08:31 +0800106 'cx7_ocp.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400107 'delta_awf2dc3200w_psu.json',
108 'delta_dps-750xb_psu.json',
109 'delta_dps-1600ab_psu.json',
110 'delta_dps-2000ab_psu.json',
Marvin Dreesac7bae32023-05-10 09:30:35 +0200111 'supermicro-pws-920p-sq_psu.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400112 'everest.json',
113 'f1u12x25_hsbp.json',
114 'f1u4x25_hsbp.json',
115 'f2u12x35_hsbp.json',
116 'f2u8x25_hsbp.json',
117 'fbtp.json',
118 'fbyv2.json',
Jayashree Dhanapal90249e22022-06-13 15:00:57 +0530119 'fbyv35.json',
Jayashree Dhanapal8232a6a2022-06-21 15:50:50 +0530120 'fbyv35_nic_mellanox.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400121 'flextronics_s-1100adu00-201_psu.json',
George Liue65c37f2024-02-18 11:33:39 +0800122 'fp5280g3_chassis.json',
George Liuecaec952024-02-02 13:46:10 +0800123 'fp5280g3_fanboard.json',
Matt Spinler6ef5f712024-05-13 11:19:40 -0500124 'fuji.json',
Naresh Solankie3b65822022-11-02 10:29:38 +0100125 'genesis3_psu.json',
126 'genesis3_baseboard.json',
127 'genesis3_chassis.json',
Alexander Hansenf60262d2023-07-26 13:28:15 +0200128 'gospower_g1136-1300wna_psu.json',
BonnieLo-wiwynncbaec702022-11-17 15:42:46 +0800129 'greatlakes.json',
130 'greatlakes_nic_mellanox.json',
Potin Lai16152b52023-10-31 18:48:02 +0800131 'harma_bsm.json',
132 'harma_fanboard.json',
133 'harma_mb.json',
Potin Lai16152b52023-10-31 18:48:02 +0800134 'harma_scm.json',
Andrew Geissler3a1cbe22023-02-17 13:57:15 -0600135 'ibm_tacoma_rack_controller.json',
Matt Spinler6028d132024-01-17 11:25:17 -0600136 'ingraham.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400137 'intel_front_panel.json',
138 'kudo_bmc.json',
139 'kudo_motherboard.json',
Andrew Jeffery8f163c02023-09-19 16:11:01 +0930140 'micron_7450.json',
Yang Chen535568c2023-11-23 15:47:04 +0800141 'minerva_cmm.json',
Yang Chenbff584a2024-01-15 17:05:39 +0800142 'minerva_cmm_bsm.json',
Yang Chen6254f082023-12-20 21:07:29 +0800143 'minerva_cmm_scm.json',
Yang Chen8d2ed842024-01-03 15:02:53 +0800144 'minerva_fanboard.json',
Potin Lai16152b52023-10-31 18:48:02 +0800145 'minerva_pdb.json',
146 'minerva_pttv.json',
Potin Lai16152b52023-10-31 18:48:02 +0800147 'minerva_sitv.json',
Jonico Eustaquioaa9bb3d2023-04-18 15:24:24 -0500148 'mori_bmc.json',
Jonico Eustaquio8809d712023-05-03 11:49:00 -0500149 'mori_motherboard.json',
Thang Q. Nguyen79865952023-06-28 09:32:32 +0700150 'mtjade.json',
Chau Lye2400c82022-12-16 04:15:43 +0000151 'mtmitchell_bmc.json',
152 'mtmitchell_mb.json',
Andrew Geissler4139c3a2023-10-12 04:34:33 -0600153 'mudflap.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400154 'nisqually.json',
Tim Lee61735132024-04-29 09:59:38 +0800155 'nuvoton_npcm8xx_evb.json',
Patrick Rudolphe89005d2024-02-06 16:06:06 +0100156 'nvme_intel_p_series.json',
Patrick Rudolph72e53ab2023-11-20 08:55:55 +0100157 'nvme_p4500_p5500.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400158 'pcie_ssd_retimer.json',
Adriana Kobylak0b5b1222023-01-31 14:15:27 -0600159 'pennybacker.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400160 'pssf132202a.json',
161 'pssf162205a.json',
162 'pssf212201a.json',
163 'pssf222201a.json',
164 'rainier_2u_chassis.json',
165 'rainier_4u_chassis.json',
166 'rainier_1s4u_chassis.json',
167 'r1000_chassis.json',
168 'r2000_chassis.json',
169 'sas_module.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200170 'sbp1_baseboard.json',
171 'sbp1_chassis.json',
Patrick Rudolphe2d550f2023-09-11 15:32:38 +0200172 'sbp1_nvme.json',
Naresh Solanki6fa508c2023-07-31 11:36:15 +0200173 'sbp1_psu.json',
Patrick Rudolph2e614742023-11-10 15:11:51 +0100174 'sbp1_rssd.json',
Naresh Solanki9027b292023-11-24 11:20:53 +0000175 'sbp1_hbm.json',
Andrew Geissler35215e92023-10-02 06:48:05 -0500176 'system1_baseboard.json',
Chris Caincb47a832023-11-17 12:19:20 -0600177 'system1_chassis.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400178 'solum_pssf162202_psu.json',
179 'storm_king.json',
180 'stp_baseboard.json',
181 'stp_p4000_chassis.json',
Matt Spinler43b6b192024-01-17 11:26:10 -0600182 'tola.json',
Jayashree Dhanapal10612f32022-11-02 16:12:41 +0530183 'twinlake.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400184 'tyan_s7106_baseboard.json',
185 'tyan_s8036_baseboard.json',
Andrei Kartashev9d455522022-01-11 13:27:29 +0300186 'vegman_n110_baseboard.json',
187 'vegman_rx20_baseboard.json',
188 'vegman_sx20_baseboard.json',
Brad Bishopf4b2e5a2022-05-26 16:17:12 -0400189 'wft_baseboard.json',
Delphine CC Chiudf1eac92023-08-30 18:23:13 +0800190 'yosemite4_fanboard.json',
Delphine CC Chiue41b5cb2023-11-30 16:13:52 +0800191 'yosemite4_sentineldome.json',
192 'yosemite4_floatingfalls.json',
193 'yosemite4_wailuafalls.json',
Delphine CC Chiu82e6a3f2023-08-08 17:42:59 +0800194 'yosemite4.json',
195 'yosemite4_medusaboard.json',
196 'yosemite4_spiderboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500197]
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800198filepaths = []
Brad Bishopb4459912019-11-05 19:39:11 -0500199foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800200 file = join_paths('configurations', c)
Brad Bishopb4459912019-11-05 19:39:11 -0500201 install_data(
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800202 file,
Brad Bishopb4459912019-11-05 19:39:11 -0500203 install_dir: join_paths(
204 packagedir,
205 'configurations',
206 )
207 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800208 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500209endforeach
210
Matt Spinler7742c872024-05-02 14:13:21 -0500211if get_option('validate-json')
212 validate_script = files('scripts/validate_configs.py')
213 autojson = custom_target(
214 'check_syntax',
215 command: [
216 validate_script,
217 '-v',
218 '-k',
219 ],
220 depend_files: files(filepaths),
221 build_by_default: true,
222 capture: true,
223 output: 'validate_configs.log',
224 )
225endif
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800226
Brad Bishopb4459912019-11-05 19:39:11 -0500227schemas = [
228 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400229 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400230 'openbmc-dbus.json',
Brad Bishop7d05ee52022-05-26 16:27:48 -0400231 'ibm.json',
232 'intel.json',
233 'pid.json',
234 'pid_zone.json',
235 'stepwise.json',
236 'virtual_sensor.json',
Andrew Geissler48edf9a2023-02-21 10:44:14 -0600237 'satellite_controller.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500238]
239
240foreach s : schemas
241 install_data(
242 join_paths('schemas', s),
243 install_dir: join_paths(
244 packagedir,
245 'configurations',
246 'schemas',
247 )
248 )
249endforeach
250
251subdir('service_files')
252subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400253
Jason M. Billsff58eba2020-04-14 16:05:30 -0700254if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800255 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400256 gtest = dependency('gtest', main: true, disabler: true, required: false)
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000257 gmock = dependency('gmock', disabler: true, required: false)
258 if not (gtest.found() and gmock.found()) and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700259 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400260 gtest_subproject = cmake.subproject('gtest')
261 cm_gtest = gtest_subproject.dependency('gtest')
262 cm_gtest_main = gtest_subproject.dependency('gtest_main')
263 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000264 gmock = gtest_subproject.dependency('gmock')
265
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400266 endif
267
268 test(
269 'test_entity_manager',
270 executable(
271 'test_entity_manager',
272 'test/test_entity-manager.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400273 'src/expression.cpp',
274 'src/utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800275 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400276 dependencies: [
277 boost,
278 gtest,
Andrew Jeffery14a7bc92021-08-02 10:01:22 +0930279 nlohmann_json_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400280 sdbusplus,
281 valijson,
282 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030283 include_directories: 'src',
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400284 )
285 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800286
287 test(
288 'test_fru_utils',
289 executable(
290 'test_fru_utils',
291 'test/test_fru-utils.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400292 'src/fru_utils.cpp',
Zev Weiss309c0b12022-02-25 01:44:12 +0000293 'src/fru_reader.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800294 cpp_args: test_boost_args,
295 dependencies: [
296 boost,
297 gtest,
Andrew Jeffery5bda1822023-01-27 13:40:21 +1030298 sdbusplus,
Patrick Venturea62466c2021-02-08 14:55:18 -0800299 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030300 include_directories: 'src',
Patrick Venturea62466c2021-02-08 14:55:18 -0800301 )
302 )
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000303
304 test(
305 'test_topology',
306 executable(
307 'test_topology',
308 'test/test_topology.cpp',
309 'src/topology.cpp',
310 cpp_args: test_boost_args,
311 dependencies: [
312 gtest,
313 gmock,
Patrick Williamsaf293612023-04-19 10:27:37 -0500314 nlohmann_json_dep,
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000315 ],
Andrew Jefferya5d25dc2023-01-27 12:28:22 +1030316 include_directories: 'src',
Benjamin Fairf2f5b7a2022-09-09 19:45:02 +0000317 )
318 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700319endif