blob: aeb6445166a31257aebfd05fd7506b625fe7dee4 [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 = [
74 '1Ux16 Riser.json',
75 '2Ux8 Riser.json',
76 '8X25 HSBP.json',
77 'A2UL16RISER.json',
78 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000079 'ACBELL_RICA_PSU.json',
Zev Weiss43e1d7a2021-09-08 16:30:39 -050080 'ASRock_E3C246D4I.json',
Zev Weiss1f304b42022-04-01 15:40:28 -070081 'ASRock_ROMED8HM3.json',
Potin Lai52f56092021-12-15 10:35:42 +080082 'Bletchley_Baseboard.json',
83 'Bletchley_Chassis.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060084 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050085 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030086 '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',
Brad Bishopb4459912019-11-05 19:39:11 -050091 'AXX1P100HSSI_AIC.json',
92 'AXX2PRTHDHD.json',
93 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060094 'Bellavista.json',
Zev Weissee4b6362022-02-14 16:01:27 -080095 'Delta_AWF2DC3200W_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050096 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030097 'Delta_DPS-1600AB_PSU.json',
98 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060099 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500100 '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',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -0600107 'IBM 1000W CFFPS.json',
108 'IBM 1400W CFFPS.json',
109 'IBM 1600W CFFPS.json',
110 'IBM 2000W CFFPS.json',
111 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500112 'Intel Front Panel.json',
Mustafa Shehabi09929ac2021-07-28 17:32:05 -0500113 'Kudo_BMC.json',
114 'Kudo_Motherboard.json',
Thang Q. Nguyenf466cce2021-11-26 06:08:03 +0000115 'Mt_Jade.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400116 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500117 'NVME P4000.json',
118 'PCIE SSD Retimer.json',
119 'PSSF132202A.json',
120 'PSSF162205A.json',
121 'PSSF212201A.json',
122 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400123 'Rainier 2U Chassis.json',
124 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600125 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500126 'R1000 Chassis.json',
127 'R2000 Chassis.json',
128 'SAS Module.json',
129 'SOLUM_PSSF162202_PSU.json',
Bruce Mitchell849c07d2021-07-01 13:12:37 -0500130 'Storm King.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500131 'STP Baseboard.json',
132 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000133 'Tyan_S7106_Baseboard.json',
Ali El-Haj-Mahmoud32fc0a52022-02-16 17:02:52 -0500134 'Tyan_S8036_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500135 'WFT Baseboard.json',
136]
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 Bishop4afe7082020-10-01 09:59:26 -0400168 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400169 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500170 'Pid.json',
171 'Pid.Zone.json',
172 'Stepwise.json',
Rashmica Guptae23af562021-07-29 15:12:16 +1000173 'VirtualSensor.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