blob: 7f828ac49c49ec4c5225da16e22c8cabb34ca37d [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',
7 'cpp_std=c++17'
8 ],
9 license: 'Apache-2.0',
10 version: '0.1',
11)
Brad Bishopec984912020-10-01 10:24:55 -040012add_project_arguments('-Wno-psabi', language: 'cpp')
Brad Bishopb4459912019-11-05 19:39:11 -050013
14boost_args = [
15 '-DBOOST_SYSTEM_NO_DEPRECATED',
16 '-DBOOST_ERROR_CODE_HEADER_ONLY',
17 '-DBOOST_NO_RTTI',
18 '-DBOOST_NO_TYPEID',
19 '-DBOOST_ALL_NO_LIB',
Ed Tanous07d467b2021-02-23 14:48:37 -080020 '-DBOOST_ALLOW_DEPRECATED_HEADERS'
Brad Bishopb4459912019-11-05 19:39:11 -050021]
22build_tests = get_option('tests')
Brad Bishope3a12b62020-01-15 11:56:29 -050023cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050024boost = dependency('boost', required: false)
25if not boost.found()
26 subproject('boost', required: false)
27 boost = declare_dependency(
28 include_directories: 'subprojects/boost_1_71_0',
29 )
Ed Tanous07d467b2021-02-23 14:48:37 -080030 boost = boost.as_system('system')
Brad Bishop787e8282020-01-15 12:16:53 -050031endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050032if get_option('fru-device')
33 i2c = cpp.find_library('i2c')
34endif
Ed Tanous55ae5a82021-08-02 14:00:02 -070035if cpp.has_header('nlohmann/json.hpp')
36 nlohmann_json = declare_dependency()
37else
38 subproject('nlohmann', required: false)
39 nlohmann_json = declare_dependency(
40 include_directories: [
41 'subprojects/nlohmann/single_include',
42 'subprojects/nlohmann/single_include/nlohmann',
43 ]
44 )
45 nlohmann_json = nlohmann_json.as_system('system')
46endif
Brad Bishop6765d902020-01-15 12:31:41 -050047sdbusplus = dependency('sdbusplus', required: false)
48if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050049 sdbusplus_proj = subproject('sdbusplus', required: true)
50 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080051 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050052endif
Brad Bishopb4459912019-11-05 19:39:11 -050053systemd = dependency('systemd')
54systemd_system_unit_dir = systemd.get_pkgconfig_variable(
55 'systemdsystemunitdir',
56 define_variable: ['prefix', get_option('prefix')])
57packagedir = join_paths(
58 get_option('prefix'),
59 get_option('datadir'),
60 meson.project_name(),
61)
62threads = dependency('threads')
Ed Tanous55ae5a82021-08-02 14:00:02 -070063if cpp.has_header('valijson/validator.hpp')
64 valijson = declare_dependency()
65else
66 subproject('valijson', required: false)
67 valijson = declare_dependency(
68 include_directories: 'subprojects/valijson/include'
69 )
70 valijson = valijson.as_system('system')
Brad Bishopff1ddb72020-01-15 12:24:56 -050071endif
Brad Bishopb4459912019-11-05 19:39:11 -050072
73install_data('blacklist.json')
74
75configs = [
76 '1Ux16 Riser.json',
77 '2Ux8 Riser.json',
78 '8X25 HSBP.json',
79 'A2UL16RISER.json',
80 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000081 'ACBELL_RICA_PSU.json',
Zev Weiss43e1d7a2021-09-08 16:30:39 -050082 'ASRock_E3C246D4I.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060083 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050084 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030085 'ASPOWER_U1A-D10550_PSU.json',
86 'ASPOWER_U1A-D10800_PSU.json',
87 'ASPOWER_U1A-D11200_PSU.json',
88 'ASPOWER_U1A-D11600_PSU.json',
89 'ASPOWER_U1D-D10800_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050090 'AXX1P100HSSI_AIC.json',
91 'AXX2PRTHDHD.json',
92 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060093 'Bellavista.json',
Brad Bishopb4459912019-11-05 19:39:11 -050094 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030095 'Delta_DPS-1600AB_PSU.json',
96 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060097 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -050098 'F1U12X25 HSBP.json',
99 'F1U4X25 HSBP.json',
100 'F2U12X35 HSBP.json',
101 'F2U8X25 HSBP.json',
102 'FBTP.json',
103 'FBYV2.json',
104 'Flextronics S-1100ADU00-201 PSU.json',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -0600105 'IBM 1000W CFFPS.json',
106 'IBM 1400W CFFPS.json',
107 'IBM 1600W CFFPS.json',
108 'IBM 2000W CFFPS.json',
109 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500110 'Intel Front Panel.json',
Mustafa Shehabi09929ac2021-07-28 17:32:05 -0500111 'Kudo_BMC.json',
112 'Kudo_Motherboard.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400113 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500114 'NVME P4000.json',
115 'PCIE SSD Retimer.json',
116 'PSSF132202A.json',
117 'PSSF162205A.json',
118 'PSSF212201A.json',
119 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400120 'Rainier 2U Chassis.json',
121 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600122 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500123 'R1000 Chassis.json',
124 'R2000 Chassis.json',
125 'SAS Module.json',
126 'SOLUM_PSSF162202_PSU.json',
127 'STP Baseboard.json',
128 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000129 'Tyan_S7106_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500130 'WFT Baseboard.json',
131]
132
133foreach c : configs
134 install_data(
135 join_paths('configurations', c),
136 install_dir: join_paths(
137 packagedir,
138 'configurations',
139 )
140 )
141endforeach
142
143schemas = [
144 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400145 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400146 'openbmc-dbus.json',
Brad Bishop4afe7082020-10-01 09:59:26 -0400147 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400148 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500149 'Pid.json',
150 'Pid.Zone.json',
151 'Stepwise.json',
Rashmica Guptae23af562021-07-29 15:12:16 +1000152 'VirtualSensor.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500153]
154
155foreach s : schemas
156 install_data(
157 join_paths('schemas', s),
158 install_dir: join_paths(
159 packagedir,
160 'configurations',
161 'schemas',
162 )
163 )
164endforeach
165
166subdir('service_files')
167subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400168
Jason M. Billsff58eba2020-04-14 16:05:30 -0700169if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800170 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400171 gtest = dependency('gtest', main: true, disabler: true, required: false)
172 if not gtest.found() and build_tests.enabled()
Ed Tanous55ae5a82021-08-02 14:00:02 -0700173 cmake = import('cmake')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400174 gtest_subproject = cmake.subproject('gtest')
175 cm_gtest = gtest_subproject.dependency('gtest')
176 cm_gtest_main = gtest_subproject.dependency('gtest_main')
177 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
178 endif
179
180 test(
181 'test_entity_manager',
182 executable(
183 'test_entity_manager',
184 'test/test_entity-manager.cpp',
185 'src/Utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800186 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400187 dependencies: [
188 boost,
189 gtest,
Ed Tanous55ae5a82021-08-02 14:00:02 -0700190 nlohmann_json,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400191 sdbusplus,
192 valijson,
193 ],
194 implicit_include_directories: false,
195 include_directories: 'include',
196 )
197 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800198
199 test(
200 'test_fru_utils',
201 executable(
202 'test_fru_utils',
203 'test/test_fru-utils.cpp',
204 'src/FruUtils.cpp',
205 cpp_args: test_boost_args,
206 dependencies: [
207 boost,
208 gtest,
209 ],
210 implicit_include_directories: false,
211 include_directories: 'include',
212 )
213 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700214endif