Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 1 | project('bmcweb', 'cpp', |
| 2 | version : '1.0', |
| 3 | meson_version: '>=0.53.2', |
| 4 | default_options: [ |
| 5 | 'werror=true', |
| 6 | 'warning_level=3', |
| 7 | 'cpp_std=c++17', |
| 8 | 'buildtype=debugoptimized', |
| 9 | 'b_ndebug=if-release', |
| 10 | 'b_lto=true', |
Manojkiran Eda | cb2ed19 | 2021-02-15 08:30:43 +0530 | [diff] [blame] | 11 | 'cpp_rtti=false', |
| 12 | 'b_lto_mode=default', |
| 13 | 'b_lto_threads=0' |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 14 | ]) |
| 15 | |
| 16 | # Project related links |
| 17 | |
| 18 | project_pretty_name = 'bmcweb' |
| 19 | project_url = 'https://github.com/openbmc/' + project_pretty_name |
| 20 | project_issues_url = project_url + '/issues/new' |
| 21 | summary('Issues',project_issues_url, section: 'Report Issues') |
| 22 | |
| 23 | # Validate the c++ Standard |
| 24 | |
| 25 | if get_option('cpp_std') != 'c++17' |
| 26 | error('This project requires c++17 support') |
| 27 | endif |
| 28 | |
| 29 | # Get compiler and default build type |
| 30 | |
| 31 | cxx = meson.get_compiler('cpp') |
| 32 | build = get_option('buildtype') |
| 33 | optimization = get_option('optimization') |
| 34 | summary('Build Type',build, section : 'Build Info') |
| 35 | summary('Optimization',optimization, section : 'Build Info') |
| 36 | |
Ed Tanous | 5e34b67 | 2021-02-05 14:21:27 -0800 | [diff] [blame] | 37 | |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 38 | # remove debug information for minsize buildtype |
| 39 | if(get_option('buildtype') == 'minsize') |
Ed Tanous | 5e34b67 | 2021-02-05 14:21:27 -0800 | [diff] [blame] | 40 | add_project_arguments(['-fdata-sections', '-ffunction-sections'], language : 'cpp') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 41 | add_project_arguments('-DNDEBUG', language : 'cpp') |
| 42 | endif |
| 43 | |
| 44 | # Disable lto when compiling with no optimization |
| 45 | if(get_option('optimization') == '0') |
| 46 | add_project_arguments('-fno-lto', language: 'cpp') |
| 47 | message('Disabling lto & its supported features as optimization is disabled') |
| 48 | endif |
| 49 | |
| 50 | # Include Directories |
| 51 | |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 52 | incdir = include_directories( |
| 53 | 'include', |
| 54 | 'redfish-core/include', |
| 55 | 'redfish-core/lib', |
| 56 | 'http' |
| 57 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 58 | |
| 59 | # Get the options and enable the respective features |
| 60 | ## create a MAP of "options : feature_flag" |
| 61 | |
| 62 | feature_map = { |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 63 | 'insecure-disable-auth' : '-DBMCWEB_INSECURE_DISABLE_AUTHENTICATION', |
| 64 | 'insecure-disable-csrf' : '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION', |
| 65 | 'insecure-disable-ssl' : '-DBMCWEB_INSECURE_DISABLE_SSL', |
| 66 | 'host-serial-socket' : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET', |
| 67 | 'ibm-management-console' : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE', |
| 68 | 'google-api' : '-DBMCWEB_ENABLE_GOOGLE_API', |
| 69 | 'kvm' : '-DBMCWEB_ENABLE_KVM' , |
| 70 | 'basic-auth' : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION', |
| 71 | 'session-auth' : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION', |
| 72 | 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION', |
| 73 | 'cookie-auth' : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION', |
| 74 | 'mutual-tls-auth' : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION', |
| 75 | 'pam' : '-DWEBSERVER_ENABLE_PAM', |
| 76 | 'insecure-push-style-notification': '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', |
| 77 | 'redfish' : '-DBMCWEB_ENABLE_REDFISH', |
| 78 | '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-provisioning-feature' : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE', |
| 82 | 'redfish-dump-log' : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG', |
| 83 | 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', |
| 84 | 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', |
| 85 | 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', |
| 86 | #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', |
| 87 | 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | # Get the options status and build a project summary to show which flags are |
| 91 | # being enabled during the configuration time. |
| 92 | |
| 93 | foreach option_key,option_value : feature_map |
| 94 | if(get_option(option_key).enabled()) |
| 95 | if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl') |
| 96 | if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled()) |
| 97 | add_project_arguments(option_value,language:'cpp') |
| 98 | summary(option_key,option_value, section : 'Enabled Features') |
| 99 | endif |
| 100 | else |
| 101 | summary(option_key,option_value, section : 'Enabled Features') |
| 102 | add_project_arguments(option_value,language:'cpp') |
| 103 | endif |
| 104 | else |
| 105 | if(option_key == 'insecure-disable-ssl') |
| 106 | summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features') |
| 107 | add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp') |
| 108 | endif |
| 109 | endif |
| 110 | endforeach |
| 111 | |
| 112 | if(get_option('tests').enabled()) |
| 113 | summary('unittest','NA', section : 'Enabled Features') |
| 114 | endif |
| 115 | |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 116 | # Add compiler arguments |
| 117 | |
| 118 | # -Wpedantic, -Wextra comes by default with warning level |
| 119 | add_project_arguments( |
| 120 | cxx.get_supported_arguments([ |
| 121 | '-Wold-style-cast', |
| 122 | '-Wcast-align', |
| 123 | '-Wunused', |
| 124 | '-Woverloaded-virtual', |
| 125 | '-Wconversion', |
| 126 | '-Wsign-conversion', |
| 127 | '-Wno-attributes', |
| 128 | ]), |
| 129 | language: 'cpp' |
| 130 | ) |
| 131 | |
| 132 | if (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0')) |
| 133 | add_project_arguments( |
| 134 | cxx.get_supported_arguments([ |
| 135 | '-Weverything', |
| 136 | '-Wno-c++98-compat', |
| 137 | '-Wno-c++98-compat-pedantic', |
| 138 | '-Wno-global-constructors', |
| 139 | '-Wno-exit-time-destructors', |
| 140 | '-Wno-shadow', |
| 141 | '-Wno-used-but-marked-unused', |
| 142 | '-Wno-documentation-unknown-command', |
| 143 | '-Wno-weak-vtables', |
| 144 | '-Wno-documentation', |
| 145 | '-Wno-padded', |
| 146 | '-Wunused-parameter', |
| 147 | '-Wcovered-switch-default', |
| 148 | '-Wcomma', |
| 149 | '-Wextra-semi', |
| 150 | '-Wzero-as-null-pointer-constant', |
| 151 | '-Wswitch-enum', |
| 152 | '-Wnull-dereference', |
| 153 | '-Wdouble-promotion', |
Ed Tanous | d32c4fa | 2021-09-14 13:16:51 -0700 | [diff] [blame] | 154 | '-Wno-newline-eof', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 155 | '-Wformat=2', |
| 156 | ]), |
| 157 | language:'cpp') |
| 158 | endif |
| 159 | |
| 160 | # if compiler is gnu-gcc , and version is > 8.0 then we add few more |
| 161 | # compiler arguments , we know that will pass |
| 162 | |
| 163 | if (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0')) |
| 164 | |
| 165 | ## remove once bmcweb/issues/147 is fixed |
| 166 | add_global_link_arguments('-Wno-stringop-overflow',language:['c','cpp']) |
| 167 | add_project_arguments('-Wno-stringop-overflow',language:['c','cpp']) |
| 168 | |
| 169 | add_project_arguments( |
| 170 | cxx.get_supported_arguments([ |
| 171 | '-Wduplicated-cond', |
| 172 | '-Wduplicated-branches', |
| 173 | '-Wlogical-op', |
| 174 | '-Wunused-parameter', |
| 175 | '-Wnull-dereference', |
| 176 | '-Wdouble-promotion', |
| 177 | '-Wformat=2', |
| 178 | ]), |
| 179 | language:'cpp') |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 180 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 181 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 182 | if (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 Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 186 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 187 | 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 Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 194 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 195 | if cxx.has_link_argument('-Wl,--exclude-libs,ALL') |
| 196 | add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp') |
George Liu | e820493 | 2021-02-01 14:42:49 +0800 | [diff] [blame] | 197 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 198 | endif |
| 199 | endif |
| 200 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 201 | if( get_option('bmcweb-logging').enabled() or \ |
| 202 | get_option('buildtype').startswith('debug')) |
| 203 | add_project_arguments([ |
| 204 | '-DBMCWEB_ENABLE_LOGGING', |
| 205 | '-DBMCWEB_ENABLE_DEBUG' |
| 206 | ], |
| 207 | language : 'cpp') |
| 208 | |
| 209 | summary({'debug' :'-DBMCWEB_ENABLE_DEBUG', |
| 210 | 'logging' : '-DBMCWEB_ENABLE_LOGGING', |
| 211 | },section : 'Enabled Features') |
| 212 | endif |
| 213 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 214 | if( get_option('redfish-allow-deprecated-power-thermal').enabled()) |
| 215 | add_project_arguments([ |
| 216 | '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL' |
| 217 | ], |
| 218 | language : 'cpp') |
| 219 | |
| 220 | summary({'power-thermal' :'-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL' |
| 221 | },section : 'Enabled Features') |
| 222 | endif |
| 223 | |
| 224 | if( get_option('redfish-new-powersubsystem-thermalsubsystem').enabled()) |
| 225 | add_project_arguments([ |
| 226 | '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM' |
| 227 | ], |
| 228 | language : 'cpp') |
| 229 | |
| 230 | summary({'new-powersubsystem-thermalsubsystem' :'-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM' |
| 231 | },section : 'Enabled Features') |
| 232 | endif |
| 233 | |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 234 | # Set Compiler Security flags |
| 235 | |
| 236 | security_flags = [ |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 237 | '-fstack-protector-strong', |
| 238 | '-fPIE', |
| 239 | '-fPIC', |
| 240 | '-D_FORTIFY_SOURCE=2', |
| 241 | '-Wformat', |
| 242 | '-Wformat-security' |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 243 | ] |
| 244 | |
| 245 | ## Add security flags for builds of type 'release','debugoptimized' and 'minsize' |
| 246 | |
| 247 | if not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug')) |
| 248 | add_project_arguments( |
| 249 | cxx.get_supported_arguments([ |
| 250 | security_flags |
| 251 | ]), |
| 252 | language: 'cpp') |
| 253 | endif |
| 254 | |
| 255 | # Boost dependency configuration |
| 256 | |
| 257 | add_project_arguments( |
| 258 | cxx.get_supported_arguments([ |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 259 | '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', |
| 260 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 261 | '-DBOOST_BEAST_USE_STD_STRING_VIEW', |
Ed Tanous | 2107fe1 | 2021-10-09 16:10:52 -0700 | [diff] [blame] | 262 | '-DBOOST_BEAST_SEPARATE_COMPILATION', |
| 263 | '-DBOOST_ASIO_SEPARATE_COMPILATION', |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 264 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 265 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 266 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 267 | '-DBOOST_ALL_NO_LIB', |
| 268 | '-DBOOST_NO_RTTI', |
| 269 | '-DBOOST_NO_TYPEID', |
| 270 | '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING', |
| 271 | '-DBOOST_URL_STANDALONE', |
| 272 | '-DBOOST_URL_HEADER_ONLY', |
| 273 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
| 274 | '-DJSON_NOEXCEPTION' |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 275 | ]), |
| 276 | language : 'cpp') |
| 277 | |
| 278 | # Find the dependency modules, if not found use meson wrap to get them |
| 279 | # automatically during the configure step |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 280 | bmcweb_dependencies = [] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 281 | |
| 282 | pam = cxx.find_library('pam', required: get_option('pam')) |
| 283 | atomic = cxx.find_library('atomic', required: true) |
| 284 | openssl = dependency('openssl', required : true) |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 285 | bmcweb_dependencies += [pam, atomic, openssl] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 286 | |
Ed Tanous | 7bb985e | 2021-09-02 14:31:40 -0700 | [diff] [blame] | 287 | sdbusplus = dependency('sdbusplus', required : false, include_type: 'system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 288 | if not sdbusplus.found() |
| 289 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 290 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 291 | sdbusplus = sdbusplus.as_system('system') |
| 292 | endif |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 293 | bmcweb_dependencies += sdbusplus |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 294 | |
| 295 | if get_option('rest').enabled() |
Patrick Williams | 565c091 | 2021-10-12 20:22:45 -0500 | [diff] [blame] | 296 | tinyxml = dependency('tinyxml2', |
| 297 | default_options: ['tests=false'], |
| 298 | include_type: 'system', |
| 299 | ) |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 300 | bmcweb_dependencies += tinyxml |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 301 | endif |
| 302 | |
| 303 | systemd = dependency('systemd') |
| 304 | zlib = dependency('zlib') |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 305 | bmcweb_dependencies += [systemd, zlib] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 306 | |
| 307 | if cxx.has_header('nlohmann/json.hpp') |
| 308 | nlohmann_json = declare_dependency() |
| 309 | else |
Josh Lehan | 259df35 | 2021-10-07 15:20:02 -0700 | [diff] [blame] | 310 | nlohmann_json_proj = subproject('nlohmann', required: true) |
| 311 | nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep') |
Ed Tanous | b00dcc2 | 2021-02-23 12:52:50 -0800 | [diff] [blame] | 312 | nlohmann_json = nlohmann_json.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 313 | endif |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 314 | bmcweb_dependencies += nlohmann_json |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 315 | |
Ed Tanous | 9c7b76c | 2021-10-25 12:06:39 -0700 | [diff] [blame] | 316 | boost = dependency('boost',version : '>=1.77.0', required : false, include_type: 'system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 317 | if not boost.found() |
| 318 | subproject('boost', required: false) |
Ed Tanous | 9c7b76c | 2021-10-25 12:06:39 -0700 | [diff] [blame] | 319 | boost_inc = include_directories('subprojects/boost_1_77_0/', is_system:true) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 320 | boost = declare_dependency(include_directories : boost_inc) |
Ed Tanous | b00dcc2 | 2021-02-23 12:52:50 -0800 | [diff] [blame] | 321 | boost = boost.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 322 | endif |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 323 | bmcweb_dependencies += boost |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 324 | |
| 325 | if cxx.has_header('boost/url/url_view.hpp') |
| 326 | boost_url = declare_dependency() |
| 327 | else |
| 328 | subproject('boost-url', required: false) |
| 329 | boost_url_inc = include_directories('subprojects/boost-url/include', is_system:true) |
| 330 | boost_url= declare_dependency(include_directories : boost_url_inc) |
Ed Tanous | b00dcc2 | 2021-02-23 12:52:50 -0800 | [diff] [blame] | 331 | boost_url = boost_url.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 332 | endif |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 333 | bmcweb_dependencies += boost_url |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 334 | |
| 335 | if get_option('tests').enabled() |
| 336 | gtest = dependency('gtest', main: true,disabler: true, required : false) |
| 337 | gmock = dependency('gmock', required : false) |
| 338 | if not gtest.found() and get_option('tests').enabled() |
| 339 | gtest_proj = subproject('gtest', required: true) |
| 340 | gtest = gtest_proj.get_variable('gtest_main_dep') |
| 341 | gmock = gtest_proj.get_variable('gmock_dep') |
| 342 | endif |
Ed Tanous | b00dcc2 | 2021-02-23 12:52:50 -0800 | [diff] [blame] | 343 | gtest = gtest.as_system('system') |
| 344 | gmock = gmock.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 345 | endif |
| 346 | |
| 347 | # Source files |
| 348 | |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 349 | srcfiles_bmcweb = [ |
| 350 | 'src/webserver_main.cpp', |
| 351 | 'redfish-core/src/error_messages.cpp', |
Ed Tanous | d32c4fa | 2021-09-14 13:16:51 -0700 | [diff] [blame] | 352 | 'redfish-core/src/utils/json_utils.cpp', |
Ed Tanous | 2107fe1 | 2021-10-09 16:10:52 -0700 | [diff] [blame] | 353 | 'src/boost_url.cpp', |
| 354 | 'src/boost_beast.cpp', |
| 355 | 'src/boost_asio.cpp', |
| 356 | 'src/boost_asio_ssl.cpp', |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 357 | ] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 358 | |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 359 | srcfiles_unittest = [ |
| 360 | 'include/ut/dbus_utility_test.cpp', |
| 361 | 'include/ut/http_utility_test.cpp', |
Ed Tanous | a8544a5 | 2021-09-29 14:31:13 -0700 | [diff] [blame] | 362 | 'include/ut/human_sort_test.cpp', |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 363 | 'redfish-core/ut/privileges_test.cpp', |
| 364 | 'redfish-core/ut/lock_test.cpp', |
| 365 | 'redfish-core/ut/configfile_test.cpp', |
| 366 | 'redfish-core/ut/time_utils_test.cpp', |
George Liu | 287ece6 | 2021-09-30 20:24:46 +0800 | [diff] [blame] | 367 | 'redfish-core/ut/stl_utils_test.cpp', |
Ed Tanous | f201ffb | 2021-10-09 14:49:28 -0700 | [diff] [blame] | 368 | 'redfish-core/ut/hex_utils_test.cpp', |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 369 | 'http/ut/utility_test.cpp' |
| 370 | ] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 371 | |
| 372 | # Gather the Configuration data |
| 373 | |
| 374 | conf_data = configuration_data() |
Ed Tanous | 0260d9d | 2021-02-07 19:31:07 +0000 | [diff] [blame] | 375 | conf_data.set('BMCWEB_HTTP_REQ_BODY_LIMIT_MB', get_option('http-body-limit')) |
| 376 | xss_enabled = get_option('insecure-disable-xss') |
Ed Tanous | feaf150 | 2021-02-23 08:53:50 -0800 | [diff] [blame] | 377 | conf_data.set10('BMCWEB_INSECURE_DISABLE_XSS_PREVENTION', xss_enabled.enabled()) |
Ed Tanous | 0260d9d | 2021-02-07 19:31:07 +0000 | [diff] [blame] | 378 | conf_data.set('MESON_INSTALL_PREFIX', get_option('prefix')) |
Vivekanand Veeracholan | 54d1355 | 2021-06-14 19:16:36 -0700 | [diff] [blame] | 379 | conf_data.set('HTTPS_PORT', get_option('https_port')) |
Ed Tanous | 7531298 | 2021-02-11 14:26:02 -0800 | [diff] [blame] | 380 | configure_file(input: 'bmcweb_config.h.in', |
| 381 | output: 'bmcweb_config.h', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 382 | configuration: conf_data) |
| 383 | |
| 384 | # Configure and install systemd unit files |
| 385 | |
Patrick Williams | 6a77993 | 2021-10-12 20:08:44 -0500 | [diff] [blame] | 386 | systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 387 | |
| 388 | bindir = get_option('prefix') + '/' +get_option('bindir') |
| 389 | |
| 390 | summary({ |
| 391 | 'prefix' : get_option('prefix'), |
| 392 | 'bindir' : bindir, |
| 393 | 'systemd unit directory' : systemd_system_unit_dir |
| 394 | }, section : 'Directories') |
| 395 | |
Vivekanand Veeracholan | 54d1355 | 2021-06-14 19:16:36 -0700 | [diff] [blame] | 396 | configure_file(input : 'bmcweb.socket.in', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 397 | output : 'bmcweb.socket', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 398 | install_dir: systemd_system_unit_dir, |
Vivekanand Veeracholan | 54d1355 | 2021-06-14 19:16:36 -0700 | [diff] [blame] | 399 | configuration: conf_data, |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 400 | install : true) |
| 401 | |
| 402 | configure_file(input : 'bmcweb.service.in', |
| 403 | output : 'bmcweb.service', |
| 404 | install_dir: systemd_system_unit_dir, |
| 405 | configuration: conf_data, |
| 406 | install : true) |
| 407 | |
| 408 | # Copy pam-webserver to etc/pam.d |
| 409 | configure_file(input : 'pam-webserver', |
| 410 | output : 'webserver', |
| 411 | copy : true, |
| 412 | install_dir: '/etc/pam.d', |
| 413 | install : true) |
| 414 | |
| 415 | install_subdir('static', install_dir : 'share/www', strip_directory : true) |
| 416 | |
| 417 | # Generate the bmcweb executable and the test binary |
| 418 | |
| 419 | executable('bmcweb',srcfiles_bmcweb, |
| 420 | include_directories : incdir, |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 421 | dependencies: bmcweb_dependencies, |
Ed Tanous | 5e34b67 | 2021-02-05 14:21:27 -0800 | [diff] [blame] | 422 | link_args: '-Wl,--gc-sections', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 423 | install: true, |
| 424 | install_dir:bindir) |
| 425 | |
| 426 | if(get_option('tests').enabled()) |
| 427 | foreach src_test : srcfiles_unittest |
| 428 | testname = src_test.split('/')[-1].split('.')[0] |
Patrick Williams | 6a77993 | 2021-10-12 20:08:44 -0500 | [diff] [blame] | 429 | test(testname,executable(testname, |
Ed Tanous | d32c4fa | 2021-09-14 13:16:51 -0700 | [diff] [blame] | 430 | [src_test, |
Ed Tanous | 2107fe1 | 2021-10-09 16:10:52 -0700 | [diff] [blame] | 431 | 'src/boost_url.cpp', |
| 432 | 'src/boost_beast.cpp', |
| 433 | 'src/boost_asio.cpp', |
| 434 | 'src/boost_asio_ssl.cpp',], |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 435 | include_directories : incdir, |
| 436 | install_dir: bindir, |
| 437 | dependencies: [ |
Ed Tanous | cf2f932 | 2021-09-22 15:34:41 -0700 | [diff] [blame] | 438 | boost, |
| 439 | boost_url, |
| 440 | gtest, |
| 441 | openssl, |
| 442 | gmock, |
| 443 | nlohmann_json, |
| 444 | sdbusplus, |
| 445 | pam |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 446 | ])) |
| 447 | endforeach |
| 448 | endif |