blob: dd8eb81855a3265fa2eb21864cd29d114189ffdd [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
Ed Tanousf8ca6d72022-06-28 12:12:03 -070044if(get_option('dns-resolver') == 'systemd-dbus')
45 add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language : 'cpp')
46endif
47
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053048# Disable lto when compiling with no optimization
49if(get_option('optimization') == '0')
50 add_project_arguments('-fno-lto', language: 'cpp')
51 message('Disabling lto & its supported features as optimization is disabled')
52endif
53
54# Include Directories
55
Ed Tanouscf2f9322021-09-22 15:34:41 -070056incdir = include_directories(
57 'include',
58 'redfish-core/include',
59 'redfish-core/lib',
60 'http'
61)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053062
63# Get the options and enable the respective features
64## create a MAP of "options : feature_flag"
65
66feature_map = {
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053067 'basic-auth' : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION',
68 'cookie-auth' : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION',
69 'google-api' : '-DBMCWEB_ENABLE_GOOGLE_API',
70 'host-serial-socket' : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET',
71 'ibm-management-console' : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE',
Nan Zhoua43ea822022-05-27 00:42:44 +000072 'insecure-disable-auth' : '-DBMCWEB_INSECURE_DISABLE_AUTHX',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053073 'insecure-disable-csrf' : '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION',
74 'insecure-disable-ssl' : '-DBMCWEB_INSECURE_DISABLE_SSL',
75 'insecure-push-style-notification' : '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING',
76 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE',
Ed Tanous1aa0c2b2022-02-08 12:24:30 +010077 'insecure-ignore-content-type' : '-DBMCWEB_INSECURE_IGNORE_CONTENT_TYPE',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053078 'kvm' : '-DBMCWEB_ENABLE_KVM' ,
79 'mutual-tls-auth' : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION',
Carson Labrado7fb33562022-04-18 23:26:56 +000080 'redfish-aggregation' : '-DBMCWEB_ENABLE_REDFISH_AGGREGATION',
Ed Tanousf523c322021-12-03 10:46:48 -080081 'redfish-allow-deprecated-power-thermal' : '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053082 'redfish-bmc-journal' : '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL',
83 'redfish-cpu-log' : '-DBMCWEB_ENABLE_REDFISH_CPU_LOG',
84 'redfish-dbus-log' : '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES',
85 'redfish-dump-log' : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG',
Ed Tanousf523c322021-12-03 10:46:48 -080086 'redfish-host-logger' : '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053087 'redfish-new-powersubsystem-thermalsubsystem' : '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM',
Gunnar Mills54dce7f2022-08-05 17:01:32 +000088 'redfish-oem-manager-fan-data' : '-DBMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA',
Ed Tanousf523c322021-12-03 10:46:48 -080089 'redfish-provisioning-feature' : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE',
90 'redfish' : '-DBMCWEB_ENABLE_REDFISH',
91 'rest' : '-DBMCWEB_ENABLE_DBUS_REST',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053092 'session-auth' : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION',
93 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING',
Ed Tanous7f3e84a2022-12-28 16:22:54 -080094 'experimental-redfish-multi-computer-system' : '-DBMCWEB_ENABLE_MULTI_COMPUTERSYSTEM',
Manojkiran Eda2d74fbc2021-10-28 12:39:49 +053095 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET',
96 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION',
Ed Tanousf523c322021-12-03 10:46:48 -080097 #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +053098}
99
100# Get the options status and build a project summary to show which flags are
101# being enabled during the configuration time.
102
103foreach option_key,option_value : feature_map
104 if(get_option(option_key).enabled())
105 if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl')
106 if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled())
107 add_project_arguments(option_value,language:'cpp')
108 summary(option_key,option_value, section : 'Enabled Features')
109 endif
Nan Zhou3acced22022-07-12 23:21:02 +0000110 elif (option_key in ['basic-auth', 'cookie-auth', 'session-auth', 'xtoken-auth', 'mutual-tls-auth'])
111 if (get_option('insecure-disable-auth').disabled())
112 add_project_arguments(option_value, language:'cpp')
113 summary(option_key,option_value, section : 'Enabled Features')
114 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530115 else
116 summary(option_key,option_value, section : 'Enabled Features')
117 add_project_arguments(option_value,language:'cpp')
118 endif
119 else
120 if(option_key == 'insecure-disable-ssl')
121 summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features')
122 add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp')
123 endif
124 endif
125endforeach
126
127if(get_option('tests').enabled())
128 summary('unittest','NA', section : 'Enabled Features')
129endif
130
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530131# Add compiler arguments
132
133# -Wpedantic, -Wextra comes by default with warning level
134add_project_arguments(
135 cxx.get_supported_arguments([
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530136 '-Wcast-align',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530137 '-Wconversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800138 '-Wformat=2',
139 '-Wold-style-cast',
140 '-Woverloaded-virtual',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530141 '-Wsign-conversion',
Ed Tanousf523c322021-12-03 10:46:48 -0800142 '-Wunused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530143 '-Wno-attributes',
144 ]),
145 language: 'cpp'
146)
147
148if (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0'))
149add_project_arguments(
150 cxx.get_supported_arguments([
151 '-Weverything',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530152 '-Wno-c++98-compat-pedantic',
Ed Tanousf523c322021-12-03 10:46:48 -0800153 '-Wno-c++98-compat',
154 '-Wno-documentation-unknown-command',
155 '-Wno-documentation',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530156 '-Wno-exit-time-destructors',
Ed Tanousf523c322021-12-03 10:46:48 -0800157 '-Wno-global-constructors',
158 '-Wno-newline-eof',
159 '-Wno-padded',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530160 '-Wno-shadow',
161 '-Wno-used-but-marked-unused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530162 '-Wno-weak-vtables',
Ed Tanouse6801eb2022-12-19 16:11:13 -0800163 '-Wno-switch-enum',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530164 ]),
165 language:'cpp')
166endif
167
168# if compiler is gnu-gcc , and version is > 8.0 then we add few more
169# compiler arguments , we know that will pass
170
171if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0'))
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530172 add_project_arguments(
173 cxx.get_supported_arguments([
174 '-Wduplicated-cond',
175 '-Wduplicated-branches',
176 '-Wlogical-op',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530177 '-Wnull-dereference',
Ed Tanous079360a2022-06-29 10:05:19 -0700178 '-Wunused-parameter',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530179 '-Wdouble-promotion',
Ed Tanous8a592812022-06-04 09:06:59 -0700180 '-Wshadow',
Ed Tanous30f11eb2022-05-25 10:42:15 -0700181 '-Wno-psabi',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530182 ]),
183 language:'cpp')
Ed Tanousc66403c2021-09-22 15:28:57 -0700184endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530185
Ed Tanousc66403c2021-09-22 15:28:57 -0700186if (get_option('buildtype') != 'plain')
187 if (get_option('b_lto') == true and get_option('optimization')!='0')
188 # Reduce the binary size by removing unnecessary
189 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530190
Ed Tanousc66403c2021-09-22 15:28:57 -0700191 add_project_arguments(
192 cxx.get_supported_arguments([
193 '-fno-fat-lto-objects',
194 '-fvisibility=hidden',
195 '-fvisibility-inlines-hidden'
196 ]),
197 language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530198
Ed Tanousc66403c2021-09-22 15:28:57 -0700199 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
200 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
George Liue8204932021-02-01 14:42:49 +0800201 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530202 endif
203endif
204
Myung Bae662aa6e2023-01-10 14:20:28 -0600205if( get_option('bmcweb-logging') != 'disabled' or \
Ed Tanousc66403c2021-09-22 15:28:57 -0700206 get_option('buildtype').startswith('debug'))
207 add_project_arguments([
Ed Tanousc66403c2021-09-22 15:28:57 -0700208 '-DBMCWEB_ENABLE_DEBUG'
209 ],
210 language : 'cpp')
211
Myung Bae662aa6e2023-01-10 14:20:28 -0600212 summary('debug', '-DBMCWEB_ENABLE_DEBUG', section : 'Enabled Features')
Ed Tanousc66403c2021-09-22 15:28:57 -0700213endif
214
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530215# Set Compiler Security flags
216
217security_flags = [
Ed Tanouscf2f9322021-09-22 15:34:41 -0700218 '-fstack-protector-strong',
219 '-fPIE',
220 '-fPIC',
221 '-D_FORTIFY_SOURCE=2',
222 '-Wformat',
223 '-Wformat-security'
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530224]
225
226## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
227
228if not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug'))
229 add_project_arguments(
230 cxx.get_supported_arguments([
231 security_flags
232 ]),
233 language: 'cpp')
234endif
235
236# Boost dependency configuration
237
238add_project_arguments(
239cxx.get_supported_arguments([
Ed Tanouscf2f9322021-09-22 15:34:41 -0700240 '-DBOOST_ALL_NO_LIB',
Ed Tanouscf2f9322021-09-22 15:34:41 -0700241 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Ed Tanousf523c322021-12-03 10:46:48 -0800242 '-DBOOST_ASIO_DISABLE_THREADS',
243 '-DBOOST_ASIO_NO_DEPRECATED',
244 '-DBOOST_ASIO_SEPARATE_COMPILATION',
245 '-DBOOST_BEAST_SEPARATE_COMPILATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800246 '-DBOOST_EXCEPTION_DISABLE',
Ed Tanousf7065512023-05-30 13:00:57 -0700247 '-DBOOST_NO_EXCEPTIONS',
Ed Tanousab6b6fe2022-08-02 20:28:15 -0700248 '-DBOOST_URL_NO_SOURCE_LOCATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800249 '-DJSON_NOEXCEPTION',
Ed Tanous209aa902022-08-02 21:11:06 -0700250 '-DOPENSSL_NO_FILENAMES',
Ed Tanousf7065512023-05-30 13:00:57 -0700251 '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530252]),
253language : 'cpp')
254
255# Find the dependency modules, if not found use meson wrap to get them
256# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800257bmcweb_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530258
Nan Zhou8682c5a2021-11-13 11:00:07 -0800259pam = cxx.find_library('pam', required: true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530260atomic = cxx.find_library('atomic', required: true)
261openssl = dependency('openssl', required : true)
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800262bmcweb_dependencies += [pam, atomic, openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530263
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800264nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required : false)
265if not nghttp2.found()
266 cmake = import('cmake')
267 opt_var = cmake.subproject_options()
268 opt_var.add_cmake_defines({
269 'ENABLE_LIB_ONLY': true,
270 'ENABLE_STATIC_LIB': true
271 })
272 nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
273 nghttp2 = nghttp2_ex.dependency('nghttp2')
274endif
275bmcweb_dependencies += nghttp2
276
Ed Tanous7bb985e2021-09-02 14:31:40 -0700277sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530278if not sdbusplus.found()
279 sdbusplus_proj = subproject('sdbusplus', required: true)
280 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
281 sdbusplus = sdbusplus.as_system('system')
282endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800283bmcweb_dependencies += sdbusplus
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530284
Ed Tanousc9374ff2023-05-26 09:42:08 -0700285tinyxml = dependency(
286 'tinyxml2',
Cody Smith3a097b22022-05-19 14:22:32 -0700287 include_type: 'system',
Ed Tanousc9374ff2023-05-26 09:42:08 -0700288 version: '>=9.0.0',
Cody Smith3a097b22022-05-19 14:22:32 -0700289)
Ed Tanousc9374ff2023-05-26 09:42:08 -0700290if not tinyxml.found()
291 tinyxml_proj = subproject('tinyxml2', required: true)
292 tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
293 tinyxml = tinyxml.as_system('system')
294endif
Cody Smith3a097b22022-05-19 14:22:32 -0700295bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530296
297systemd = dependency('systemd')
298zlib = dependency('zlib')
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800299bmcweb_dependencies += [systemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530300
Ed Tanous982dd792023-06-06 08:26:29 -0700301nlohmann_json = dependency('nlohmann_json', version: '>=3.9.2', required: false, include_type: 'system')
Ed Tanousc9374ff2023-05-26 09:42:08 -0700302if not nlohmann_json.found()
Ed Tanous982dd792023-06-06 08:26:29 -0700303 nlohmann_json_proj = subproject('nlohmann_json', required: true)
Josh Lehan259df352021-10-07 15:20:02 -0700304 nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep')
Ed Tanousb00dcc22021-02-23 12:52:50 -0800305 nlohmann_json = nlohmann_json.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530306endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800307bmcweb_dependencies += nlohmann_json
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530308
Ed Tanousc9374ff2023-05-26 09:42:08 -0700309boost = dependency('boost',version : '>=1.82.0', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530310if not boost.found()
Ed Tanousf165dee2022-10-25 11:55:49 -0700311 boost = subproject('boost', required: true).get_variable('boost_dep')
Ed Tanous6c7d53a2022-11-02 16:47:45 -0700312 boost = boost.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530313endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800314bmcweb_dependencies += boost
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530315
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530316if get_option('tests').enabled()
Ed Tanousc9374ff2023-05-26 09:42:08 -0700317 gtest = dependency('gtest', main: true, disabler: true, required : false)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530318 gmock = dependency('gmock', required : false)
319 if not gtest.found() and get_option('tests').enabled()
320 gtest_proj = subproject('gtest', required: true)
321 gtest = gtest_proj.get_variable('gtest_main_dep')
322 gmock = gtest_proj.get_variable('gmock_dep')
323 endif
Ed Tanousb00dcc22021-02-23 12:52:50 -0800324 gtest = gtest.as_system('system')
325 gmock = gmock.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530326endif
327
Patrick Williams4efe3e02023-04-12 08:05:58 -0500328systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530329
330bindir = get_option('prefix') + '/' +get_option('bindir')
331
332summary({
333 'prefix' : get_option('prefix'),
334 'bindir' : bindir,
335 'systemd unit directory' : systemd_system_unit_dir
336 }, section : 'Directories')
337
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530338install_subdir('static', install_dir : 'share/www', strip_directory : true)
339
Nan Zhou307386e2022-10-12 20:29:34 +0000340# Config subdirectory
341
342subdir('config')
343bmcweb_dependencies += conf_h_dep
344
Ed Tanous02f1cd92021-10-27 12:09:06 -0700345# Source files
Nan Zhou0ad63df2022-10-17 23:03:21 +0000346fs = import('fs')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530347
Nan Zhou0ad63df2022-10-17 23:03:21 +0000348srcfiles_bmcweb = files(
Ed Tanous02f1cd92021-10-27 12:09:06 -0700349 'redfish-core/src/error_messages.cpp',
Sui Chend1d411f2022-04-10 23:09:36 -0700350 'redfish-core/src/registries.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700351 'redfish-core/src/utils/json_utils.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700352 'src/boost_asio_ssl.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800353 'src/boost_asio.cpp',
354 'src/boost_beast.cpp',
355 'src/boost_url.cpp',
Nan Zhou6384e322022-06-23 22:28:25 +0000356 'src/dbus_singleton.cpp',
Ed Tanous61e349a2023-05-31 11:57:43 -0700357 'src/json_html_serializer.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000358)
Ed Tanous02f1cd92021-10-27 12:09:06 -0700359
Ed Tanous42bbcd82023-01-07 18:04:28 -0800360bmcweblib = static_library(
361 'bmcweblib',
362 srcfiles_bmcweb,
363 include_directories : incdir,
364 dependencies: bmcweb_dependencies,
365)
366
Ed Tanous02f1cd92021-10-27 12:09:06 -0700367# Generate the bmcweb executable
368executable(
369 'bmcweb',
Ed Tanous42bbcd82023-01-07 18:04:28 -0800370 'src/webserver_main.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700371 include_directories : incdir,
372 dependencies: bmcweb_dependencies,
Ed Tanous42bbcd82023-01-07 18:04:28 -0800373 link_with: bmcweblib,
Ed Tanous02f1cd92021-10-27 12:09:06 -0700374 link_args: '-Wl,--gc-sections',
375 install: true,
376 install_dir:bindir
377)
378
Nan Zhou0ad63df2022-10-17 23:03:21 +0000379srcfiles_unittest = files(
Nan Zhouc33a0392022-09-10 18:11:41 +0000380 'test/http/crow_getroutes_test.cpp',
381 'test/http/router_test.cpp',
382 'test/http/utility_test.cpp',
Ed Tanous2c9efc32022-07-31 22:08:26 -0700383 'test/http/verb_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000384 'test/include/dbus_utility_test.cpp',
385 'test/include/google/google_service_root_test.cpp',
Ed Tanous5a60c562023-05-18 13:52:34 -0700386 'test/include/json_html_serializer.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000387 'test/include/http_utility_test.cpp',
388 'test/include/human_sort_test.cpp',
389 'test/include/ibm/configfile_test.cpp',
390 'test/include/ibm/lock_test.cpp',
391 'test/include/multipart_test.cpp',
392 'test/include/openbmc_dbus_rest_test.cpp',
Ed Tanous50ebd4a2023-01-19 19:03:17 -0800393 'test/include/str_utility_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000394 'test/redfish-core/include/privileges_test.cpp',
Carson Labrado7e8890c2022-11-23 23:58:01 +0000395 'test/redfish-core/include/redfish_aggregator_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000396 'test/redfish-core/include/registries_test.cpp',
397 'test/redfish-core/include/utils/hex_utils_test.cpp',
398 'test/redfish-core/include/utils/ip_utils_test.cpp',
399 'test/redfish-core/include/utils/json_utils_test.cpp',
400 'test/redfish-core/include/utils/query_param_test.cpp',
401 'test/redfish-core/include/utils/stl_utils_test.cpp',
402 'test/redfish-core/include/utils/time_utils_test.cpp',
403 'test/redfish-core/lib/chassis_test.cpp',
Ed Tanousc71d6122022-11-29 14:10:32 -0800404 'test/redfish-core/lib/sensors_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000405 'test/redfish-core/lib/log_services_dump_test.cpp',
406 'test/redfish-core/lib/service_root_test.cpp',
407 'test/redfish-core/lib/thermal_subsystem_test.cpp',
Chicago Duan77b36432021-02-05 15:48:26 +0800408 'test/redfish-core/lib/power_subsystem_test.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000409)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530410
411if(get_option('tests').enabled())
Ed Tanous02f1cd92021-10-27 12:09:06 -0700412 # generate the test executable
Nan Zhou0ad63df2022-10-17 23:03:21 +0000413 foreach test_src : srcfiles_unittest
414 test_bin = executable(
415 fs.stem(test_src),
Ed Tanous42bbcd82023-01-07 18:04:28 -0800416 test_src,
417 link_with: bmcweblib,
Nan Zhou0ad63df2022-10-17 23:03:21 +0000418 include_directories : incdir,
419 install_dir: bindir,
420 dependencies: bmcweb_dependencies + [
421 gtest,
422 gmock,
423 ]
424 )
425 test(fs.stem(test_src), test_bin)
426 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530427endif