blob: 5bb3fdfc1867780d96c340aef28acf27c073894c [file] [log] [blame]
Ed Tanousf2caadc2024-01-02 18:34:36 -08001project(
2 'bmcweb',
3 'cpp',
4 version: '1.0',
5 meson_version: '>=0.63.0',
6 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',
13 'cpp_std=c++20',
14 '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 Williamsc52ee722021-10-06 15:17:42 -050028if get_option('cpp_std') != 'c++20'
29 error('This project requires c++20 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')
42 add_project_arguments(['-fdata-sections', '-ffunction-sections'], language: 'cpp')
43 add_project_arguments('-DNDEBUG', language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053044endif
45
Ed Tanousf2caadc2024-01-02 18:34:36 -080046if (get_option('dns-resolver') == 'systemd-dbus')
47 add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp')
Ed Tanousf8ca6d72022-06-28 12:12:03 -070048endif
49
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053050# Disable lto when compiling with no optimization
Ed Tanousf2caadc2024-01-02 18:34:36 -080051if (get_option('optimization') == '0')
52 add_project_arguments('-fno-lto', language: 'cpp')
53 message('Disabling lto & its supported features as optimization is disabled')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053054endif
55
56# Include Directories
57
Ed Tanousf2caadc2024-01-02 18:34:36 -080058incdir = include_directories('include', 'redfish-core/include', 'redfish-core/lib', 'http')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053059
60# Get the options and enable the respective features
61## create a MAP of "options : feature_flag"
62
63feature_map = {
Ed Tanousf2caadc2024-01-02 18:34:36 -080064 'basic-auth': '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION',
65 'cookie-auth': '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION',
66 'google-api': '-DBMCWEB_ENABLE_GOOGLE_API',
67 'host-serial-socket': '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET',
68 'ibm-management-console': '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE',
69 'insecure-disable-auth': '-DBMCWEB_INSECURE_DISABLE_AUTHX',
70 'insecure-disable-csrf': '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION',
71 'insecure-disable-ssl': '-DBMCWEB_INSECURE_DISABLE_SSL',
72 'insecure-push-style-notification': '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING',
73 'insecure-tftp-update': '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE',
74 'insecure-ignore-content-type': '-DBMCWEB_INSECURE_IGNORE_CONTENT_TYPE',
75 'kvm': '-DBMCWEB_ENABLE_KVM',
76 'mutual-tls-auth': '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION',
77 'redfish-aggregation': '-DBMCWEB_ENABLE_REDFISH_AGGREGATION',
78 'redfish-allow-deprecated-power-thermal': '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL',
79 'redfish-bmc-journal': '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL',
80 'redfish-cpu-log': '-DBMCWEB_ENABLE_REDFISH_CPU_LOG',
81 'redfish-dbus-log': '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES',
82 'redfish-dump-log': '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG',
83 'redfish-host-logger': '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER',
84 'redfish-new-powersubsystem-thermalsubsystem': '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM',
85 'redfish-oem-manager-fan-data': '-DBMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA',
86 'redfish-provisioning-feature': '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE',
87 'redfish': '-DBMCWEB_ENABLE_REDFISH',
88 'rest': '-DBMCWEB_ENABLE_DBUS_REST',
89 'session-auth': '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION',
90 'static-hosting': '-DBMCWEB_ENABLE_STATIC_HOSTING',
91 'experimental-redfish-multi-computer-system': '-DBMCWEB_ENABLE_MULTI_COMPUTERSYSTEM',
Ed Tanousf2caadc2024-01-02 18:34:36 -080092 'xtoken-auth': '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION',
93 #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053094}
95
96# Get the options status and build a project summary to show which flags are
97# being enabled during the configuration time.
98
Ed Tanousf2caadc2024-01-02 18:34:36 -080099foreach option_key, option_value : feature_map
100 if (get_option(option_key).allowed())
101 if (
102 option_key == 'mutual-tls-auth'
103 or option_key == 'insecure-disable-ssl'
104 )
105 if (
106 get_option('insecure-disable-ssl').disabled()
107 or get_option('mutual-tls-auth').disabled()
108 )
109 add_project_arguments(option_value, language: 'cpp')
110 summary(option_key, option_value, section: 'Enabled Features')
111 endif
112 elif (
113 option_key in [
114 'basic-auth',
115 'cookie-auth',
116 'session-auth',
117 'xtoken-auth',
118 'mutual-tls-auth',
119 ]
120 )
121 if (get_option('insecure-disable-auth').disabled())
122 add_project_arguments(option_value, language: 'cpp')
123 summary(option_key, option_value, section: 'Enabled Features')
124 endif
125 else
126 summary(option_key, option_value, section: 'Enabled Features')
127 add_project_arguments(option_value, language: 'cpp')
128 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530129 else
Ed Tanousf2caadc2024-01-02 18:34:36 -0800130 if (option_key == 'insecure-disable-ssl')
131 summary('ssl', '-DBMCWEB_ENABLE_SSL', section: 'Enabled Features')
132 add_project_arguments('-DBMCWEB_ENABLE_SSL', language: 'cpp')
133 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530134 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530135endforeach
136
Ed Tanousf2caadc2024-01-02 18:34:36 -0800137if (get_option('tests').allowed())
138 summary('unittest', 'NA', section: 'Enabled Features')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530139endif
140
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530141# Add compiler arguments
142
Ed Tanousade3f092024-03-13 13:28:36 -0700143if (cxx.get_id() == 'clang')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800144 if (cxx.version().version_compare('<17.0'))
145 error('This project requires clang-17 or higher')
146 endif
147 add_project_arguments(
148 '-Weverything',
149 '-Wformat=2',
150 '-Wno-c++98-compat-pedantic',
151 '-Wno-c++98-compat',
152 '-Wno-documentation-unknown-command',
153 '-Wno-documentation',
154 '-Wno-exit-time-destructors',
155 '-Wno-global-constructors',
156 '-Wno-newline-eof',
157 '-Wno-padded',
158 '-Wno-shadow',
159 '-Wno-used-but-marked-unused',
160 '-Wno-weak-vtables',
161 '-Wno-switch-enum',
162 '-Wno-unused-macros',
163 '-Wno-covered-switch-default',
164 language: 'cpp',
165 )
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530166endif
167
Ed Tanousade3f092024-03-13 13:28:36 -0700168if (cxx.get_id() == 'gcc')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800169 if (cxx.version().version_compare('<13.0'))
170 error('This project requires gcc-13 or higher')
171 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530172
Ed Tanousf2caadc2024-01-02 18:34:36 -0800173 add_project_arguments(
174 '-Wformat=2',
175 '-Wcast-align',
176 '-Wconversion',
177 '-Woverloaded-virtual',
178 '-Wsign-conversion',
179 '-Wunused',
180 '-Wduplicated-cond',
181 '-Wduplicated-branches',
182 '-Wlogical-op',
183 '-Wnull-dereference',
184 '-Wunused-parameter',
185 '-Wdouble-promotion',
186 '-Wshadow',
187 '-Wno-psabi',
188 '-Wno-attributes',
189 language: 'cpp',
190 )
Ed Tanousc66403c2021-09-22 15:28:57 -0700191endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530192
Ed Tanousc66403c2021-09-22 15:28:57 -0700193if (get_option('buildtype') != 'plain')
Ed Tanousf2caadc2024-01-02 18:34:36 -0800194 if (get_option('b_lto') == true and get_option('optimization') != '0')
195 # Reduce the binary size by removing unnecessary
196 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530197
Ed Tanousf2caadc2024-01-02 18:34:36 -0800198 add_project_arguments(
199 cxx.get_supported_arguments(
200 [
201 '-fno-fat-lto-objects',
202 '-fvisibility=hidden',
203 '-fvisibility-inlines-hidden',
204 ],
205 ),
206 language: 'cpp',
207 )
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530208
Ed Tanousf2caadc2024-01-02 18:34:36 -0800209 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
210 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
211 endif
George Liue8204932021-02-01 14:42:49 +0800212 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530213endif
214
Ed Tanousf2caadc2024-01-02 18:34:36 -0800215if (
216 get_option('bmcweb-logging') != 'disabled'
217 or get_option('buildtype').startswith('debug')
218)
219 add_project_arguments(['-DBMCWEB_ENABLE_DEBUG'], language: 'cpp')
Ed Tanousc66403c2021-09-22 15:28:57 -0700220
Ed Tanousf2caadc2024-01-02 18:34:36 -0800221 summary('debug', '-DBMCWEB_ENABLE_DEBUG', section: 'Enabled Features')
Ed Tanousc66403c2021-09-22 15:28:57 -0700222endif
223
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530224# Set Compiler Security flags
225
226security_flags = [
Ed Tanousf2caadc2024-01-02 18:34:36 -0800227 '-fstack-protector-strong',
228 '-fPIE',
229 '-fPIC',
230 '-D_FORTIFY_SOURCE=2',
231 '-Wformat',
232 '-Wformat-security',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530233]
234
235## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
236
Ed Tanousf2caadc2024-01-02 18:34:36 -0800237if not (
238 get_option('buildtype') == 'plain'
239 or get_option('buildtype').startswith('debug')
240)
241 add_project_arguments(cxx.get_supported_arguments([security_flags]), language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530242endif
243
244# Boost dependency configuration
245
246add_project_arguments(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800247 cxx.get_supported_arguments(
248 [
249 '-DBOOST_ASIO_DISABLE_CONCEPTS',
250 '-DBOOST_ALL_NO_LIB',
251 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
252 '-DBOOST_ASIO_DISABLE_THREADS',
253 '-DBOOST_ASIO_NO_DEPRECATED',
254 '-DBOOST_ASIO_SEPARATE_COMPILATION',
255 '-DBOOST_BEAST_SEPARATE_COMPILATION',
256 '-DBOOST_EXCEPTION_DISABLE',
257 '-DBOOST_NO_EXCEPTIONS',
258 '-DBOOST_URL_NO_SOURCE_LOCATION',
259 '-DJSON_NOEXCEPTION',
260 '-DOPENSSL_NO_FILENAMES',
261 '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
262 ],
263 ),
264 language: 'cpp',
265)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530266
267# Find the dependency modules, if not found use meson wrap to get them
268# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800269bmcweb_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530270
Nan Zhou8682c5a2021-11-13 11:00:07 -0800271pam = cxx.find_library('pam', required: true)
Ed Tanousf2caadc2024-01-02 18:34:36 -0800272atomic = cxx.find_library('atomic', required: true)
Ed Tanouse7923992023-12-03 14:14:02 -0800273bmcweb_dependencies += [pam, atomic]
274
Ed Tanousf2caadc2024-01-02 18:34:36 -0800275openssl = dependency('openssl', required: false, version: '>=3.0.0')
Ed Tanouse7923992023-12-03 14:14:02 -0800276if not openssl.found() or get_option('b_sanitize') != 'none'
Ed Tanousf2caadc2024-01-02 18:34:36 -0800277 openssl_proj = subproject(
278 'openssl',
279 required: true,
280 default_options: ['warning_level=0', 'werror=false'],
281 )
282 openssl = openssl_proj.get_variable('openssl_dep')
283 openssl = openssl.as_system('system')
Ed Tanouse7923992023-12-03 14:14:02 -0800284endif
285bmcweb_dependencies += [openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530286
Ed Tanousf2caadc2024-01-02 18:34:36 -0800287nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false)
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800288if not nghttp2.found()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800289 cmake = import('cmake')
290 opt_var = cmake.subproject_options()
Ed Tanous211cfa42024-04-17 13:43:14 -0700291 opt_var.add_cmake_defines(
292 {
293 'ENABLE_LIB_ONLY': true,
294 'ENABLE_STATIC_LIB': true,
295 },
296 )
Ed Tanousf2caadc2024-01-02 18:34:36 -0800297 nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
Ed Tanous211cfa42024-04-17 13:43:14 -0700298 nghttp2 = nghttp2_ex.dependency('nghttp2')
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800299endif
300bmcweb_dependencies += nghttp2
301
Ed Tanousf2caadc2024-01-02 18:34:36 -0800302sdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530303if not sdbusplus.found()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800304 sdbusplus_proj = subproject('sdbusplus', required: true)
305 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
306 sdbusplus = sdbusplus.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530307endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800308bmcweb_dependencies += sdbusplus
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530309
Ed Tanousc9374ff2023-05-26 09:42:08 -0700310tinyxml = dependency(
311 'tinyxml2',
Cody Smith3a097b22022-05-19 14:22:32 -0700312 include_type: 'system',
Ed Tanousc9374ff2023-05-26 09:42:08 -0700313 version: '>=9.0.0',
Konstantin Aladyshev60e299b2024-04-03 11:44:51 +0300314 default_options: ['tests=false'],
Cody Smith3a097b22022-05-19 14:22:32 -0700315)
Ed Tanousc9374ff2023-05-26 09:42:08 -0700316if not tinyxml.found()
317 tinyxml_proj = subproject('tinyxml2', required: true)
318 tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
319 tinyxml = tinyxml.as_system('system')
320endif
Cody Smith3a097b22022-05-19 14:22:32 -0700321bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530322
323systemd = dependency('systemd')
324zlib = dependency('zlib')
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800325bmcweb_dependencies += [systemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530326
Patrick Williamsdfd55472023-12-07 11:50:37 -0600327nlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system')
328bmcweb_dependencies += nlohmann_json_dep
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530329
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000330boost = dependency(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800331 'boost',
332 modules: [
333 'url',
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000334 ],
Ed Tanousf2caadc2024-01-02 18:34:36 -0800335 version: '>=1.84.0',
336 required: false,
337 include_type: 'system',
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000338)
Ed Tanous6fd29552023-10-04 09:40:14 -0700339if boost.found()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800340 bmcweb_dependencies += [boost]
Ed Tanous6fd29552023-10-04 09:40:14 -0700341else
Ed Tanousf2caadc2024-01-02 18:34:36 -0800342 cmake = import('cmake')
343 opt = cmake.subproject_options()
344 opt.add_cmake_defines(
345 {
346 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid',
347 'BUILD_SHARED_LIBS': 'OFF',
348 },
349 )
Ed Tanous144983c2024-03-28 00:39:10 -0700350
Ed Tanousf2caadc2024-01-02 18:34:36 -0800351 boost = cmake.subproject('boost', required: true, options: opt)
352 boost_asio = boost.dependency('boost_asio').as_system()
353 boost_beast = boost.dependency('boost_beast').as_system()
354 boost_callable_traits = boost.dependency('boost_callable_traits').as_system()
355 boost_headers = boost.dependency('boost_headers').as_system()
356 boost_process = boost.dependency('boost_process').as_system()
357 boost_type_index = boost.dependency('boost_type_index').as_system()
358 boost_url = boost.dependency('boost_url').as_system()
359 boost_uuid = boost.dependency('boost_uuid').as_system()
360 bmcweb_dependencies += [
361 boost_asio,
362 boost_beast,
363 boost_callable_traits,
364 boost_headers,
365 boost_process,
366 boost_type_index,
367 boost_url,
368 boost_uuid,
369 ]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530370endif
371
Patrick Williams549bed22023-11-29 06:45:06 -0600372if get_option('tests').allowed()
Ed Tanousf2caadc2024-01-02 18:34:36 -0800373 gtest = dependency(
374 'gtest',
375 main: true,
376 version: '>=1.14.0',
377 disabler: true,
378 required: false,
379 )
380 gmock = dependency('gmock', required: false)
381 if not gtest.found() and get_option('tests').allowed()
382 gtest_proj = subproject('gtest', required: true)
383 gtest = gtest_proj.get_variable('gtest_main_dep')
384 gmock = gtest_proj.get_variable('gmock_dep')
385 endif
386 gtest = gtest.as_system('system')
387 gmock = gmock.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530388endif
389
Patrick Williams4efe3e02023-04-12 08:05:58 -0500390systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530391
Ed Tanousf2caadc2024-01-02 18:34:36 -0800392bindir = get_option('prefix') + '/' + get_option('bindir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530393
Ed Tanousf2caadc2024-01-02 18:34:36 -0800394summary(
395 {
396 'prefix': get_option('prefix'),
397 'bindir': bindir,
398 'systemd unit directory': systemd_system_unit_dir,
399 },
400 section: 'Directories',
401)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530402
Ed Tanousf2caadc2024-01-02 18:34:36 -0800403install_subdir('static', install_dir: 'share/www', strip_directory: true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530404
Nan Zhou307386e2022-10-12 20:29:34 +0000405# Config subdirectory
406
407subdir('config')
408bmcweb_dependencies += conf_h_dep
409
Ed Tanous02f1cd92021-10-27 12:09:06 -0700410# Source files
Nan Zhou0ad63df2022-10-17 23:03:21 +0000411fs = import('fs')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530412
Nan Zhou0ad63df2022-10-17 23:03:21 +0000413srcfiles_bmcweb = files(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800414 # end large files
Ed Tanous3cd70722024-04-06 09:24:01 -0700415
Ed Tanousf2caadc2024-01-02 18:34:36 -0800416 'redfish-core/src/error_messages.cpp',
417 # Begin large files, should be at the beginning
418 'redfish-core/src/redfish.cpp',
419 'redfish-core/src/registries.cpp',
420 'redfish-core/src/utils/dbus_utils.cpp',
421 'redfish-core/src/utils/json_utils.cpp',
422 'redfish-core/src/utils/time_utils.cpp',
423 'src/boost_asio.cpp',
424 'src/boost_asio_ssl.cpp',
425 'src/boost_beast.cpp',
426 'src/dbus_singleton.cpp',
427 'src/json_html_serializer.cpp',
428 'src/ossl_random.cpp',
429 'src/webserver_run.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000430)
Ed Tanous02f1cd92021-10-27 12:09:06 -0700431
Ed Tanous42bbcd82023-01-07 18:04:28 -0800432bmcweblib = static_library(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800433 'bmcweblib',
434 srcfiles_bmcweb,
435 include_directories: incdir,
436 dependencies: bmcweb_dependencies,
Ed Tanous42bbcd82023-01-07 18:04:28 -0800437)
438
Ed Tanous02f1cd92021-10-27 12:09:06 -0700439# Generate the bmcweb executable
440executable(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800441 'bmcweb',
442 'src/webserver_main.cpp',
443 include_directories: incdir,
444 dependencies: bmcweb_dependencies,
445 link_with: bmcweblib,
446 link_args: '-Wl,--gc-sections',
447 install: true,
448 install_dir: bindir,
Ed Tanous02f1cd92021-10-27 12:09:06 -0700449)
450
Nan Zhou0ad63df2022-10-17 23:03:21 +0000451srcfiles_unittest = files(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800452 'test/http/crow_getroutes_test.cpp',
453 'test/http/http2_connection_test.cpp',
454 'test/http/http_body_test.cpp',
455 'test/http/http_connection_test.cpp',
456 'test/http/http_response_test.cpp',
457 'test/http/mutual_tls.cpp',
458 'test/http/mutual_tls_meta.cpp',
459 'test/http/parsing_test.cpp',
460 'test/http/router_test.cpp',
461 'test/http/server_sent_event_test.cpp',
462 'test/http/utility_test.cpp',
463 'test/http/verb_test.cpp',
464 'test/include/async_resolve_test.cpp',
465 'test/include/credential_pipe_test.cpp',
466 'test/include/dbus_utility_test.cpp',
467 'test/include/google/google_service_root_test.cpp',
468 'test/include/http_utility_test.cpp',
469 'test/include/human_sort_test.cpp',
470 'test/include/ibm/configfile_test.cpp',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800471 'test/include/json_html_serializer.cpp',
472 'test/include/multipart_test.cpp',
473 'test/include/openbmc_dbus_rest_test.cpp',
474 'test/include/ossl_random.cpp',
475 'test/include/str_utility_test.cpp',
476 'test/redfish-core/include/privileges_test.cpp',
477 'test/redfish-core/include/redfish_aggregator_test.cpp',
478 'test/redfish-core/include/registries_test.cpp',
479 'test/redfish-core/include/utils/dbus_utils.cpp',
480 'test/redfish-core/include/utils/hex_utils_test.cpp',
481 'test/redfish-core/include/utils/ip_utils_test.cpp',
482 'test/redfish-core/include/utils/json_utils_test.cpp',
483 'test/redfish-core/include/utils/query_param_test.cpp',
484 'test/redfish-core/include/utils/stl_utils_test.cpp',
485 'test/redfish-core/include/utils/time_utils_test.cpp',
486 'test/redfish-core/lib/chassis_test.cpp',
487 'test/redfish-core/lib/log_services_dump_test.cpp',
488 'test/redfish-core/lib/log_services_test.cpp',
489 'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
490 'test/redfish-core/lib/power_subsystem_test.cpp',
491 'test/redfish-core/lib/sensors_test.cpp',
492 'test/redfish-core/lib/service_root_test.cpp',
493 'test/redfish-core/lib/system_test.cpp',
494 'test/redfish-core/lib/thermal_subsystem_test.cpp',
495 'test/redfish-core/lib/update_service_test.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000496)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530497
Ed Tanousf2caadc2024-01-02 18:34:36 -0800498if (get_option('tests').allowed())
Ed Tanous02f1cd92021-10-27 12:09:06 -0700499 # generate the test executable
Nan Zhou0ad63df2022-10-17 23:03:21 +0000500 foreach test_src : srcfiles_unittest
Ed Tanousf2caadc2024-01-02 18:34:36 -0800501 test_bin = executable(
502 fs.stem(test_src),
503 test_src,
504 link_with: bmcweblib,
505 include_directories: incdir,
506 install_dir: bindir,
507 dependencies: bmcweb_dependencies
508 + [
509 gtest,
510 gmock,
511 ],
512 )
513 test(fs.stem(test_src), test_bin)
Nan Zhou0ad63df2022-10-17 23:03:21 +0000514 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530515endif