blob: cb47f07b5033a8b67da3da783ff5070dc5a406df [file] [log] [blame]
Ed Tanousf2caadc2024-01-02 18:34:36 -08001project(
2 'bmcweb',
3 'cpp',
4 version: '1.0',
Ed Tanous8dc3ddf2024-06-25 13:00:16 -07005 meson_version: '>=1.3.0',
Ed Tanousf2caadc2024-01-02 18:34:36 -08006 default_options: [
7 'b_lto_mode=default',
8 'b_lto_threads=0',
9 'b_lto=true',
10 'b_ndebug=if-release',
11 'buildtype=debugoptimized',
12 'cpp_rtti=false',
Patrick Williams921cfcd2023-08-23 06:31:07 -050013 'cpp_std=c++23',
Ed Tanousf2caadc2024-01-02 18:34:36 -080014 'warning_level=3',
15 'werror=true',
16 ],
17)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053018
19# Project related links
20
21project_pretty_name = 'bmcweb'
22project_url = 'https://github.com/openbmc/' + project_pretty_name
23project_issues_url = project_url + '/issues/new'
Ed Tanousf2caadc2024-01-02 18:34:36 -080024summary('Issues', project_issues_url, section: 'Report Issues')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053025
26# Validate the c++ Standard
27
Patrick Williams921cfcd2023-08-23 06:31:07 -050028if get_option('cpp_std') != 'c++23'
29 error('This project requires c++23 support')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053030endif
31
32# Get compiler and default build type
33
34cxx = meson.get_compiler('cpp')
35build = get_option('buildtype')
36optimization = get_option('optimization')
Ed Tanousf2caadc2024-01-02 18:34:36 -080037summary('Build Type', build, section: 'Build Info')
38summary('Optimization', optimization, section: 'Build Info')
Ed Tanous5e34b672021-02-05 14:21:27 -080039
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053040# remove debug information for minsize buildtype
Ed Tanousf2caadc2024-01-02 18:34:36 -080041if (get_option('buildtype') == 'minsize')
Ed Tanous92e26be2024-08-21 13:39:14 -070042 add_project_arguments(
43 ['-fdata-sections', '-ffunction-sections'],
44 language: 'cpp',
45 )
Ed Tanousf2caadc2024-01-02 18:34:36 -080046 add_project_arguments('-DNDEBUG', language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053047endif
48
Ed Tanousf2caadc2024-01-02 18:34:36 -080049if (get_option('dns-resolver') == 'systemd-dbus')
50 add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp')
Ed Tanousf8ca6d72022-06-28 12:12:03 -070051endif
52
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053053# Disable lto when compiling with no optimization
Ed Tanousf2caadc2024-01-02 18:34:36 -080054if (get_option('optimization') == '0')
55 add_project_arguments('-fno-lto', language: 'cpp')
56 message('Disabling lto & its supported features as optimization is disabled')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053057endif
58
59# Include Directories
60
Ed Tanous92e26be2024-08-21 13:39:14 -070061incdir = include_directories(
62 'include',
63 'redfish-core/include',
64 'redfish-core/lib',
65 'http',
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -070066)
Ed Tanous92e26be2024-08-21 13:39:14 -070067incdir_cli = include_directories('http', 'include')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053068
Ed Tanousf2caadc2024-01-02 18:34:36 -080069if (get_option('tests').allowed())
Ed Tanous25b54db2024-04-17 15:40:31 -070070 summary('unittest', 'NA', section: 'Features')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053071endif
72
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053073# Add compiler arguments
74
Ed Tanousade3f092024-03-13 13:28:36 -070075if (cxx.get_id() == 'clang')
Ed Tanousf2caadc2024-01-02 18:34:36 -080076 if (cxx.version().version_compare('<17.0'))
77 error('This project requires clang-17 or higher')
78 endif
79 add_project_arguments(
80 '-Weverything',
81 '-Wformat=2',
82 '-Wno-c++98-compat-pedantic',
83 '-Wno-c++98-compat',
Ed Tanous25991f72024-06-13 18:10:25 -070084 '-Wno-c++20-extensions',
Ed Tanousf2caadc2024-01-02 18:34:36 -080085 '-Wno-documentation-unknown-command',
86 '-Wno-documentation',
87 '-Wno-exit-time-destructors',
88 '-Wno-global-constructors',
89 '-Wno-newline-eof',
90 '-Wno-padded',
91 '-Wno-shadow',
92 '-Wno-used-but-marked-unused',
93 '-Wno-weak-vtables',
94 '-Wno-switch-enum',
95 '-Wno-unused-macros',
96 '-Wno-covered-switch-default',
Ed Tanousf88b2172022-04-15 13:55:05 -070097 '-Wno-disabled-macro-expansion',
Ed Tanous724985f2024-06-05 09:19:06 -070098 '-Wno-unneeded-internal-declaration',
Ed Tanous60b8de32024-12-18 11:01:53 -080099 '-Wno-unsafe-buffer-usage-in-container',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800100 language: 'cpp',
101 )
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530102endif
103
Ed Tanousade3f092024-03-13 13:28:36 -0700104if (cxx.get_id() == 'gcc')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800105 if (cxx.version().version_compare('<13.0'))
106 error('This project requires gcc-13 or higher')
107 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530108
Ed Tanousf2caadc2024-01-02 18:34:36 -0800109 add_project_arguments(
110 '-Wformat=2',
111 '-Wcast-align',
112 '-Wconversion',
113 '-Woverloaded-virtual',
114 '-Wsign-conversion',
115 '-Wunused',
116 '-Wduplicated-cond',
117 '-Wduplicated-branches',
118 '-Wlogical-op',
119 '-Wnull-dereference',
120 '-Wunused-parameter',
121 '-Wdouble-promotion',
122 '-Wshadow',
123 '-Wno-psabi',
124 '-Wno-attributes',
125 language: 'cpp',
126 )
Ed Tanousc66403c2021-09-22 15:28:57 -0700127endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530128
Ed Tanousc66403c2021-09-22 15:28:57 -0700129if (get_option('buildtype') != 'plain')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800130 if (get_option('b_lto') == true and get_option('optimization') != '0')
131 # Reduce the binary size by removing unnecessary
132 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530133
Ed Tanousf2caadc2024-01-02 18:34:36 -0800134 add_project_arguments(
135 cxx.get_supported_arguments(
136 [
137 '-fno-fat-lto-objects',
138 '-fvisibility=hidden',
139 '-fvisibility-inlines-hidden',
140 ],
141 ),
142 language: 'cpp',
143 )
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530144
Ed Tanousf2caadc2024-01-02 18:34:36 -0800145 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
146 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
147 endif
George Liue8204932021-02-01 14:42:49 +0800148 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530149endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530150# Set Compiler Security flags
151
152security_flags = [
Ed Tanousf2caadc2024-01-02 18:34:36 -0800153 '-fstack-protector-strong',
154 '-fPIE',
155 '-fPIC',
156 '-D_FORTIFY_SOURCE=2',
157 '-Wformat',
158 '-Wformat-security',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530159]
160
161## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
162
Ed Tanous92e26be2024-08-21 13:39:14 -0700163if not (get_option('buildtype') == 'plain'
164or get_option('buildtype').startswith('debug')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800165)
Ed Tanous92e26be2024-08-21 13:39:14 -0700166 add_project_arguments(
167 cxx.get_supported_arguments([security_flags]),
168 language: 'cpp',
169 )
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530170endif
171
172# Boost dependency configuration
173
174add_project_arguments(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800175 cxx.get_supported_arguments(
176 [
Ed Tanousf2caadc2024-01-02 18:34:36 -0800177 '-DBOOST_ALL_NO_LIB',
178 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
179 '-DBOOST_ASIO_DISABLE_THREADS',
180 '-DBOOST_ASIO_NO_DEPRECATED',
181 '-DBOOST_ASIO_SEPARATE_COMPILATION',
182 '-DBOOST_BEAST_SEPARATE_COMPILATION',
183 '-DBOOST_EXCEPTION_DISABLE',
184 '-DBOOST_NO_EXCEPTIONS',
185 '-DBOOST_URL_NO_SOURCE_LOCATION',
Ed Tanousf88b2172022-04-15 13:55:05 -0700186 '-DBOOST_SPIRIT_X3_NO_RTTI',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800187 '-DJSON_NOEXCEPTION',
188 '-DOPENSSL_NO_FILENAMES',
189 '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
190 ],
191 ),
192 language: 'cpp',
193)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530194
195# Find the dependency modules, if not found use meson wrap to get them
196# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800197bmcweb_dependencies = []
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700198bmcweb_cli_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530199
Nan Zhou8682c5a2021-11-13 11:00:07 -0800200pam = cxx.find_library('pam', required: true)
Ed Tanousf2caadc2024-01-02 18:34:36 -0800201atomic = cxx.find_library('atomic', required: true)
Ed Tanouse7923992023-12-03 14:14:02 -0800202bmcweb_dependencies += [pam, atomic]
203
Ed Tanousf2caadc2024-01-02 18:34:36 -0800204openssl = dependency('openssl', required: false, version: '>=3.0.0')
Ed Tanouse7923992023-12-03 14:14:02 -0800205if not openssl.found() or get_option('b_sanitize') != 'none'
Ed Tanousf2caadc2024-01-02 18:34:36 -0800206 openssl_proj = subproject(
207 'openssl',
208 required: true,
209 default_options: ['warning_level=0', 'werror=false'],
210 )
211 openssl = openssl_proj.get_variable('openssl_dep')
212 openssl = openssl.as_system('system')
Ed Tanouse7923992023-12-03 14:14:02 -0800213endif
214bmcweb_dependencies += [openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530215
Ed Tanousf2caadc2024-01-02 18:34:36 -0800216nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false)
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800217if not nghttp2.found()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800218 cmake = import('cmake')
219 opt_var = cmake.subproject_options()
Ed Tanous211cfa42024-04-17 13:43:14 -0700220 opt_var.add_cmake_defines(
Ed Tanous92e26be2024-08-21 13:39:14 -0700221 {'ENABLE_LIB_ONLY': true, 'ENABLE_STATIC_LIB': true},
Ed Tanous211cfa42024-04-17 13:43:14 -0700222 )
Ed Tanousf2caadc2024-01-02 18:34:36 -0800223 nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
Ed Tanous211cfa42024-04-17 13:43:14 -0700224 nghttp2 = nghttp2_ex.dependency('nghttp2')
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800225endif
226bmcweb_dependencies += nghttp2
227
Ed Tanousf2caadc2024-01-02 18:34:36 -0800228sdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530229if not sdbusplus.found()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800230 sdbusplus_proj = subproject('sdbusplus', required: true)
231 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
232 sdbusplus = sdbusplus.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530233endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800234bmcweb_dependencies += sdbusplus
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700235bmcweb_cli_dependencies += sdbusplus
236
Ed Tanous92e26be2024-08-21 13:39:14 -0700237cli11 = dependency('CLI11', required: false, include_type: 'system')
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700238if not cli11.found()
Ed Tanous92e26be2024-08-21 13:39:14 -0700239 cli11_proj = subproject('cli11', required: true)
240 cli11 = cli11_proj.get_variable('CLI11_dep')
241 cli11 = cli11.as_system('system')
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700242endif
243bmcweb_cli_dependencies += cli11
244
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530245
Ed Tanousc9374ff2023-05-26 09:42:08 -0700246tinyxml = dependency(
247 'tinyxml2',
Cody Smith3a097b22022-05-19 14:22:32 -0700248 include_type: 'system',
Ed Tanousc9374ff2023-05-26 09:42:08 -0700249 version: '>=9.0.0',
Konstantin Aladyshev60e299b2024-04-03 11:44:51 +0300250 default_options: ['tests=false'],
Cody Smith3a097b22022-05-19 14:22:32 -0700251)
Ed Tanousc9374ff2023-05-26 09:42:08 -0700252if not tinyxml.found()
253 tinyxml_proj = subproject('tinyxml2', required: true)
254 tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
255 tinyxml = tinyxml.as_system('system')
256endif
Cody Smith3a097b22022-05-19 14:22:32 -0700257bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530258
259systemd = dependency('systemd')
Patrick Williams058f54e2024-09-03 16:07:55 -0400260libsystemd = dependency('libsystemd')
Ed Tanous77dcace2024-09-07 16:38:05 -0700261add_project_arguments(
262 '-DLIBSYSTEMD_VERSION=' + libsystemd.version(),
263 language: 'cpp',
264)
Ed Tanous055713e2024-07-17 17:19:36 -0700265
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530266zlib = dependency('zlib')
Patrick Williams058f54e2024-09-03 16:07:55 -0400267bmcweb_dependencies += [libsystemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530268
Ed Tanous92e26be2024-08-21 13:39:14 -0700269nlohmann_json_dep = dependency(
270 'nlohmann_json',
Patrick Williams0183e472024-10-10 12:31:07 -0400271 version: '>=3.11.3',
Ed Tanous92e26be2024-08-21 13:39:14 -0700272 include_type: 'system',
273)
Patrick Williamsdfd55472023-12-07 11:50:37 -0600274bmcweb_dependencies += nlohmann_json_dep
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530275
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000276boost = dependency(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800277 'boost',
Ed Tanous92e26be2024-08-21 13:39:14 -0700278 modules: ['url'],
Ed Tanousf2caadc2024-01-02 18:34:36 -0800279 version: '>=1.84.0',
280 required: false,
281 include_type: 'system',
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000282)
Jayanth Othayoth90fcc262024-11-11 06:24:49 -0600283
284# Boost version is 1.86 or higher to include the 'process' module
285if boost.version().version_compare('>=1.86.0')
286 boost = dependency(
287 'boost',
288 modules: ['url', 'process'],
289 version: '>=1.86.0',
290 required: false,
291 include_type: 'system',
292 )
293endif
294
Ed Tanous6fd29552023-10-04 09:40:14 -0700295if boost.found()
Ed Tanous92e26be2024-08-21 13:39:14 -0700296 bmcweb_dependencies += [boost]
297 bmcweb_cli_dependencies += [boost]
Ed Tanous6fd29552023-10-04 09:40:14 -0700298else
Ed Tanousf2caadc2024-01-02 18:34:36 -0800299 cmake = import('cmake')
300 opt = cmake.subproject_options()
Ed Tanousf80a87f2024-06-16 12:10:33 -0700301 boost_libs = [
302 'asio',
303 'beast',
304 'circular_buffer',
305 'callable_traits',
306 'headers',
307 'process',
308 'type_index',
309 'url',
310 'uuid',
311 'spirit',
312 ]
Ed Tanousf2caadc2024-01-02 18:34:36 -0800313 opt.add_cmake_defines(
314 {
Ed Tanous4ed30a82024-08-19 11:46:20 -0700315 # 1.86.0 fails this. Hopefully fixed in 1.86.1
316 'CMAKE_CXX_FLAGS': '-Wno-unused-parameter',
Ed Tanousf80a87f2024-06-16 12:10:33 -0700317 'BOOST_INCLUDE_LIBRARIES': ';'.join(boost_libs),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800318 'BUILD_SHARED_LIBS': 'OFF',
319 },
320 )
Ed Tanous144983c2024-03-28 00:39:10 -0700321
Ed Tanousf2caadc2024-01-02 18:34:36 -0800322 boost = cmake.subproject('boost', required: true, options: opt)
Ed Tanousf80a87f2024-06-16 12:10:33 -0700323 foreach boost_lib : boost_libs
324 boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system()
325 bmcweb_dependencies += [boost_lib_instance]
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700326 bmcweb_cli_dependencies += [boost_lib_instance]
Ed Tanousf80a87f2024-06-16 12:10:33 -0700327 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530328endif
329
Patrick Williams4efe3e02023-04-12 08:05:58 -0500330systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530331
Ed Tanous92e26be2024-08-21 13:39:14 -0700332bindir = get_option('prefix') + '/' + get_option('bindir')
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700333libexec = get_option('prefix') + '/' + get_option('libexecdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530334
Ed Tanousf2caadc2024-01-02 18:34:36 -0800335summary(
336 {
337 'prefix': get_option('prefix'),
338 'bindir': bindir,
339 'systemd unit directory': systemd_system_unit_dir,
340 },
341 section: 'Directories',
342)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530343
Ed Tanousa529a6a2024-05-29 16:51:37 -0700344subdir('static')
345subdir('redfish-core')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530346
Nan Zhou307386e2022-10-12 20:29:34 +0000347# Config subdirectory
Nan Zhou307386e2022-10-12 20:29:34 +0000348subdir('config')
349bmcweb_dependencies += conf_h_dep
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700350bmcweb_cli_dependencies += conf_h_dep
Nan Zhou307386e2022-10-12 20:29:34 +0000351
Ed Tanous02f1cd92021-10-27 12:09:06 -0700352# Source files
Nan Zhou0ad63df2022-10-17 23:03:21 +0000353fs = import('fs')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530354
Nan Zhou0ad63df2022-10-17 23:03:21 +0000355srcfiles_bmcweb = files(
Ed Tanous724985f2024-06-05 09:19:06 -0700356 'http/mutual_tls.cpp',
Ed Tanousb26ff342024-11-22 11:47:08 -0800357 'redfish-core/src/dbus_log_watcher.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800358 'redfish-core/src/error_messages.cpp',
Alexander Hansenb80ba2e2024-11-18 12:24:35 +0100359 'redfish-core/src/event_log.cpp',
Ed Tanous2185dde2024-11-22 11:33:51 -0800360 'redfish-core/src/filesystem_log_watcher.cpp',
Ed Tanous25991f72024-06-13 18:10:25 -0700361 'redfish-core/src/filter_expr_executor.cpp',
Ed Tanousf88b2172022-04-15 13:55:05 -0700362 'redfish-core/src/filter_expr_printer.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800363 'redfish-core/src/redfish.cpp',
364 'redfish-core/src/registries.cpp',
Alexander Hansen02c1e292024-11-15 14:30:40 +0100365 'redfish-core/src/subscription.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800366 'redfish-core/src/utils/dbus_utils.cpp',
367 'redfish-core/src/utils/json_utils.cpp',
368 'redfish-core/src/utils/time_utils.cpp',
369 'src/boost_asio.cpp',
370 'src/boost_asio_ssl.cpp',
371 'src/boost_beast.cpp',
372 'src/dbus_singleton.cpp',
373 'src/json_html_serializer.cpp',
374 'src/ossl_random.cpp',
Ed Tanous724985f2024-06-05 09:19:06 -0700375 'src/ssl_key_handler.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800376 'src/webserver_run.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000377)
Ed Tanous02f1cd92021-10-27 12:09:06 -0700378
Ed Tanous42bbcd82023-01-07 18:04:28 -0800379bmcweblib = static_library(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800380 'bmcweblib',
381 srcfiles_bmcweb,
382 include_directories: incdir,
383 dependencies: bmcweb_dependencies,
Ed Tanous42bbcd82023-01-07 18:04:28 -0800384)
385
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700386# Generate the bmcwebd daemon
Ed Tanous02f1cd92021-10-27 12:09:06 -0700387executable(
Ed Tanous92e26be2024-08-21 13:39:14 -0700388 'bmcwebd',
389 'src/webserver_main.cpp',
390 include_directories: incdir,
391 dependencies: bmcweb_dependencies,
392 link_with: bmcweblib,
393 link_args: '-Wl,--gc-sections',
394 install: true,
395 install_dir: libexec,
Aushim Nagarkattibd1299b2024-08-12 17:11:04 -0700396)
397
398# Generate the bmcweb CLI application
399executable(
Ed Tanous92e26be2024-08-21 13:39:14 -0700400 'bmcweb',
401 ['src/webserver_cli.cpp', 'src/boost_asio.cpp'],
402 include_directories: incdir_cli,
403 dependencies: bmcweb_cli_dependencies,
404 install: true,
405 install_dir: bindir,
Ed Tanous02f1cd92021-10-27 12:09:06 -0700406)
407
Nan Zhou0ad63df2022-10-17 23:03:21 +0000408srcfiles_unittest = files(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800409 'test/http/crow_getroutes_test.cpp',
410 'test/http/http2_connection_test.cpp',
411 'test/http/http_body_test.cpp',
412 'test/http/http_connection_test.cpp',
413 'test/http/http_response_test.cpp',
414 'test/http/mutual_tls.cpp',
415 'test/http/mutual_tls_meta.cpp',
416 'test/http/parsing_test.cpp',
417 'test/http/router_test.cpp',
418 'test/http/server_sent_event_test.cpp',
419 'test/http/utility_test.cpp',
420 'test/http/verb_test.cpp',
421 'test/include/async_resolve_test.cpp',
422 'test/include/credential_pipe_test.cpp',
423 'test/include/dbus_utility_test.cpp',
424 'test/include/google/google_service_root_test.cpp',
425 'test/include/http_utility_test.cpp',
426 'test/include/human_sort_test.cpp',
427 'test/include/ibm/configfile_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800428 'test/include/json_html_serializer.cpp',
429 'test/include/multipart_test.cpp',
430 'test/include/openbmc_dbus_rest_test.cpp',
431 'test/include/ossl_random.cpp',
Ed Tanous099225c2024-03-27 22:03:05 -0700432 'test/include/ssl_key_handler_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800433 'test/include/str_utility_test.cpp',
Alexander Hansen5494e212024-11-18 19:21:57 +0100434 'test/redfish-core/include/event_log_test.cpp',
Ed Tanousd3a48a12024-09-25 08:58:29 -0700435 'test/redfish-core/include/event_matches_filter_test.cpp',
Ed Tanous25991f72024-06-13 18:10:25 -0700436 'test/redfish-core/include/filter_expr_executor_test.cpp',
Ed Tanousf88b2172022-04-15 13:55:05 -0700437 'test/redfish-core/include/filter_expr_parser_test.cpp',
Ed Tanous92e26be2024-08-21 13:39:14 -0700438 'test/redfish-core/include/privileges_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800439 'test/redfish-core/include/redfish_aggregator_test.cpp',
440 'test/redfish-core/include/registries_test.cpp',
441 'test/redfish-core/include/utils/dbus_utils.cpp',
442 'test/redfish-core/include/utils/hex_utils_test.cpp',
443 'test/redfish-core/include/utils/ip_utils_test.cpp',
444 'test/redfish-core/include/utils/json_utils_test.cpp',
Ed Tanous15b6f9f2024-05-30 09:13:43 -0700445 'test/redfish-core/include/redfish_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800446 'test/redfish-core/include/utils/query_param_test.cpp',
Janet Adkins1516c212024-08-14 13:22:41 -0500447 'test/redfish-core/include/utils/sensor_utils_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800448 'test/redfish-core/include/utils/stl_utils_test.cpp',
449 'test/redfish-core/include/utils/time_utils_test.cpp',
450 'test/redfish-core/lib/chassis_test.cpp',
451 'test/redfish-core/lib/log_services_dump_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800452 'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
Ed Tanous090ab8e2024-05-18 16:07:23 -0700453 'test/redfish-core/lib/metadata_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800454 'test/redfish-core/lib/power_subsystem_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800455 'test/redfish-core/lib/service_root_test.cpp',
456 'test/redfish-core/lib/system_test.cpp',
Ed Tanous8d2f8682024-09-03 17:03:29 -0700457 'test/redfish-core/lib/systems_logservices_postcode.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800458 'test/redfish-core/lib/thermal_subsystem_test.cpp',
459 'test/redfish-core/lib/update_service_test.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000460)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530461
Ed Tanousf2caadc2024-01-02 18:34:36 -0800462if (get_option('tests').allowed())
Ed Tanous77dcace2024-09-07 16:38:05 -0700463 gtest = dependency(
464 'gtest_main',
465 main: true,
466 version: '>=1.15.0',
467 required: true,
468 )
469 gmock = dependency('gmock', required: true)
470 gtestlib = static_library('gtestlib', dependencies: [gtest, gmock])
471 gtestdep = declare_dependency(
472 link_with: gtestlib,
473 dependencies: [
474 gtest.partial_dependency(includes: true),
475 gmock.partial_dependency(includes: true),
476 ],
477 )
Ed Tanous02f1cd92021-10-27 12:09:06 -0700478 # generate the test executable
Nan Zhou0ad63df2022-10-17 23:03:21 +0000479 foreach test_src : srcfiles_unittest
Ed Tanousf2caadc2024-01-02 18:34:36 -0800480 test_bin = executable(
481 fs.stem(test_src),
482 test_src,
483 link_with: bmcweblib,
484 include_directories: incdir,
485 install_dir: bindir,
Ed Tanous77dcace2024-09-07 16:38:05 -0700486 dependencies: bmcweb_dependencies + [gtestdep],
Ed Tanousf2caadc2024-01-02 18:34:36 -0800487 )
Ed Tanous77dcace2024-09-07 16:38:05 -0700488 test(fs.stem(test_src), test_bin, protocol: 'gtest')
Nan Zhou0ad63df2022-10-17 23:03:21 +0000489 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530490endif