blob: 54055484c4071037630d0f1ea2ab3e432ce38bd7 [file] [log] [blame]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +05301project('bmcweb', 'cpp',
2 version : '1.0',
Ed Tanous6107da12022-10-25 12:05:02 -07003 meson_version: '>=0.63.0',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +05304 default_options: [
Manojkiran Edacb2ed192021-02-15 08:30:43 +05305 'b_lto_mode=default',
Ed Tanousf523c322021-12-03 10:46:48 -08006 'b_lto_threads=0',
7 'b_lto=true',
8 'b_ndebug=if-release',
9 'buildtype=debugoptimized',
10 'cpp_rtti=false',
11 'cpp_std=c++20',
12 'warning_level=3',
13 'werror=true',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053014 ])
15
16# Project related links
17
18project_pretty_name = 'bmcweb'
19project_url = 'https://github.com/openbmc/' + project_pretty_name
20project_issues_url = project_url + '/issues/new'
21summary('Issues',project_issues_url, section: 'Report Issues')
22
23# Validate the c++ Standard
24
Patrick Williamsc52ee722021-10-06 15:17:42 -050025if get_option('cpp_std') != 'c++20'
26 error('This project requires c++20 support')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053027endif
28
29# Get compiler and default build type
30
31cxx = meson.get_compiler('cpp')
32build = get_option('buildtype')
33optimization = get_option('optimization')
34summary('Build Type',build, section : 'Build Info')
35summary('Optimization',optimization, section : 'Build Info')
36
Ed Tanous5e34b672021-02-05 14:21:27 -080037
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053038# remove debug information for minsize buildtype
39if(get_option('buildtype') == 'minsize')
Ed Tanous5e34b672021-02-05 14:21:27 -080040 add_project_arguments(['-fdata-sections', '-ffunction-sections'], language : 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053041 add_project_arguments('-DNDEBUG', language : 'cpp')
42endif
43
44# Disable lto when compiling with no optimization
45if(get_option('optimization') == '0')
46 add_project_arguments('-fno-lto', language: 'cpp')
47 message('Disabling lto & its supported features as optimization is disabled')
48endif
49
50# Include Directories
51
Ed Tanouscf2f9322021-09-22 15:34:41 -070052incdir = include_directories(
53 'include',
54 'redfish-core/include',
55 'redfish-core/lib',
56 'http'
57)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053058
59# Get the options and enable the respective features
60## create a MAP of "options : feature_flag"
61
62feature_map = {
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053063 'basic-auth' : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION',
64 'cookie-auth' : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION',
65 'google-api' : '-DBMCWEB_ENABLE_GOOGLE_API',
66 'host-serial-socket' : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET',
67 'ibm-management-console' : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE',
Nan Zhoua43ea822022-05-27 00:42:44 +000068 'insecure-disable-auth' : '-DBMCWEB_INSECURE_DISABLE_AUTHX',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053069 'insecure-disable-csrf' : '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION',
70 'insecure-disable-ssl' : '-DBMCWEB_INSECURE_DISABLE_SSL',
71 'insecure-push-style-notification' : '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING',
72 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE',
Ed Tanous1aa0c2b2022-02-08 12:24:30 +010073 'insecure-ignore-content-type' : '-DBMCWEB_INSECURE_IGNORE_CONTENT_TYPE',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053074 'kvm' : '-DBMCWEB_ENABLE_KVM' ,
75 'mutual-tls-auth' : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION',
Carson Labrado7fb33562022-04-18 23:26:56 +000076 'redfish-aggregation' : '-DBMCWEB_ENABLE_REDFISH_AGGREGATION',
Ed Tanousf523c322021-12-03 10:46:48 -080077 'redfish-allow-deprecated-power-thermal' : '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053078 'redfish-bmc-journal' : '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL',
79 'redfish-cpu-log' : '-DBMCWEB_ENABLE_REDFISH_CPU_LOG',
80 'redfish-dbus-log' : '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES',
81 'redfish-dump-log' : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG',
Ed Tanousf523c322021-12-03 10:46:48 -080082 'redfish-host-logger' : '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053083 'redfish-new-powersubsystem-thermalsubsystem' : '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM',
Gunnar Mills54dce7f2022-08-05 17:01:32 +000084 'redfish-oem-manager-fan-data' : '-DBMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA',
Ed Tanousf523c322021-12-03 10:46:48 -080085 'redfish-provisioning-feature' : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE',
Ed Tanous4dc23f32022-05-11 11:32:19 -070086 'redfish-post-to-old-updateservice' : '-DBMCWEB_ENABLE_REDFISH_UPDATESERVICE_OLD_POST_URL',
Ed Tanousf523c322021-12-03 10:46:48 -080087 'redfish' : '-DBMCWEB_ENABLE_REDFISH',
88 'rest' : '-DBMCWEB_ENABLE_DBUS_REST',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053089 'session-auth' : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION',
90 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053091 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET',
92 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION',
Ed Tanousf523c322021-12-03 10:46:48 -080093 #'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
99foreach option_key,option_value : feature_map
100 if(get_option(option_key).enabled())
101 if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl')
102 if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled())
103 add_project_arguments(option_value,language:'cpp')
104 summary(option_key,option_value, section : 'Enabled Features')
105 endif
Nan Zhou3acced22022-07-12 23:21:02 +0000106 elif (option_key in ['basic-auth', 'cookie-auth', 'session-auth', 'xtoken-auth', 'mutual-tls-auth'])
107 if (get_option('insecure-disable-auth').disabled())
108 add_project_arguments(option_value, language:'cpp')
109 summary(option_key,option_value, section : 'Enabled Features')
110 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530111 else
112 summary(option_key,option_value, section : 'Enabled Features')
113 add_project_arguments(option_value,language:'cpp')
114 endif
115 else
116 if(option_key == 'insecure-disable-ssl')
117 summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features')
118 add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp')
119 endif
120 endif
121endforeach
122
123if(get_option('tests').enabled())
124 summary('unittest','NA', section : 'Enabled Features')
125endif
126
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530127# Add compiler arguments
128
129# -Wpedantic, -Wextra comes by default with warning level
130add_project_arguments(
131 cxx.get_supported_arguments([
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530132 '-Wcast-align',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530133 '-Wconversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800134 '-Wformat=2',
135 '-Wold-style-cast',
136 '-Woverloaded-virtual',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530137 '-Wsign-conversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800138 '-Wunused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530139 '-Wno-attributes',
140 ]),
141 language: 'cpp'
142)
143
144if (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0'))
145add_project_arguments(
146 cxx.get_supported_arguments([
147 '-Weverything',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530148 '-Wno-c++98-compat-pedantic',
Ed Tanousf523c322021-12-03 10:46:48 -0800149 '-Wno-c++98-compat',
150 '-Wno-documentation-unknown-command',
151 '-Wno-documentation',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530152 '-Wno-exit-time-destructors',
Ed Tanousf523c322021-12-03 10:46:48 -0800153 '-Wno-global-constructors',
154 '-Wno-newline-eof',
155 '-Wno-padded',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530156 '-Wno-shadow',
157 '-Wno-used-but-marked-unused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530158 '-Wno-weak-vtables',
Ed Tanouse6801eb2022-12-19 16:11:13 -0800159 '-Wno-switch-enum',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530160 ]),
161 language:'cpp')
162endif
163
164# if compiler is gnu-gcc , and version is > 8.0 then we add few more
165# compiler arguments , we know that will pass
166
167if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0'))
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530168 add_project_arguments(
169 cxx.get_supported_arguments([
170 '-Wduplicated-cond',
171 '-Wduplicated-branches',
172 '-Wlogical-op',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530173 '-Wnull-dereference',
Ed Tanous079360a2022-06-29 10:05:19 -0700174 '-Wunused-parameter',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530175 '-Wdouble-promotion',
Ed Tanous8a592812022-06-04 09:06:59 -0700176 '-Wshadow',
Ed Tanous30f11eb2022-05-25 10:42:15 -0700177 '-Wno-psabi',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530178 ]),
179 language:'cpp')
Ed Tanousc66403c2021-09-22 15:28:57 -0700180endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530181
Ed Tanousc66403c2021-09-22 15:28:57 -0700182if (get_option('buildtype') != 'plain')
183 if (get_option('b_lto') == true and get_option('optimization')!='0')
184 # Reduce the binary size by removing unnecessary
185 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530186
Ed Tanousc66403c2021-09-22 15:28:57 -0700187 add_project_arguments(
188 cxx.get_supported_arguments([
189 '-fno-fat-lto-objects',
190 '-fvisibility=hidden',
191 '-fvisibility-inlines-hidden'
192 ]),
193 language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530194
Ed Tanousc66403c2021-09-22 15:28:57 -0700195 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
196 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
George Liue8204932021-02-01 14:42:49 +0800197 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530198 endif
199endif
200
Myung Bae662aa6e2023-01-10 14:20:28 -0600201if( get_option('bmcweb-logging') != 'disabled' or \
Ed Tanousc66403c2021-09-22 15:28:57 -0700202 get_option('buildtype').startswith('debug'))
203 add_project_arguments([
Ed Tanousc66403c2021-09-22 15:28:57 -0700204 '-DBMCWEB_ENABLE_DEBUG'
205 ],
206 language : 'cpp')
207
Myung Bae662aa6e2023-01-10 14:20:28 -0600208 summary('debug', '-DBMCWEB_ENABLE_DEBUG', section : 'Enabled Features')
Ed Tanousc66403c2021-09-22 15:28:57 -0700209endif
210
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530211# Set Compiler Security flags
212
213security_flags = [
Ed Tanouscf2f9322021-09-22 15:34:41 -0700214 '-fstack-protector-strong',
215 '-fPIE',
216 '-fPIC',
217 '-D_FORTIFY_SOURCE=2',
218 '-Wformat',
219 '-Wformat-security'
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530220]
221
222## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
223
224if not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug'))
225 add_project_arguments(
226 cxx.get_supported_arguments([
227 security_flags
228 ]),
229 language: 'cpp')
230endif
231
232# Boost dependency configuration
233
234add_project_arguments(
235cxx.get_supported_arguments([
Ed Tanouscf2f9322021-09-22 15:34:41 -0700236 '-DBOOST_ALL_NO_LIB',
Ed Tanouscf2f9322021-09-22 15:34:41 -0700237 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Ed Tanousf523c322021-12-03 10:46:48 -0800238 '-DBOOST_ASIO_DISABLE_THREADS',
239 '-DBOOST_ASIO_NO_DEPRECATED',
240 '-DBOOST_ASIO_SEPARATE_COMPILATION',
241 '-DBOOST_BEAST_SEPARATE_COMPILATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800242 '-DBOOST_EXCEPTION_DISABLE',
Ed Tanousab6b6fe2022-08-02 20:28:15 -0700243 '-DBOOST_URL_NO_SOURCE_LOCATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800244 '-DJSON_NOEXCEPTION',
Ed Tanous209aa902022-08-02 21:11:06 -0700245 '-DOPENSSL_NO_FILENAMES',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530246]),
247language : 'cpp')
248
249# Find the dependency modules, if not found use meson wrap to get them
250# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800251bmcweb_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530252
Nan Zhou8682c5a2021-11-13 11:00:07 -0800253pam = cxx.find_library('pam', required: true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530254atomic = cxx.find_library('atomic', required: true)
255openssl = dependency('openssl', required : true)
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800256bmcweb_dependencies += [pam, atomic, openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530257
Ed Tanous7bb985e2021-09-02 14:31:40 -0700258sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530259if not sdbusplus.found()
260 sdbusplus_proj = subproject('sdbusplus', required: true)
261 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
262 sdbusplus = sdbusplus.as_system('system')
263endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800264bmcweb_dependencies += sdbusplus
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530265
Cody Smith3a097b22022-05-19 14:22:32 -0700266tinyxml = dependency('tinyxml2',
267 default_options: ['tests=false'],
268 include_type: 'system',
269)
270bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530271
272systemd = dependency('systemd')
273zlib = dependency('zlib')
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800274bmcweb_dependencies += [systemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530275
276if cxx.has_header('nlohmann/json.hpp')
277 nlohmann_json = declare_dependency()
278else
Josh Lehan259df352021-10-07 15:20:02 -0700279 nlohmann_json_proj = subproject('nlohmann', required: true)
280 nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep')
Ed Tanousb00dcc22021-02-23 12:52:50 -0800281 nlohmann_json = nlohmann_json.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530282endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800283bmcweb_dependencies += nlohmann_json
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530284
Ed Tanous079360a2022-06-29 10:05:19 -0700285boost = dependency('boost',version : '>=1.81.0', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530286if not boost.found()
Ed Tanousf165dee2022-10-25 11:55:49 -0700287 boost = subproject('boost', required: true).get_variable('boost_dep')
Ed Tanous6c7d53a2022-11-02 16:47:45 -0700288 boost = boost.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530289endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800290bmcweb_dependencies += boost
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530291
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530292if get_option('tests').enabled()
293 gtest = dependency('gtest', main: true,disabler: true, required : false)
294 gmock = dependency('gmock', required : false)
295 if not gtest.found() and get_option('tests').enabled()
296 gtest_proj = subproject('gtest', required: true)
297 gtest = gtest_proj.get_variable('gtest_main_dep')
298 gmock = gtest_proj.get_variable('gmock_dep')
299 endif
Ed Tanousb00dcc22021-02-23 12:52:50 -0800300 gtest = gtest.as_system('system')
301 gmock = gmock.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530302endif
303
Patrick Williams4efe3e02023-04-12 08:05:58 -0500304systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530305
306bindir = get_option('prefix') + '/' +get_option('bindir')
307
308summary({
309 'prefix' : get_option('prefix'),
310 'bindir' : bindir,
311 'systemd unit directory' : systemd_system_unit_dir
312 }, section : 'Directories')
313
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530314install_subdir('static', install_dir : 'share/www', strip_directory : true)
315
Nan Zhou307386e2022-10-12 20:29:34 +0000316# Config subdirectory
317
318subdir('config')
319bmcweb_dependencies += conf_h_dep
320
Ed Tanous02f1cd92021-10-27 12:09:06 -0700321# Source files
Nan Zhou0ad63df2022-10-17 23:03:21 +0000322fs = import('fs')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530323
Nan Zhou0ad63df2022-10-17 23:03:21 +0000324srcfiles_bmcweb = files(
Ed Tanous02f1cd92021-10-27 12:09:06 -0700325 'redfish-core/src/error_messages.cpp',
Sui Chend1d411f2022-04-10 23:09:36 -0700326 'redfish-core/src/registries.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700327 'redfish-core/src/utils/json_utils.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700328 'src/boost_asio_ssl.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800329 'src/boost_asio.cpp',
330 'src/boost_beast.cpp',
331 'src/boost_url.cpp',
Nan Zhou6384e322022-06-23 22:28:25 +0000332 'src/dbus_singleton.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000333)
Ed Tanous02f1cd92021-10-27 12:09:06 -0700334
Ed Tanous42bbcd82023-01-07 18:04:28 -0800335bmcweblib = static_library(
336 'bmcweblib',
337 srcfiles_bmcweb,
338 include_directories : incdir,
339 dependencies: bmcweb_dependencies,
340)
341
Ed Tanous02f1cd92021-10-27 12:09:06 -0700342# Generate the bmcweb executable
343executable(
344 'bmcweb',
Ed Tanous42bbcd82023-01-07 18:04:28 -0800345 'src/webserver_main.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700346 include_directories : incdir,
347 dependencies: bmcweb_dependencies,
Ed Tanous42bbcd82023-01-07 18:04:28 -0800348 link_with: bmcweblib,
Ed Tanous02f1cd92021-10-27 12:09:06 -0700349 link_args: '-Wl,--gc-sections',
350 install: true,
351 install_dir:bindir
352)
353
Nan Zhou0ad63df2022-10-17 23:03:21 +0000354srcfiles_unittest = files(
Nan Zhouc33a0392022-09-10 18:11:41 +0000355 'test/http/crow_getroutes_test.cpp',
356 'test/http/router_test.cpp',
357 'test/http/utility_test.cpp',
Ed Tanous2c9efc32022-07-31 22:08:26 -0700358 'test/http/verb_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000359 'test/include/dbus_utility_test.cpp',
360 'test/include/google/google_service_root_test.cpp',
361 'test/include/http_utility_test.cpp',
362 'test/include/human_sort_test.cpp',
363 'test/include/ibm/configfile_test.cpp',
364 'test/include/ibm/lock_test.cpp',
365 'test/include/multipart_test.cpp',
366 'test/include/openbmc_dbus_rest_test.cpp',
Ed Tanous50ebd4a2023-01-19 19:03:17 -0800367 'test/include/str_utility_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000368 'test/redfish-core/include/privileges_test.cpp',
Carson Labrado7e8890c2022-11-23 23:58:01 +0000369 'test/redfish-core/include/redfish_aggregator_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000370 'test/redfish-core/include/registries_test.cpp',
371 'test/redfish-core/include/utils/hex_utils_test.cpp',
372 'test/redfish-core/include/utils/ip_utils_test.cpp',
373 'test/redfish-core/include/utils/json_utils_test.cpp',
374 'test/redfish-core/include/utils/query_param_test.cpp',
375 'test/redfish-core/include/utils/stl_utils_test.cpp',
376 'test/redfish-core/include/utils/time_utils_test.cpp',
377 'test/redfish-core/lib/chassis_test.cpp',
Ed Tanousc71d6122022-11-29 14:10:32 -0800378 'test/redfish-core/lib/sensors_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000379 'test/redfish-core/lib/log_services_dump_test.cpp',
380 'test/redfish-core/lib/service_root_test.cpp',
381 'test/redfish-core/lib/thermal_subsystem_test.cpp',
Chicago Duan77b36432021-02-05 15:48:26 +0800382 'test/redfish-core/lib/power_subsystem_test.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000383)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530384
385if(get_option('tests').enabled())
Ed Tanous02f1cd92021-10-27 12:09:06 -0700386 # generate the test executable
Nan Zhou0ad63df2022-10-17 23:03:21 +0000387 foreach test_src : srcfiles_unittest
388 test_bin = executable(
389 fs.stem(test_src),
Ed Tanous42bbcd82023-01-07 18:04:28 -0800390 test_src,
391 link_with: bmcweblib,
Nan Zhou0ad63df2022-10-17 23:03:21 +0000392 include_directories : incdir,
393 install_dir: bindir,
394 dependencies: bmcweb_dependencies + [
395 gtest,
396 gmock,
397 ]
398 )
399 test(fs.stem(test_src), test_bin)
400 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530401endif