blob: c4303fed2c3306ae5c7f788cc78b6d56dfb00344 [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)
Andrew Jefferye7948f42021-08-02 12:26:18 +093012
13cmake = import('cmake')
14
Brad Bishopec984912020-10-01 10:24:55 -040015add_project_arguments('-Wno-psabi', language: 'cpp')
Brad Bishopb4459912019-11-05 19:39:11 -050016
17boost_args = [
18 '-DBOOST_SYSTEM_NO_DEPRECATED',
19 '-DBOOST_ERROR_CODE_HEADER_ONLY',
20 '-DBOOST_NO_RTTI',
21 '-DBOOST_NO_TYPEID',
22 '-DBOOST_ALL_NO_LIB',
Ed Tanous07d467b2021-02-23 14:48:37 -080023 '-DBOOST_ALLOW_DEPRECATED_HEADERS'
Brad Bishopb4459912019-11-05 19:39:11 -050024]
25build_tests = get_option('tests')
Brad Bishope3a12b62020-01-15 11:56:29 -050026cpp = meson.get_compiler('cpp')
Brad Bishop787e8282020-01-15 12:16:53 -050027boost = dependency('boost', required: false)
28if not boost.found()
29 subproject('boost', required: false)
30 boost = declare_dependency(
31 include_directories: 'subprojects/boost_1_71_0',
32 )
Ed Tanous07d467b2021-02-23 14:48:37 -080033 boost = boost.as_system('system')
Brad Bishop787e8282020-01-15 12:16:53 -050034endif
Brad Bishop92daaaa2020-01-20 15:45:01 -050035if get_option('fru-device')
36 i2c = cpp.find_library('i2c')
37endif
Andrew Jeffery9fedd142021-08-02 10:01:22 +093038
39nlohmann_json_dep = dependency('nlohmann_json',
40 fallback: [ 'nlohmann_json', 'nlohmann_json_dep'])
41
Brad Bishop6765d902020-01-15 12:31:41 -050042sdbusplus = dependency('sdbusplus', required: false)
43if not sdbusplus.found()
Patrick Williams7f5a3362020-06-01 09:30:47 -050044 sdbusplus_proj = subproject('sdbusplus', required: true)
45 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
Ed Tanous07d467b2021-02-23 14:48:37 -080046 sdbusplus = sdbusplus.as_system('system')
Brad Bishop6765d902020-01-15 12:31:41 -050047endif
Brad Bishopb4459912019-11-05 19:39:11 -050048systemd = dependency('systemd')
49systemd_system_unit_dir = systemd.get_pkgconfig_variable(
50 'systemdsystemunitdir',
51 define_variable: ['prefix', get_option('prefix')])
52packagedir = join_paths(
53 get_option('prefix'),
54 get_option('datadir'),
55 meson.project_name(),
56)
57threads = dependency('threads')
Andrew Jefferye7948f42021-08-02 12:26:18 +093058
59valijson_dep = dependency('valijson', required: false)
60if not valijson_dep.found()
61 valijson_opt = cmake.subproject_options()
62 valijson_opt.add_cmake_defines({'valijson_BUILD_TESTS': false,
63 'valijson_BUILD_EXAMPLES': false})
64 valijson_proj = cmake.subproject('valijson', options: valijson_opt)
65 valijson_dep = valijson_proj.dependency('valijson')
66 valijson = valijson_dep.partial_dependency(includes: true).as_system()
Brad Bishopff1ddb72020-01-15 12:24:56 -050067endif
Andrew Jefferye7948f42021-08-02 12:26:18 +093068valijson = valijson.partial_dependency(includes: true).as_system()
Brad Bishopb4459912019-11-05 19:39:11 -050069
70install_data('blacklist.json')
71
72configs = [
73 '1Ux16 Riser.json',
74 '2Ux8 Riser.json',
75 '8X25 HSBP.json',
76 'A2UL16RISER.json',
77 'A2UX8X4RISER.json',
Vijay Khemkaab4535d2021-03-05 20:46:12 +000078 'ACBELL_RICA_PSU.json',
Matt Spinlerc451e8b2021-01-20 14:29:15 -060079 'Blyth.json',
Brad Bishopb4459912019-11-05 19:39:11 -050080 'AHW1UM2RISER.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030081 'ASPOWER_U1A-D10550_PSU.json',
82 'ASPOWER_U1A-D10800_PSU.json',
83 'ASPOWER_U1A-D11200_PSU.json',
84 'ASPOWER_U1A-D11600_PSU.json',
85 'ASPOWER_U1D-D10800_PSU.json',
Brad Bishopb4459912019-11-05 19:39:11 -050086 'AXX1P100HSSI_AIC.json',
87 'AXX2PRTHDHD.json',
88 'BNP Baseboard.json',
Brandon Wymaneb8a4472021-01-08 16:05:02 -060089 'Bellavista.json',
Brad Bishopb4459912019-11-05 19:39:11 -050090 'Delta DPS-750XB PSU.json',
Andrei Kartashevb32e00d2020-09-11 22:40:38 +030091 'Delta_DPS-1600AB_PSU.json',
92 'Delta_DPS-2000AB_PSU.json',
Andrew Geisslerc7c5de72020-12-16 09:47:21 -060093 'Everest.json',
Brad Bishopb4459912019-11-05 19:39:11 -050094 'F1U12X25 HSBP.json',
95 'F1U4X25 HSBP.json',
96 'F2U12X35 HSBP.json',
97 'F2U8X25 HSBP.json',
98 'FBTP.json',
99 'FBYV2.json',
100 'Flextronics S-1100ADU00-201 PSU.json',
Adriana Kobylak886c1ba2021-02-01 14:05:11 -0600101 'IBM 1000W CFFPS.json',
102 'IBM 1400W CFFPS.json',
103 'IBM 1600W CFFPS.json',
104 'IBM 2000W CFFPS.json',
105 'IBM 2300W CFFPS.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500106 'Intel Front Panel.json',
Brad Bishop55237c42020-10-01 10:08:42 -0400107 'Nisqually.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500108 'NVME P4000.json',
109 'PCIE SSD Retimer.json',
110 'PSSF132202A.json',
111 'PSSF162205A.json',
112 'PSSF212201A.json',
113 'PSSF222201A.json',
Brad Bishop5f4a0262020-10-09 08:30:19 -0400114 'Rainier 2U Chassis.json',
115 'Rainier 4U Chassis.json',
Andrew Geissler3e55ec42021-03-11 14:04:27 -0600116 'Rainier 1S4U Chassis.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500117 'R1000 Chassis.json',
118 'R2000 Chassis.json',
119 'SAS Module.json',
120 'SOLUM_PSSF162202_PSU.json',
121 'STP Baseboard.json',
122 'STP P4000 Chassis.json',
Vijay Khemka93a93262021-02-04 19:10:29 +0000123 'Tyan_S7106_Baseboard.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500124 'WFT Baseboard.json',
125]
126
127foreach c : configs
128 install_data(
129 join_paths('configurations', c),
130 install_dir: join_paths(
131 packagedir,
132 'configurations',
133 )
134 )
135endforeach
136
137schemas = [
138 'global.json',
Brad Bishop66665882020-05-07 17:05:18 -0400139 'legacy.json',
Brad Bishopb9809912020-05-07 17:15:31 -0400140 'openbmc-dbus.json',
Brad Bishop4afe7082020-10-01 09:59:26 -0400141 'IBM.json',
Brad Bishop6fe729d2020-10-01 09:54:20 -0400142 'Intel.json',
Brad Bishopb4459912019-11-05 19:39:11 -0500143 'Pid.json',
144 'Pid.Zone.json',
145 'Stepwise.json',
146]
147
148foreach s : schemas
149 install_data(
150 join_paths('schemas', s),
151 install_dir: join_paths(
152 packagedir,
153 'configurations',
154 'schemas',
155 )
156 )
157endforeach
158
159subdir('service_files')
160subdir('src')
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400161
Jason M. Billsff58eba2020-04-14 16:05:30 -0700162if not build_tests.disabled()
Patrick Venturea62466c2021-02-08 14:55:18 -0800163 test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS']
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400164 gtest = dependency('gtest', main: true, disabler: true, required: false)
165 if not gtest.found() and build_tests.enabled()
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400166 gtest_subproject = cmake.subproject('gtest')
167 cm_gtest = gtest_subproject.dependency('gtest')
168 cm_gtest_main = gtest_subproject.dependency('gtest_main')
169 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
170 endif
171
172 test(
173 'test_entity_manager',
174 executable(
175 'test_entity_manager',
176 'test/test_entity-manager.cpp',
177 'src/Utils.cpp',
Patrick Venturea62466c2021-02-08 14:55:18 -0800178 cpp_args: test_boost_args,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400179 dependencies: [
180 boost,
181 gtest,
Andrew Jeffery9fedd142021-08-02 10:01:22 +0930182 nlohmann_json_dep,
Brad Bishopb9f50cd2020-10-14 09:54:58 -0400183 sdbusplus,
184 valijson,
185 ],
186 implicit_include_directories: false,
187 include_directories: 'include',
188 )
189 )
Patrick Venturea62466c2021-02-08 14:55:18 -0800190
191 test(
192 'test_fru_utils',
193 executable(
194 'test_fru_utils',
195 'test/test_fru-utils.cpp',
196 'src/FruUtils.cpp',
197 cpp_args: test_boost_args,
198 dependencies: [
199 boost,
200 gtest,
201 ],
202 implicit_include_directories: false,
203 include_directories: 'include',
204 )
205 )
Jason M. Billsff58eba2020-04-14 16:05:30 -0700206endif