blob: 04906fae08fbfa3490fac3fbc5830823be495ca6 [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
Patrick Williams549bed22023-11-29 06:45:06 -0600104 if(get_option(option_key).allowed())
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530105 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
Patrick Williams549bed22023-11-29 06:45:06 -0600127if(get_option('tests').allowed())
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530128 summary('unittest','NA', section : 'Enabled Features')
129endif
130
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530131# Add compiler arguments
132
Ed Tanousade3f092024-03-13 13:28:36 -0700133if (cxx.get_id() == 'clang')
134 if (cxx.version().version_compare('<17.0'))
135 error('This project requires clang-17 or higher')
136 endif
137 add_project_arguments(
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530138 '-Weverything',
Ed Tanousade3f092024-03-13 13:28:36 -0700139 '-Wformat=2',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530140 '-Wno-c++98-compat-pedantic',
Ed Tanousf523c322021-12-03 10:46:48 -0800141 '-Wno-c++98-compat',
142 '-Wno-documentation-unknown-command',
143 '-Wno-documentation',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530144 '-Wno-exit-time-destructors',
Ed Tanousf523c322021-12-03 10:46:48 -0800145 '-Wno-global-constructors',
146 '-Wno-newline-eof',
147 '-Wno-padded',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530148 '-Wno-shadow',
149 '-Wno-used-but-marked-unused',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530150 '-Wno-weak-vtables',
Ed Tanouse6801eb2022-12-19 16:11:13 -0800151 '-Wno-switch-enum',
Ed Tanous72b90762023-10-31 16:41:16 -0700152 '-Wno-unused-macros',
Ed Tanous4da04902024-03-19 11:32:44 -0700153 '-Wno-covered-switch-default',
Ed Tanousade3f092024-03-13 13:28:36 -0700154 language:'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530155endif
156
Ed Tanousade3f092024-03-13 13:28:36 -0700157if (cxx.get_id() == 'gcc')
158 if (cxx.version().version_compare('<13.0'))
159 error('This project requires gcc-13 or higher')
160 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530161
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530162 add_project_arguments(
Ed Tanousade3f092024-03-13 13:28:36 -0700163 '-Wformat=2',
164 '-Wcast-align',
165 '-Wconversion',
166 '-Woverloaded-virtual',
167 '-Wsign-conversion',
168 '-Wunused',
169 '-Wduplicated-cond',
170 '-Wduplicated-branches',
171 '-Wlogical-op',
172 '-Wnull-dereference',
173 '-Wunused-parameter',
174 '-Wdouble-promotion',
175 '-Wshadow',
176 '-Wno-psabi',
177 '-Wno-attributes',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530178 language:'cpp')
Ed Tanousc66403c2021-09-22 15:28:57 -0700179endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530180
Ed Tanousc66403c2021-09-22 15:28:57 -0700181if (get_option('buildtype') != 'plain')
182 if (get_option('b_lto') == true and get_option('optimization')!='0')
183 # Reduce the binary size by removing unnecessary
184 # dynamic symbol table entries
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530185
Ed Tanousc66403c2021-09-22 15:28:57 -0700186 add_project_arguments(
187 cxx.get_supported_arguments([
188 '-fno-fat-lto-objects',
189 '-fvisibility=hidden',
190 '-fvisibility-inlines-hidden'
191 ]),
192 language: 'cpp')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530193
Ed Tanousc66403c2021-09-22 15:28:57 -0700194 if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
195 add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
George Liue8204932021-02-01 14:42:49 +0800196 endif
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530197 endif
198endif
199
Myung Bae662aa6e2023-01-10 14:20:28 -0600200if( get_option('bmcweb-logging') != 'disabled' or \
Ed Tanousc66403c2021-09-22 15:28:57 -0700201 get_option('buildtype').startswith('debug'))
202 add_project_arguments([
Ed Tanousc66403c2021-09-22 15:28:57 -0700203 '-DBMCWEB_ENABLE_DEBUG'
204 ],
205 language : 'cpp')
206
Myung Bae662aa6e2023-01-10 14:20:28 -0600207 summary('debug', '-DBMCWEB_ENABLE_DEBUG', section : 'Enabled Features')
Ed Tanousc66403c2021-09-22 15:28:57 -0700208endif
209
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530210# Set Compiler Security flags
211
212security_flags = [
Ed Tanouscf2f9322021-09-22 15:34:41 -0700213 '-fstack-protector-strong',
214 '-fPIE',
215 '-fPIC',
216 '-D_FORTIFY_SOURCE=2',
217 '-Wformat',
218 '-Wformat-security'
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530219]
220
221## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
222
223if not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug'))
224 add_project_arguments(
225 cxx.get_supported_arguments([
226 security_flags
227 ]),
228 language: 'cpp')
229endif
230
231# Boost dependency configuration
232
233add_project_arguments(
234cxx.get_supported_arguments([
Ed Tanous6fd29552023-10-04 09:40:14 -0700235 '-DBOOST_ASIO_DISABLE_CONCEPTS',
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 Tanousf7065512023-05-30 13:00:57 -0700243 '-DBOOST_NO_EXCEPTIONS',
Ed Tanousab6b6fe2022-08-02 20:28:15 -0700244 '-DBOOST_URL_NO_SOURCE_LOCATION',
Ed Tanous9e710e72022-03-12 17:40:04 -0800245 '-DJSON_NOEXCEPTION',
Ed Tanous209aa902022-08-02 21:11:06 -0700246 '-DOPENSSL_NO_FILENAMES',
Ed Tanousf7065512023-05-30 13:00:57 -0700247 '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530248]),
249language : 'cpp')
250
251# Find the dependency modules, if not found use meson wrap to get them
252# automatically during the configure step
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800253bmcweb_dependencies = []
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530254
Nan Zhou8682c5a2021-11-13 11:00:07 -0800255pam = cxx.find_library('pam', required: true)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530256atomic = cxx.find_library('atomic', required: true)
Ed Tanouse7923992023-12-03 14:14:02 -0800257bmcweb_dependencies += [pam, atomic]
258
259openssl = dependency('openssl', required : false, version: '>=3.0.0')
260if not openssl.found() or get_option('b_sanitize') != 'none'
261 openssl_proj = subproject(
262 'openssl',
263 required: true,
264 default_options: ['warning_level=0', 'werror=false']
265 )
266 openssl = openssl_proj.get_variable('openssl_dep')
267 openssl = openssl.as_system('system')
268else
269 # When we build openssl as a subproject, the warnings analyzer starts
270 # flagging all the C macros as old style casts, so only enable the
271 # warning for non subprojects.
272 add_project_arguments('-Wold-style-cast', language: 'cpp')
273endif
274bmcweb_dependencies += [openssl]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530275
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800276nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required : false)
277if not nghttp2.found()
278 cmake = import('cmake')
279 opt_var = cmake.subproject_options()
280 opt_var.add_cmake_defines({
281 'ENABLE_LIB_ONLY': true,
282 'ENABLE_STATIC_LIB': true
283 })
284 nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
Ed Tanous144983c2024-03-28 00:39:10 -0700285 nghttp2 = nghttp2_ex.dependency('nghttp2_static')
Ed Tanousfca2cbe2021-01-28 14:49:59 -0800286endif
287bmcweb_dependencies += nghttp2
288
Ed Tanous7bb985e2021-09-02 14:31:40 -0700289sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530290if not sdbusplus.found()
291 sdbusplus_proj = subproject('sdbusplus', required: true)
292 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
293 sdbusplus = sdbusplus.as_system('system')
294endif
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800295bmcweb_dependencies += sdbusplus
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530296
Ed Tanousc9374ff2023-05-26 09:42:08 -0700297tinyxml = dependency(
298 'tinyxml2',
Cody Smith3a097b22022-05-19 14:22:32 -0700299 include_type: 'system',
Ed Tanousc9374ff2023-05-26 09:42:08 -0700300 version: '>=9.0.0',
Cody Smith3a097b22022-05-19 14:22:32 -0700301)
Ed Tanousc9374ff2023-05-26 09:42:08 -0700302if not tinyxml.found()
303 tinyxml_proj = subproject('tinyxml2', required: true)
304 tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
305 tinyxml = tinyxml.as_system('system')
306endif
Cody Smith3a097b22022-05-19 14:22:32 -0700307bmcweb_dependencies += tinyxml
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530308
309systemd = dependency('systemd')
310zlib = dependency('zlib')
Jason M. Billsceb8ddc2020-11-23 14:38:39 -0800311bmcweb_dependencies += [systemd, zlib]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530312
Patrick Williamsdfd55472023-12-07 11:50:37 -0600313nlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system')
314bmcweb_dependencies += nlohmann_json_dep
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530315
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000316boost = dependency(
317 'boost',
318 modules: [
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000319 'url',
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000320 ],
Ed Tanous619b8602024-03-14 11:32:08 -0700321 version : '>=1.84.0',
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000322 required : false,
323 include_type: 'system'
324)
Ed Tanous6fd29552023-10-04 09:40:14 -0700325if boost.found()
326 bmcweb_dependencies += [boost]
327else
328 cmake = import('cmake')
329 opt = cmake.subproject_options()
330 opt.add_cmake_defines({
Ed Tanous144983c2024-03-28 00:39:10 -0700331 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid',
332 'BUILD_SHARED_LIBS': 'OFF',
Ed Tanous6fd29552023-10-04 09:40:14 -0700333 })
Ed Tanous144983c2024-03-28 00:39:10 -0700334
Ed Tanous6fd29552023-10-04 09:40:14 -0700335 boost = cmake.subproject('boost', required: true, options: opt)
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000336 boost_asio = boost.dependency('boost_asio').as_system()
337 boost_beast = boost.dependency('boost_beast').as_system()
338 boost_callable_traits = boost.dependency('boost_callable_traits').as_system()
Ed Tanous6fd29552023-10-04 09:40:14 -0700339 boost_headers = boost.dependency('boost_headers').as_system()
Carson Labrado2b5b4da2023-10-18 00:02:10 +0000340 boost_process = boost.dependency('boost_process').as_system()
341 boost_type_index = boost.dependency('boost_type_index').as_system()
342 boost_url = boost.dependency('boost_url').as_system()
343 boost_uuid = boost.dependency('boost_uuid').as_system()
344 bmcweb_dependencies += [
345 boost_asio,
346 boost_beast,
347 boost_callable_traits,
348 boost_headers,
349 boost_process,
350 boost_type_index,
351 boost_url,
352 boost_uuid
353 ]
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530354endif
355
Patrick Williams549bed22023-11-29 06:45:06 -0600356if get_option('tests').allowed()
Ed Tanous7a6f0032024-01-28 09:49:03 -0800357 gtest = dependency('gtest', main: true, version: '>=1.14.0', disabler: true, required : false)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530358 gmock = dependency('gmock', required : false)
Patrick Williams549bed22023-11-29 06:45:06 -0600359 if not gtest.found() and get_option('tests').allowed()
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530360 gtest_proj = subproject('gtest', required: true)
361 gtest = gtest_proj.get_variable('gtest_main_dep')
362 gmock = gtest_proj.get_variable('gmock_dep')
363 endif
Ed Tanousb00dcc22021-02-23 12:52:50 -0800364 gtest = gtest.as_system('system')
365 gmock = gmock.as_system('system')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530366endif
367
Patrick Williams4efe3e02023-04-12 08:05:58 -0500368systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530369
370bindir = get_option('prefix') + '/' +get_option('bindir')
371
372summary({
373 'prefix' : get_option('prefix'),
374 'bindir' : bindir,
375 'systemd unit directory' : systemd_system_unit_dir
376 }, section : 'Directories')
377
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530378install_subdir('static', install_dir : 'share/www', strip_directory : true)
379
Nan Zhou307386e2022-10-12 20:29:34 +0000380# Config subdirectory
381
382subdir('config')
383bmcweb_dependencies += conf_h_dep
384
Ed Tanous02f1cd92021-10-27 12:09:06 -0700385# Source files
Nan Zhou0ad63df2022-10-17 23:03:21 +0000386fs = import('fs')
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530387
Nan Zhou0ad63df2022-10-17 23:03:21 +0000388srcfiles_bmcweb = files(
Ed Tanous02f1cd92021-10-27 12:09:06 -0700389 'redfish-core/src/error_messages.cpp',
Sui Chend1d411f2022-04-10 23:09:36 -0700390 'redfish-core/src/registries.cpp',
Ed Tanousd02aad32024-02-13 14:43:34 -0800391 'redfish-core/src/utils/dbus_utils.cpp',
Ed Tanous1b8b02a2023-01-08 12:35:35 -0800392 'redfish-core/src/utils/time_utils.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700393 'redfish-core/src/utils/json_utils.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700394 'src/boost_asio_ssl.cpp',
Ed Tanousf523c322021-12-03 10:46:48 -0800395 'src/boost_asio.cpp',
396 'src/boost_beast.cpp',
Nan Zhou6384e322022-06-23 22:28:25 +0000397 'src/dbus_singleton.cpp',
Ed Tanous61e349a2023-05-31 11:57:43 -0700398 'src/json_html_serializer.cpp',
Ed Tanous2c6ffdb2023-06-28 11:28:38 -0700399 'src/ossl_random.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000400)
Ed Tanous02f1cd92021-10-27 12:09:06 -0700401
Ed Tanous42bbcd82023-01-07 18:04:28 -0800402bmcweblib = static_library(
403 'bmcweblib',
404 srcfiles_bmcweb,
405 include_directories : incdir,
406 dependencies: bmcweb_dependencies,
407)
408
Ed Tanous02f1cd92021-10-27 12:09:06 -0700409# Generate the bmcweb executable
410executable(
411 'bmcweb',
Ed Tanous42bbcd82023-01-07 18:04:28 -0800412 'src/webserver_main.cpp',
Ed Tanous02f1cd92021-10-27 12:09:06 -0700413 include_directories : incdir,
414 dependencies: bmcweb_dependencies,
Ed Tanous42bbcd82023-01-07 18:04:28 -0800415 link_with: bmcweblib,
Ed Tanous02f1cd92021-10-27 12:09:06 -0700416 link_args: '-Wl,--gc-sections',
417 install: true,
418 install_dir:bindir
419)
420
Nan Zhou0ad63df2022-10-17 23:03:21 +0000421srcfiles_unittest = files(
Nan Zhouc33a0392022-09-10 18:11:41 +0000422 'test/http/crow_getroutes_test.cpp',
Ed Tanous52dd6932024-01-29 08:34:59 -0800423 'test/http/http2_connection_test.cpp',
Ed Tanous4fa45df2023-09-01 14:20:50 -0700424 'test/http/http_connection_test.cpp',
Ed Tanouse7923992023-12-03 14:14:02 -0800425 'test/http/mutual_tls.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000426 'test/http/router_test.cpp',
Ed Tanous1fccd0d2024-03-19 09:16:16 -0700427 'test/http/parsing_test.cpp',
Abhilash Raju8e3f7032023-07-17 08:53:11 -0500428 'test/http/http_response_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000429 'test/http/utility_test.cpp',
Ed Tanous2c9efc32022-07-31 22:08:26 -0700430 'test/http/verb_test.cpp',
Ed Tanous8f79c5b2024-01-30 15:56:37 -0800431 'test/http/server_sent_event_test.cpp',
Marco Kawajiri0e373b52023-10-31 13:36:58 -0700432 'test/http/mutual_tls_meta.cpp',
Ed Tanousb2896142024-01-31 15:25:47 -0800433 'test/http/http_body_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000434 'test/include/dbus_utility_test.cpp',
435 'test/include/google/google_service_root_test.cpp',
Ed Tanous5a60c562023-05-18 13:52:34 -0700436 'test/include/json_html_serializer.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000437 'test/include/http_utility_test.cpp',
438 'test/include/human_sort_test.cpp',
Ed Tanouse1452be2021-10-04 17:03:52 -0700439 'test/include/async_resolve_test.cpp',
Ed Tanous11e8f602023-08-24 14:25:18 -0700440 'test/include/credential_pipe_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000441 'test/include/ibm/configfile_test.cpp',
442 'test/include/ibm/lock_test.cpp',
443 'test/include/multipart_test.cpp',
444 'test/include/openbmc_dbus_rest_test.cpp',
Ed Tanous50ebd4a2023-01-19 19:03:17 -0800445 'test/include/str_utility_test.cpp',
Ed Tanous2c6ffdb2023-06-28 11:28:38 -0700446 'test/include/ossl_random.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000447 'test/redfish-core/include/privileges_test.cpp',
Carson Labrado7e8890c2022-11-23 23:58:01 +0000448 'test/redfish-core/include/redfish_aggregator_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000449 'test/redfish-core/include/registries_test.cpp',
450 'test/redfish-core/include/utils/hex_utils_test.cpp',
Ed Tanousd02aad32024-02-13 14:43:34 -0800451 'test/redfish-core/include/utils/dbus_utils.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000452 'test/redfish-core/include/utils/ip_utils_test.cpp',
453 'test/redfish-core/include/utils/json_utils_test.cpp',
454 'test/redfish-core/include/utils/query_param_test.cpp',
455 'test/redfish-core/include/utils/stl_utils_test.cpp',
456 'test/redfish-core/include/utils/time_utils_test.cpp',
457 'test/redfish-core/lib/chassis_test.cpp',
Ed Tanousc71d6122022-11-29 14:10:32 -0800458 'test/redfish-core/lib/sensors_test.cpp',
Andrew Geissler33e1f122024-02-26 21:10:16 -0600459 'test/redfish-core/lib/system_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000460 'test/redfish-core/lib/log_services_dump_test.cpp',
Myung Bae75e8e212023-11-30 12:53:46 -0800461 'test/redfish-core/lib/log_services_test.cpp',
Ed Tanousf86bcc82023-08-25 09:34:07 -0700462 'test/redfish-core/lib/update_service_test.cpp',
Nan Zhouc33a0392022-09-10 18:11:41 +0000463 'test/redfish-core/lib/service_root_test.cpp',
464 'test/redfish-core/lib/thermal_subsystem_test.cpp',
Chicago Duan77b36432021-02-05 15:48:26 +0800465 'test/redfish-core/lib/power_subsystem_test.cpp',
Jagpal Singh Gille610b312023-12-20 15:35:41 -0800466 'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
Nan Zhou0ad63df2022-10-17 23:03:21 +0000467)
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530468
Ed Tanouse7923992023-12-03 14:14:02 -0800469
Patrick Williams549bed22023-11-29 06:45:06 -0600470if(get_option('tests').allowed())
Ed Tanous02f1cd92021-10-27 12:09:06 -0700471 # generate the test executable
Nan Zhou0ad63df2022-10-17 23:03:21 +0000472 foreach test_src : srcfiles_unittest
473 test_bin = executable(
474 fs.stem(test_src),
Ed Tanous42bbcd82023-01-07 18:04:28 -0800475 test_src,
476 link_with: bmcweblib,
Nan Zhou0ad63df2022-10-17 23:03:21 +0000477 include_directories : incdir,
478 install_dir: bindir,
479 dependencies: bmcweb_dependencies + [
480 gtest,
481 gmock,
482 ]
483 )
484 test(fs.stem(test_src), test_bin)
485 endforeach
Manojkiran Edaaf6298d2020-05-27 08:51:32 +0530486endif