blob: 0e5d21dc0049588abda08b1f5dbbea7fccee0e87 [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
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')
47systemd_system_unit_dir = systemd.get_pkgconfig_variable(
48 'systemdsystemunitdir',
49 define_variable: ['prefix', get_option('prefix')])
50packagedir = 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',
76 '8x25_hsbp.json',
77 'a2ul16riser.json',
78 'a2ux8x4riser.json',
79 'acbell_rica_psu.json',
80 'asrock_e3c246d4i.json',
81 'asrock_romed8hm3.json',
82 'bletchley_baseboard.json',
83 'bletchley_chassis.json',
84 'blyth.json',
85 'ahw1um2riser.json',
86 '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',
91 'axx1p100hssi_aic.json',
92 'axx2prthdhd.json',
93 'bnp_baseboard.json',
94 'bellavista.json',
95 'delta_awf2dc3200w_psu.json',
96 'delta_dps-750xb_psu.json',
97 'delta_dps-1600ab_psu.json',
98 'delta_dps-2000ab_psu.json',
99 'everest.json',
100 'f1u12x25_hsbp.json',
101 'f1u4x25_hsbp.json',
102 'f2u12x35_hsbp.json',
103 'f2u8x25_hsbp.json',
104 'fbtp.json',
105 'fbyv2.json',
106 'flextronics_s-1100adu00-201_psu.json',
107 'ibm_1000w_cffps.json',
108 'ibm_1400w_cffps.json',
109 'ibm_1600w_cffps.json',
110 'ibm_2000w_cffps.json',
111 'ibm_2300w_cffps.json',
112 'intel_front_panel.json',
113 'kudo_bmc.json',
114 'kudo_motherboard.json',
115 'mt_jade.json',
116 'nisqually.json',
117 'nvme_p4000.json',
118 'pcie_ssd_retimer.json',
119 'pssf132202a.json',
120 'pssf162205a.json',
121 'pssf212201a.json',
122 'pssf222201a.json',
123 'rainier_2u_chassis.json',
124 'rainier_4u_chassis.json',
125 'rainier_1s4u_chassis.json',
126 'r1000_chassis.json',
127 'r2000_chassis.json',
128 'sas_module.json',
129 'solum_pssf162202_psu.json',
130 'storm_king.json',
131 'stp_baseboard.json',
132 'stp_p4000_chassis.json',
133 'tyan_s7106_baseboard.json',
134 'tyan_s8036_baseboard.json',
135 'wft_baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500136]
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800137filepaths = []
Brad Bishopb4459912019-11-05 19:39:11 -0500138foreach c : configs
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800139 file = join_paths('configurations', c)
Brad Bishopb4459912019-11-05 19:39:11 -0500140 install_data(
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800141 file,
Brad Bishopb4459912019-11-05 19:39:11 -0500142 install_dir: join_paths(
143 packagedir,
144 'configurations',
145 )
146 )
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800147 filepaths += [file]
Brad Bishopb4459912019-11-05 19:39:11 -0500148endforeach
149
Ed Tanous9dc2cc52021-12-20 16:05:49 -0800150validate_script = files('scripts/validate-configs.py')
151autojson = custom_target(
152 'check_syntax',
153 command: [
154 validate_script,
155 '-v',
156 '-k',
157 ],
158 depend_files: files(filepaths),
159 build_by_default: true,
160 capture: true,
161 output: 'validate_configs.log',
162)
163
Brad Bishopb4459912019-11-05 19:39:11 -0500164schemas = [
165 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400166 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400167 'openbmc-dbus.json',
Brad Bishop7d05ee52022-05-26 16:27:48 -0400168 'ibm.json',
169 'intel.json',
170 'pid.json',
171 'pid_zone.json',
172 'stepwise.json',
173 'virtual_sensor.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500174]
175
176foreach s : schemas
177 install_data(
178 join_paths('schemas', s),
179 install_dir: join_paths(
180 packagedir,
181 'configurations',
182 'schemas',
183 )
184 )
185endforeach
186
187subdir('service_files')
188subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400189
Jason M. Billsff58eba2020-04-14 16:05:30 -0700190if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800191 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400192 gtest = dependency('gtest', main: true, disabler: true, required: false)
193 if not gtest.found() and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700194 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400195 gtest_subproject = cmake.subproject('gtest')
196 cm_gtest = gtest_subproject.dependency('gtest')
197 cm_gtest_main = gtest_subproject.dependency('gtest_main')
198 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
199 endif
200
201 test(
202 'test_entity_manager',
203 executable(
204 'test_entity_manager',
205 'test/test_entity-manager.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400206 'src/expression.cpp',
207 'src/utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800208 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400209 dependencies: [
210 boost,
211 gtest,
Andrew Jeffery14a7bc92021-08-02 10:01:22 +0930212 nlohmann_json_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400213 sdbusplus,
214 valijson,
215 ],
216 implicit_include_directories: false,
217 include_directories: 'include',
218 )
219 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800220
221 test(
222 'test_fru_utils',
223 executable(
224 'test_fru_utils',
225 'test/test_fru-utils.cpp',
Brad Bishope45d8c72022-05-25 15:12:53 -0400226 'src/fru_utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800227 cpp_args: test_boost_args,
228 dependencies: [
229 boost,
230 gtest,
231 ],
232 implicit_include_directories: false,
233 include_directories: 'include',
234 )
235 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700236endif