blob: c293e00e3fc365cca0e994bde0ff911f8a9fe001 [file] [log] [blame]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +05301project('bmcweb', 'cpp',
2 version : '1.0',
Patrick Williamsc52ee722021-10-06 15:17:42 -05003 meson_version: '>=0.57.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',
73 'kvm' : '-DBMCWEB_ENABLE_KVM' ,
74 'mutual-tls-auth' : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION',
Carson Labrado7fb33562022-04-18 23:26:56 +000075 'redfish-aggregation' : '-DBMCWEB_ENABLE_REDFISH_AGGREGATION',
Ed Tanousf523c322021-12-03 10:46:48 -080076 'redfish-allow-deprecated-power-thermal' : '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053077 'redfish-bmc-journal' : '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL',
78 'redfish-cpu-log' : '-DBMCWEB_ENABLE_REDFISH_CPU_LOG',
79 'redfish-dbus-log' : '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES',
80 'redfish-dump-log' : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG',
Ed Tanousf523c322021-12-03 10:46:48 -080081 'redfish-host-logger' : '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053082 'redfish-new-powersubsystem-thermalsubsystem' : '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM',
Gunnar Mills54dce7f2022-08-05 17:01:32 +000083 'redfish-oem-manager-fan-data' : '-DBMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA',
Ed Tanousf523c322021-12-03 10:46:48 -080084 'redfish-provisioning-feature' : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE',
Ed Tanous4dc23f32022-05-11 11:32:19 -070085 'redfish-post-to-old-updateservice' : '-DBMCWEB_ENABLE_REDFISH_UPDATESERVICE_OLD_POST_URL',
Ed Tanousf523c322021-12-03 10:46:48 -080086 'redfish' : '-DBMCWEB_ENABLE_REDFISH',
87 'rest' : '-DBMCWEB_ENABLE_DBUS_REST',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053088 'session-auth' : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION',
89 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053090 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET',
91 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION',
Ed Tanousf523c322021-12-03 10:46:48 -080092 #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053093}
94
95# Get the options status and build a project summary to show which flags are
96# being enabled during the configuration time.
97
98foreach option_key,option_value : feature_map
99 if(get_option(option_key).enabled())
100 if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl')
101 if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled())
102 add_project_arguments(option_value,language:'cpp')
103 summary(option_key,option_value, section : 'Enabled Features')
104 endif
Nan Zhou3acced22022-07-12 23:21:02 +0000105 elif (option_key in ['basic-auth', 'cookie-auth', 'session-auth', 'xtoken-auth', 'mutual-tls-auth'])
106 if (get_option('insecure-disable-auth').disabled())
107 add_project_arguments(option_value, language:'cpp')
108 summary(option_key,option_value, section : 'Enabled Features')
109 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530110 else
111 summary(option_key,option_value, section : 'Enabled Features')
112 add_project_arguments(option_value,language:'cpp')
113 endif
114 else
115 if(option_key == 'insecure-disable-ssl')
116 summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features')
117 add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp')
118 endif
119 endif
120endforeach
121
122if(get_option('tests').enabled())
123 summary('unittest','NA', section : 'Enabled Features')
124endif
125
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530126# Add compiler arguments
127
128# -Wpedantic, -Wextra comes by default with warning level
129add_project_arguments(
130 cxx.get_supported_arguments([
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530131 '-Wcast-align',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530132 '-Wconversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800133 '-Wformat=2',
134 '-Wold-style-cast',
135 '-Woverloaded-virtual',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530136 '-Wsign-conversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800137 '-Wunused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530138 '-Wno-attributes',
139 ]),
140 language: 'cpp'
141)
142
143if (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0'))
144add_project_arguments(
145 cxx.get_supported_arguments([
146 '-Weverything',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530147 '-Wno-c++98-compat-pedantic',
Ed Tanousf523c322021-12-03 10:46:48 -0800148 '-Wno-c++98-compat',
149 '-Wno-documentation-unknown-command',
150 '-Wno-documentation',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530151 '-Wno-exit-time-destructors',
Ed Tanousf523c322021-12-03 10:46:48 -0800152 '-Wno-global-constructors',
153 '-Wno-newline-eof',
154 '-Wno-padded',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530155 '-Wno-shadow',
156 '-Wno-used-but-marked-unused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530157 '-Wno-weak-vtables',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530158 ]),
159 language:'cpp')
160endif
161
162# if compiler is gnu-gcc , and version is > 8.0 then we add few more
163# compiler arguments , we know that will pass
164
165if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0'))
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530166 add_project_arguments(
167 cxx.get_supported_arguments([
168 '-Wduplicated-cond',
169 '-Wduplicated-branches',
170 '-Wlogical-op',
171 '-Wunused-parameter',
172 '-Wnull-dereference',
173 '-Wdouble-promotion',
Ed Tanous8a592812022-06-04 09:06:59 -0700174 '-Wshadow',
Ed Tanous30f11eb2022-05-25 10:42:15 -0700175 '-Wno-psabi',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530176 ]),
177 language:'cpp')
Ed Tanousc66403c2021-09-22 15:28:57 -0700178endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530179
Ed Tanousc66403c2021-09-22 15:28:57 -0700180if (get_option('buildtype') != 'plain')
181 if (get_option('b_lto') == true and get_option('optimization')!='0')
182 # Reduce the binary size by removing unnecessary
183 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530184
Ed Tanousc66403c2021-09-22 15:28:57 -0700185 add_project_arguments(
186 cxx.get_supported_arguments([
187 '-fno-fat-lto-objects',
188 '-fvisibility=hidden',
189 '-fvisibility-inlines-hidden'
190 ]),
191 language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530192
Ed Tanousc66403c2021-09-22 15:28:57 -0700193 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
194 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
George Liue8204932021-02-01 14:42:49 +0800195 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530196 endif
197endif
198
Ed Tanousc66403c2021-09-22 15:28:57 -0700199if( get_option('bmcweb-logging').enabled() or \
200 get_option('buildtype').startswith('debug'))
201 add_project_arguments([
202 '-DBMCWEB_ENABLE_LOGGING',
203 '-DBMCWEB_ENABLE_DEBUG'
204 ],
205 language : 'cpp')
206
207 summary({'debug' :'-DBMCWEB_ENABLE_DEBUG',
208 'logging' : '-DBMCWEB_ENABLE_LOGGING',
Ed Tanousc66403c2021-09-22 15:28:57 -0700209
Ed Tanousc66403c2021-09-22 15:28:57 -0700210 },section : 'Enabled Features')
211endif
212
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530213# Set Compiler Security flags
214
215security_flags = [
Ed Tanouscf2f9322021-09-22 15:34:41 -0700216 '-fstack-protector-strong',
217 '-fPIE',
218 '-fPIC',
219 '-D_FORTIFY_SOURCE=2',
220 '-Wformat',
221 '-Wformat-security'
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530222]
223
224## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
225
226if not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug'))
227 add_project_arguments(
228 cxx.get_supported_arguments([
229 security_flags
230 ]),
231 language: 'cpp')
232endif
233
234# Boost dependency configuration
235
236add_project_arguments(
237cxx.get_supported_arguments([
Ed Tanouscf2f9322021-09-22 15:34:41 -0700238 '-DBOOST_ALL_NO_LIB',
Ed Tanouscf2f9322021-09-22 15:34:41 -0700239 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Ed Tanousf523c322021-12-03 10:46:48 -0800240 '-DBOOST_ASIO_DISABLE_THREADS',
241 '-DBOOST_ASIO_NO_DEPRECATED',
242 '-DBOOST_ASIO_SEPARATE_COMPILATION',
243 '-DBOOST_BEAST_SEPARATE_COMPILATION',
244 '-DBOOST_BEAST_USE_STD_STRING_VIEW',
Ed Tanous9e710e72022-03-12 17:40:04 -0800245 '-DBOOST_EXCEPTION_DISABLE',
Ed Tanousab6b6fe2022-08-02 20:28:15 -0700246 '-DBOOST_URL_NO_SOURCE_LOCATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800247 '-DJSON_NOEXCEPTION',
Ed Tanous209aa902022-08-02 21:11:06 -0700248 '-DOPENSSL_NO_FILENAMES',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530249]),
250language : 'cpp')
251
252# Find the dependency modules, if not found use meson wrap to get them
253# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800254bmcweb_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530255
Nan Zhou8682c5a2021-11-13 11:00:07 -0800256pam = cxx.find_library('pam', required: true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530257atomic = cxx.find_library('atomic', required: true)
258openssl = dependency('openssl', required : true)
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800259bmcweb_dependencies += [pam, atomic, openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530260
Ed Tanous7bb985e2021-09-02 14:31:40 -0700261sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530262if not sdbusplus.found()
263 sdbusplus_proj = subproject('sdbusplus', required: true)
264 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
265 sdbusplus = sdbusplus.as_system('system')
266endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800267bmcweb_dependencies += sdbusplus
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530268
Cody Smith3a097b22022-05-19 14:22:32 -0700269tinyxml = dependency('tinyxml2',
270 default_options: ['tests=false'],
271 include_type: 'system',
272)
273bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530274
275systemd = dependency('systemd')
276zlib = dependency('zlib')
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800277bmcweb_dependencies += [systemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530278
279if cxx.has_header('nlohmann/json.hpp')
280 nlohmann_json = declare_dependency()
281else
Josh Lehan259df352021-10-07 15:20:02 -0700282 nlohmann_json_proj = subproject('nlohmann', required: true)
283 nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep')
Ed Tanousb00dcc22021-02-23 12:52:50 -0800284 nlohmann_json = nlohmann_json.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530285endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800286bmcweb_dependencies += nlohmann_json
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530287
Ed Tanous84825f72022-08-29 12:49:18 -0700288boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530289if not boost.found()
290 subproject('boost', required: false)
Ed Tanous74ab83c2022-08-25 08:44:40 -0700291 boost_inc = include_directories('subprojects/boost_1_80_0/', is_system:true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530292 boost = declare_dependency(include_directories : boost_inc)
Ed Tanousb00dcc22021-02-23 12:52:50 -0800293 boost = boost.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530294endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800295bmcweb_dependencies += boost
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530296
297if cxx.has_header('boost/url/url_view.hpp')
298 boost_url = declare_dependency()
299else
300 subproject('boost-url', required: false)
301 boost_url_inc = include_directories('subprojects/boost-url/include', is_system:true)
302 boost_url= declare_dependency(include_directories : boost_url_inc)
Ed Tanousb00dcc22021-02-23 12:52:50 -0800303 boost_url = boost_url.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530304endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800305bmcweb_dependencies += boost_url
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530306
307if get_option('tests').enabled()
308 gtest = dependency('gtest', main: true,disabler: true, required : false)
309 gmock = dependency('gmock', required : false)
310 if not gtest.found() and get_option('tests').enabled()
311 gtest_proj = subproject('gtest', required: true)
312 gtest = gtest_proj.get_variable('gtest_main_dep')
313 gmock = gtest_proj.get_variable('gmock_dep')
314 endif
Ed Tanousb00dcc22021-02-23 12:52:50 -0800315 gtest = gtest.as_system('system')
316 gmock = gmock.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530317endif
318
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530319# Gather the Configuration data
320
321conf_data = configuration_data()
Ed Tanous0260d9d2021-02-07 19:31:07 +0000322conf_data.set('BMCWEB_HTTP_REQ_BODY_LIMIT_MB', get_option('http-body-limit'))
323xss_enabled = get_option('insecure-disable-xss')
Ed Tanousfeaf1502021-02-23 08:53:50 -0800324conf_data.set10('BMCWEB_INSECURE_DISABLE_XSS_PREVENTION', xss_enabled.enabled())
Ed Tanousfa0b2172022-03-24 10:25:03 -0700325enable_redfish_query = get_option('insecure-enable-redfish-query')
326conf_data.set10('BMCWEB_INSECURE_ENABLE_QUERY_PARAMS', enable_redfish_query.enabled())
Carson Labrado7fb33562022-04-18 23:26:56 +0000327# enable_redfish_aggregation = get_option('redfish-aggregation')
328# conf_data.set10('BMCWEB_ENABLE_REDFISH_AGGREGATION', enable_redfish_aggregation.enabled())
Ed Tanouseb1c47d2022-02-09 11:47:27 -0800329insecure_push_style_notification = get_option('insecure-push-style-notification')
330conf_data.set10('BMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', insecure_push_style_notification.enabled())
Ed Tanous0260d9d2021-02-07 19:31:07 +0000331conf_data.set('MESON_INSTALL_PREFIX', get_option('prefix'))
Vivekanand Veeracholan54d13552021-06-14 19:16:36 -0700332conf_data.set('HTTPS_PORT', get_option('https_port'))
Ed Tanous75312982021-02-11 14:26:02 -0800333configure_file(input: 'bmcweb_config.h.in',
334 output: 'bmcweb_config.h',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530335 configuration: conf_data)
336
337# Configure and install systemd unit files
338
Patrick Williams6a779932021-10-12 20:08:44 -0500339systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530340
341bindir = get_option('prefix') + '/' +get_option('bindir')
342
343summary({
344 'prefix' : get_option('prefix'),
345 'bindir' : bindir,
346 'systemd unit directory' : systemd_system_unit_dir
347 }, section : 'Directories')
348
Vivekanand Veeracholan54d13552021-06-14 19:16:36 -0700349configure_file(input : 'bmcweb.socket.in',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530350 output : 'bmcweb.socket',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530351 install_dir: systemd_system_unit_dir,
Vivekanand Veeracholan54d13552021-06-14 19:16:36 -0700352 configuration: conf_data,
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530353 install : true)
354
355configure_file(input : 'bmcweb.service.in',
356 output : 'bmcweb.service',
357 install_dir: systemd_system_unit_dir,
358 configuration: conf_data,
359 install : true)
360
361# Copy pam-webserver to etc/pam.d
362configure_file(input : 'pam-webserver',
363 output : 'webserver',
364 copy : true,
365 install_dir: '/etc/pam.d',
366 install : true)
367
368install_subdir('static', install_dir : 'share/www', strip_directory : true)
369
Ed Tanous02f1cd92021-10-27 12:09:06 -0700370# Source files
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530371
Ed Tanous02f1cd92021-10-27 12:09:06 -0700372srcfiles_bmcweb = [
373 'redfish-core/src/error_messages.cpp',
374 'redfish-core/src/utils/json_utils.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700375 'src/boost_asio_ssl.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800376 'src/boost_asio.cpp',
377 'src/boost_beast.cpp',
378 'src/boost_url.cpp',
Nan Zhou6384e322022-06-23 22:28:25 +0000379 'src/dbus_singleton.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700380]
381
382# Generate the bmcweb executable
383executable(
384 'bmcweb',
385 srcfiles_bmcweb + ['src/webserver_main.cpp'],
386 include_directories : incdir,
387 dependencies: bmcweb_dependencies,
388 link_args: '-Wl,--gc-sections',
389 install: true,
390 install_dir:bindir
391)
392
393srcfiles_unittest = [
Ed Tanousf523c322021-12-03 10:46:48 -0800394 'http/ut/utility_test.cpp',
Ed Tanous88a03c52022-03-14 10:16:07 -0700395 'http/ut/router_test.cpp',
Nan Zhou322204a2022-07-03 06:07:21 +0000396 'include/google/google_service_root_test.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700397 'include/ut/dbus_utility_test.cpp',
398 'include/ut/http_utility_test.cpp',
399 'include/ut/human_sort_test.cpp',
Ed Tanousc5ba4c22022-02-07 09:59:55 -0800400 'include/ut/multipart_test.cpp',
Josh Lehan482c45a2022-03-29 17:10:44 -0700401 'include/ut/openbmc_dbus_rest_test.cpp',
Ed Tanous7cf436c2022-03-22 23:53:51 -0700402 'redfish-core/include/utils/query_param_test.cpp',
403 'redfish-core/lib/ut/service_root_test.cpp',
Xiaochao Ma29739632021-03-02 15:53:13 +0800404 'redfish-core/lib/ut/thermal_subsystem_test.cpp',
Nan Zhoucf7eba02022-07-21 23:53:20 +0000405 'redfish-core/lib/chassis_test.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700406 'redfish-core/ut/configfile_test.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700407 'redfish-core/ut/hex_utils_test.cpp',
Nan Zhou774258e2022-07-03 22:22:47 +0000408 'redfish-core/ut/ip_utils_test.cpp',
Willy Tu15ed6782021-12-14 11:03:16 -0800409 'redfish-core/ut/json_utils_test.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800410 'redfish-core/ut/lock_test.cpp',
411 'redfish-core/ut/privileges_test.cpp',
Ed Tanousc5ba4c22022-02-07 09:59:55 -0800412 'redfish-core/ut/registries_test.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800413 'redfish-core/ut/stl_utils_test.cpp',
414 'redfish-core/ut/time_utils_test.cpp',
Nan Zhou5ad77202022-06-13 22:33:55 +0000415 'src/crow_getroutes_test.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700416]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530417
418if(get_option('tests').enabled())
Ed Tanous02f1cd92021-10-27 12:09:06 -0700419 # generate the test executable
420 ut_bin = executable(
421 'bmcweb_unit_test',
422 srcfiles_unittest + srcfiles_bmcweb,
423 include_directories : incdir,
424 install_dir: bindir,
425 dependencies: bmcweb_dependencies + [
426 gtest,
427 gmock,
428 ]
429 )
430 test('bmcweb_unit_test', ut_bin)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530431endif