blob: 3f70151171a938a033ecf9e20f0b66c290d27eb8 [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',
20]
21build_tests = get_option('tests')
Brad Bishope3a12b62020-01-15 11:56:29 -050022cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050023boost = dependency('boost', required: false)
24if not boost.found()
25 subproject('boost', required: false)
26 boost = declare_dependency(
27 include_directories: 'subprojects/boost_1_71_0',
28 )
29endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050030if get_option('fru-device')
31 i2c = cpp.find_library('i2c')
32endif
Brad Bishop79a09a82020-01-15 12:23:07 -050033if cpp.has_header('nlohmann/json.hpp')
34 nlohmann_json = declare_dependency()
35else
36 subproject('nlohmann', required: false)
37 nlohmann_json = declare_dependency(
38 include_directories: [
39 'subprojects/nlohmann/single_include',
40 'subprojects/nlohmann/single_include/nlohmann',
41 ]
42 )
43endif
Brad Bishop6765d902020-01-15 12:31:41 -050044sdbusplus = dependency('sdbusplus', required: false)
45if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050046 sdbusplus_proj = subproject('sdbusplus', required: true)
47 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Brad Bishop6765d902020-01-15 12:31:41 -050048endif
Brad Bishopb4459912019-11-05 19:39:11 -050049systemd = dependency('systemd')
50systemd_system_unit_dir = systemd.get_pkgconfig_variable(
51 'systemdsystemunitdir',
52 define_variable: ['prefix', get_option('prefix')])
53packagedir = join_paths(
54 get_option('prefix'),
55 get_option('datadir'),
56 meson.project_name(),
57)
58threads = dependency('threads')
Brad Bishopff1ddb72020-01-15 12:24:56 -050059if cpp.has_header('valijson/validator.hpp')
60 valijson = declare_dependency()
61else
62 subproject('valijson', required: false)
63 valijson = declare_dependency(
64 include_directories: 'subprojects/valijson/include'
65 )
66endif
Brad Bishopb4459912019-11-05 19:39:11 -050067
68install_data('blacklist.json')
69
70configs = [
71 '1Ux16 Riser.json',
72 '2Ux8 Riser.json',
73 '8X25 HSBP.json',
74 'A2UL16RISER.json',
75 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000076 'ACBELL_RICA_PSU.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060077 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050078 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030079 'ASPOWER_U1A-D10550_PSU.json',
80 'ASPOWER_U1A-D10800_PSU.json',
81 'ASPOWER_U1A-D11200_PSU.json',
82 'ASPOWER_U1A-D11600_PSU.json',
83 'ASPOWER_U1D-D10800_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050084 'AXX1P100HSSI_AIC.json',
85 'AXX2PRTHDHD.json',
86 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060087 'Bellavista.json',
Brad Bishopb4459912019-11-05 19:39:11 -050088 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030089 'Delta_DPS-1600AB_PSU.json',
90 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060091 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -050092 'F1U12X25 HSBP.json',
93 'F1U4X25 HSBP.json',
94 'F2U12X35 HSBP.json',
95 'F2U8X25 HSBP.json',
96 'FBTP.json',
97 'FBYV2.json',
98 'Flextronics S-1100ADU00-201 PSU.json',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -060099 'IBM 1000W CFFPS.json',
100 'IBM 1400W CFFPS.json',
101 'IBM 1600W CFFPS.json',
102 'IBM 2000W CFFPS.json',
103 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500104 'Intel Front Panel.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400105 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500106 'NVME P4000.json',
107 'PCIE SSD Retimer.json',
108 'PSSF132202A.json',
109 'PSSF162205A.json',
110 'PSSF212201A.json',
111 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400112 'Rainier 2U Chassis.json',
113 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600114 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500115 'R1000 Chassis.json',
116 'R2000 Chassis.json',
117 'SAS Module.json',
118 'SOLUM_PSSF162202_PSU.json',
119 'STP Baseboard.json',
120 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000121 'Tyan_S7106_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500122 'WFT Baseboard.json',
123]
124
125foreach c : configs
126 install_data(
127 join_paths('configurations', c),
128 install_dir: join_paths(
129 packagedir,
130 'configurations',
131 )
132 )
133endforeach
134
135schemas = [
136 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400137 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400138 'openbmc-dbus.json',
Brad Bishop4afe7082020-10-01 09:59:26 -0400139 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400140 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500141 'Pid.json',
142 'Pid.Zone.json',
143 'Stepwise.json',
144]
145
146foreach s : schemas
147 install_data(
148 join_paths('schemas', s),
149 install_dir: join_paths(
150 packagedir,
151 'configurations',
152 'schemas',
153 )
154 )
155endforeach
156
157subdir('service_files')
158subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400159
Jason M. Billsff58eba2020-04-14 16:05:30 -0700160if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800161 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400162 gtest = dependency('gtest', main: true, disabler: true, required: false)
163 if not gtest.found() and build_tests.enabled()
164 cmake = import('cmake')
165 gtest_subproject = cmake.subproject('gtest')
166 cm_gtest = gtest_subproject.dependency('gtest')
167 cm_gtest_main = gtest_subproject.dependency('gtest_main')
168 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
169 endif
170
171 test(
172 'test_entity_manager',
173 executable(
174 'test_entity_manager',
175 'test/test_entity-manager.cpp',
176 'src/Utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800177 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400178 dependencies: [
179 boost,
180 gtest,
181 nlohmann_json,
182 sdbusplus,
183 valijson,
184 ],
185 implicit_include_directories: false,
186 include_directories: 'include',
187 )
188 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800189
190 test(
191 'test_fru_utils',
192 executable(
193 'test_fru_utils',
194 'test/test_fru-utils.cpp',
195 'src/FruUtils.cpp',
196 cpp_args: test_boost_args,
197 dependencies: [
198 boost,
199 gtest,
200 ],
201 implicit_include_directories: false,
202 include_directories: 'include',
203 )
204 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700205endif