1af6298daSManojkiran Edaproject('bmcweb', 'cpp', 2af6298daSManojkiran Eda version : '1.0', 3af6298daSManojkiran Eda meson_version: '>=0.53.2', 4af6298daSManojkiran Eda default_options: [ 5af6298daSManojkiran Eda 'werror=true', 6af6298daSManojkiran Eda 'warning_level=3', 7af6298daSManojkiran Eda 'cpp_std=c++17', 8af6298daSManojkiran Eda 'buildtype=debugoptimized', 9af6298daSManojkiran Eda 'b_ndebug=if-release', 10af6298daSManojkiran Eda 'b_lto=true', 11cb2ed190SManojkiran Eda 'cpp_rtti=false', 12cb2ed190SManojkiran Eda 'b_lto_mode=default', 13cb2ed190SManojkiran Eda 'b_lto_threads=0' 14af6298daSManojkiran Eda ]) 15af6298daSManojkiran Eda 16af6298daSManojkiran Eda# Project related links 17af6298daSManojkiran Eda 18af6298daSManojkiran Edaproject_pretty_name = 'bmcweb' 19af6298daSManojkiran Edaproject_url = 'https://github.com/openbmc/' + project_pretty_name 20af6298daSManojkiran Edaproject_issues_url = project_url + '/issues/new' 21af6298daSManojkiran Edasummary('Issues',project_issues_url, section: 'Report Issues') 22af6298daSManojkiran Eda 23af6298daSManojkiran Eda# Validate the c++ Standard 24af6298daSManojkiran Eda 25af6298daSManojkiran Edaif get_option('cpp_std') != 'c++17' 26af6298daSManojkiran Eda error('This project requires c++17 support') 27af6298daSManojkiran Edaendif 28af6298daSManojkiran Eda 29af6298daSManojkiran Eda# Get compiler and default build type 30af6298daSManojkiran Eda 31af6298daSManojkiran Edacxx = meson.get_compiler('cpp') 32af6298daSManojkiran Edabuild = get_option('buildtype') 33af6298daSManojkiran Edaoptimization = get_option('optimization') 34af6298daSManojkiran Edasummary('Build Type',build, section : 'Build Info') 35af6298daSManojkiran Edasummary('Optimization',optimization, section : 'Build Info') 36af6298daSManojkiran Eda 375e34b67aSEd Tanous 38af6298daSManojkiran Eda# remove debug information for minsize buildtype 39af6298daSManojkiran Edaif(get_option('buildtype') == 'minsize') 405e34b67aSEd Tanous add_project_arguments(['-fdata-sections', '-ffunction-sections'], language : 'cpp') 41af6298daSManojkiran Eda add_project_arguments('-DNDEBUG', language : 'cpp') 42af6298daSManojkiran Edaendif 43af6298daSManojkiran Eda 44af6298daSManojkiran Eda# Disable lto when compiling with no optimization 45af6298daSManojkiran Edaif(get_option('optimization') == '0') 46af6298daSManojkiran Eda add_project_arguments('-fno-lto', language: 'cpp') 47af6298daSManojkiran Eda message('Disabling lto & its supported features as optimization is disabled') 48af6298daSManojkiran Edaendif 49af6298daSManojkiran Eda 50af6298daSManojkiran Eda# Include Directories 51af6298daSManojkiran Eda 52cf2f932eSEd Tanousincdir = include_directories( 53cf2f932eSEd Tanous 'include', 54cf2f932eSEd Tanous 'redfish-core/include', 55cf2f932eSEd Tanous 'redfish-core/lib', 56cf2f932eSEd Tanous 'http' 57cf2f932eSEd Tanous) 58af6298daSManojkiran Eda 59af6298daSManojkiran Eda# Get the options and enable the respective features 60af6298daSManojkiran Eda## create a MAP of "options : feature_flag" 61af6298daSManojkiran Eda 62af6298daSManojkiran Edafeature_map = { 63af6298daSManojkiran Eda 'insecure-disable-auth' : '-DBMCWEB_INSECURE_DISABLE_AUTHENTICATION', 64af6298daSManojkiran Eda 'insecure-disable-csrf' : '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION', 65af6298daSManojkiran Eda 'insecure-disable-ssl' : '-DBMCWEB_INSECURE_DISABLE_SSL', 66af6298daSManojkiran Eda 'host-serial-socket' : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET', 67af6298daSManojkiran Eda 'ibm-management-console' : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE', 68735ef6d8SFeras Aldahlawi 'google-api' : '-DBMCWEB_ENABLE_GOOGLE_API', 69af6298daSManojkiran Eda 'kvm' : '-DBMCWEB_ENABLE_KVM' , 70f16f6263SAlan Kuo 'basic-auth' : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION', 71f16f6263SAlan Kuo 'session-auth' : '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION', 72f16f6263SAlan Kuo 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION', 73f16f6263SAlan Kuo 'cookie-auth' : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION', 74af6298daSManojkiran Eda 'mutual-tls-auth' : '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION', 75af6298daSManojkiran Eda 'pam' : '-DWEBSERVER_ENABLE_PAM', 76af6298daSManojkiran Eda 'insecure-push-style-notification': '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', 77af6298daSManojkiran Eda 'redfish' : '-DBMCWEB_ENABLE_REDFISH', 78af6298daSManojkiran Eda 'redfish-bmc-journal' : '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL', 79af6298daSManojkiran Eda 'redfish-cpu-log' : '-DBMCWEB_ENABLE_REDFISH_CPU_LOG', 80af6298daSManojkiran Eda 'redfish-dbus-log' : '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES', 81af6298daSManojkiran Eda 'redfish-provisioning-feature' : '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE', 823fad0d59SRavi Teja 'redfish-dump-log' : '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG', 83af6298daSManojkiran Eda 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', 84af6298daSManojkiran Eda 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', 85af6298daSManojkiran Eda 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', 86efb8062cSEd Tanous #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', 87af6298daSManojkiran Eda 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', 88af6298daSManojkiran Eda} 89af6298daSManojkiran Eda 90af6298daSManojkiran Eda# Get the options status and build a project summary to show which flags are 91af6298daSManojkiran Eda# being enabled during the configuration time. 92af6298daSManojkiran Eda 93af6298daSManojkiran Edaforeach option_key,option_value : feature_map 94af6298daSManojkiran Eda if(get_option(option_key).enabled()) 95af6298daSManojkiran Eda if(option_key == 'mutual-tls-auth' or option_key == 'insecure-disable-ssl') 96af6298daSManojkiran Eda if(get_option('insecure-disable-ssl').disabled() or get_option('mutual-tls-auth').disabled()) 97af6298daSManojkiran Eda add_project_arguments(option_value,language:'cpp') 98af6298daSManojkiran Eda summary(option_key,option_value, section : 'Enabled Features') 99af6298daSManojkiran Eda endif 100af6298daSManojkiran Eda else 101af6298daSManojkiran Eda summary(option_key,option_value, section : 'Enabled Features') 102af6298daSManojkiran Eda add_project_arguments(option_value,language:'cpp') 103af6298daSManojkiran Eda endif 104af6298daSManojkiran Eda else 105af6298daSManojkiran Eda if(option_key == 'insecure-disable-ssl') 106af6298daSManojkiran Eda summary('ssl','-DBMCWEB_ENABLE_SSL', section : 'Enabled Features') 107af6298daSManojkiran Eda add_project_arguments('-DBMCWEB_ENABLE_SSL', language : 'cpp') 108af6298daSManojkiran Eda endif 109af6298daSManojkiran Eda endif 110af6298daSManojkiran Edaendforeach 111af6298daSManojkiran Eda 112af6298daSManojkiran Edaif(get_option('tests').enabled()) 113af6298daSManojkiran Eda summary('unittest','NA', section : 'Enabled Features') 114af6298daSManojkiran Edaendif 115af6298daSManojkiran Eda 116af6298daSManojkiran Eda# Add compiler arguments 117af6298daSManojkiran Eda 118af6298daSManojkiran Eda# -Wpedantic, -Wextra comes by default with warning level 119af6298daSManojkiran Edaadd_project_arguments( 120af6298daSManojkiran Eda cxx.get_supported_arguments([ 121af6298daSManojkiran Eda '-Wold-style-cast', 122af6298daSManojkiran Eda '-Wcast-align', 123af6298daSManojkiran Eda '-Wunused', 124af6298daSManojkiran Eda '-Woverloaded-virtual', 125af6298daSManojkiran Eda '-Wconversion', 126af6298daSManojkiran Eda '-Wsign-conversion', 127af6298daSManojkiran Eda '-Wno-attributes', 128af6298daSManojkiran Eda ]), 129af6298daSManojkiran Eda language: 'cpp' 130af6298daSManojkiran Eda) 131af6298daSManojkiran Eda 132af6298daSManojkiran Edaif (cxx.get_id() == 'clang' and cxx.version().version_compare('>9.0')) 133af6298daSManojkiran Edaadd_project_arguments( 134af6298daSManojkiran Eda cxx.get_supported_arguments([ 135af6298daSManojkiran Eda '-Weverything', 136af6298daSManojkiran Eda '-Wno-c++98-compat', 137af6298daSManojkiran Eda '-Wno-c++98-compat-pedantic', 138af6298daSManojkiran Eda '-Wno-global-constructors', 139af6298daSManojkiran Eda '-Wno-exit-time-destructors', 140af6298daSManojkiran Eda '-Wno-shadow', 141af6298daSManojkiran Eda '-Wno-used-but-marked-unused', 142af6298daSManojkiran Eda '-Wno-documentation-unknown-command', 143af6298daSManojkiran Eda '-Wno-weak-vtables', 144af6298daSManojkiran Eda '-Wno-documentation', 145af6298daSManojkiran Eda '-Wno-padded', 146af6298daSManojkiran Eda '-Wunused-parameter', 147af6298daSManojkiran Eda '-Wcovered-switch-default', 148af6298daSManojkiran Eda '-Wcomma', 149af6298daSManojkiran Eda '-Wextra-semi', 150af6298daSManojkiran Eda '-Wzero-as-null-pointer-constant', 151af6298daSManojkiran Eda '-Wswitch-enum', 152af6298daSManojkiran Eda '-Wnull-dereference', 153af6298daSManojkiran Eda '-Wdouble-promotion', 154d32c4fa9SEd Tanous '-Wno-newline-eof', 155af6298daSManojkiran Eda '-Wformat=2', 156af6298daSManojkiran Eda ]), 157af6298daSManojkiran Eda language:'cpp') 158af6298daSManojkiran Edaendif 159af6298daSManojkiran Eda 160af6298daSManojkiran Eda# if compiler is gnu-gcc , and version is > 8.0 then we add few more 161af6298daSManojkiran Eda# compiler arguments , we know that will pass 162af6298daSManojkiran Eda 163af6298daSManojkiran Edaif (cxx.get_id() == 'gcc' and cxx.version().version_compare('>8.0')) 164af6298daSManojkiran Eda 165af6298daSManojkiran Eda ## remove once bmcweb/issues/147 is fixed 166af6298daSManojkiran Eda add_global_link_arguments('-Wno-stringop-overflow',language:['c','cpp']) 167af6298daSManojkiran Eda add_project_arguments('-Wno-stringop-overflow',language:['c','cpp']) 168af6298daSManojkiran Eda 169af6298daSManojkiran Eda add_project_arguments( 170af6298daSManojkiran Eda cxx.get_supported_arguments([ 171af6298daSManojkiran Eda '-Wduplicated-cond', 172af6298daSManojkiran Eda '-Wduplicated-branches', 173af6298daSManojkiran Eda '-Wlogical-op', 174af6298daSManojkiran Eda '-Wunused-parameter', 175af6298daSManojkiran Eda '-Wnull-dereference', 176af6298daSManojkiran Eda '-Wdouble-promotion', 177af6298daSManojkiran Eda '-Wformat=2', 178af6298daSManojkiran Eda ]), 179af6298daSManojkiran Eda language:'cpp') 180c66403c3SEd Tanousendif 181af6298daSManojkiran Eda 182af6298daSManojkiran Edaif (get_option('buildtype') != 'plain') 183af6298daSManojkiran Eda if (get_option('b_lto') == true and get_option('optimization')!='0') 184af6298daSManojkiran Eda # Reduce the binary size by removing unnecessary 185af6298daSManojkiran Eda # dynamic symbol table entries 186af6298daSManojkiran Eda 187af6298daSManojkiran Eda add_project_arguments( 188af6298daSManojkiran Eda cxx.get_supported_arguments([ 189af6298daSManojkiran Eda '-fno-fat-lto-objects', 190af6298daSManojkiran Eda '-fvisibility=hidden', 191af6298daSManojkiran Eda '-fvisibility-inlines-hidden' 192af6298daSManojkiran Eda ]), 193af6298daSManojkiran Eda language: 'cpp') 194af6298daSManojkiran Eda 195af6298daSManojkiran Eda if cxx.has_link_argument('-Wl,--exclude-libs,ALL') 196af6298daSManojkiran Eda add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp') 197af6298daSManojkiran Eda endif 198af6298daSManojkiran Eda endif 199c66403c3SEd Tanousendif 200af6298daSManojkiran Eda 201620a6e14SManojkiran Edaif( get_option('bmcweb-logging').enabled() or \ 202af6298daSManojkiran Eda get_option('buildtype').startswith('debug')) 203af6298daSManojkiran Eda add_project_arguments([ 204af6298daSManojkiran Eda '-DBMCWEB_ENABLE_LOGGING', 205af6298daSManojkiran Eda '-DBMCWEB_ENABLE_DEBUG' 206af6298daSManojkiran Eda ], 207af6298daSManojkiran Eda language : 'cpp') 208af6298daSManojkiran Eda 209af6298daSManojkiran Eda summary({'debug' :'-DBMCWEB_ENABLE_DEBUG', 210af6298daSManojkiran Eda 'logging' : '-DBMCWEB_ENABLE_LOGGING', 211af6298daSManojkiran Eda },section : 'Enabled Features') 212af6298daSManojkiran Edaendif 213af6298daSManojkiran Eda 2140256b694Szhanghch05if( get_option('redfish-allow-deprecated-power-thermal').enabled()) 2150256b694Szhanghch05 add_project_arguments([ 2160256b694Szhanghch05 '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL' 2170256b694Szhanghch05 ], 2180256b694Szhanghch05 language : 'cpp') 2190256b694Szhanghch05 2200256b694Szhanghch05 summary({'power-thermal' :'-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL' 2210256b694Szhanghch05 },section : 'Enabled Features') 2220256b694Szhanghch05endif 223e8204933SGeorge Liu 224e8204933SGeorge Liuif( get_option('redfish-new-powersubsystem-thermalsubsystem').enabled()) 225e8204933SGeorge Liu add_project_arguments([ 226e8204933SGeorge Liu '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM' 227e8204933SGeorge Liu ], 228e8204933SGeorge Liu language : 'cpp') 229e8204933SGeorge Liu 230e8204933SGeorge Liu summary({'new-powersubsystem-thermalsubsystem' :'-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM' 231e8204933SGeorge Liu },section : 'Enabled Features') 232e8204933SGeorge Liuendif 233af6298daSManojkiran Eda 234af6298daSManojkiran Eda# Set Compiler Security flags 235af6298daSManojkiran Eda 236af6298daSManojkiran Edasecurity_flags = [ 237af6298daSManojkiran Eda '-fstack-protector-strong', 238af6298daSManojkiran Eda '-fPIE', 239af6298daSManojkiran Eda '-fPIC', 240af6298daSManojkiran Eda '-D_FORTIFY_SOURCE=2', 241af6298daSManojkiran Eda '-Wformat', 242af6298daSManojkiran Eda '-Wformat-security' 243af6298daSManojkiran Eda] 244af6298daSManojkiran Eda 245af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize' 246af6298daSManojkiran Eda 247af6298daSManojkiran Edaif not (get_option('buildtype') == 'plain' or get_option('buildtype').startswith('debug')) 248af6298daSManojkiran Eda add_project_arguments( 249af6298daSManojkiran Eda cxx.get_supported_arguments([ 250af6298daSManojkiran Eda security_flags 251af6298daSManojkiran Eda ]), 252af6298daSManojkiran Eda language: 'cpp') 253af6298daSManojkiran Edaendif 254af6298daSManojkiran Eda 255af6298daSManojkiran Eda# Boost dependency configuration 256af6298daSManojkiran Eda 257af6298daSManojkiran Edaadd_project_arguments( 258af6298daSManojkiran Edacxx.get_supported_arguments([ 259af6298daSManojkiran Eda '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT', 260af6298daSManojkiran Eda '-DBOOST_ASIO_DISABLE_THREADS', 261af6298daSManojkiran Eda '-DBOOST_BEAST_USE_STD_STRING_VIEW', 262af6298daSManojkiran Eda '-DBOOST_ERROR_CODE_HEADER_ONLY', 263af6298daSManojkiran Eda '-DBOOST_SYSTEM_NO_DEPRECATED', 264af6298daSManojkiran Eda '-DBOOST_ASIO_NO_DEPRECATED', 265af6298daSManojkiran Eda '-DBOOST_ALL_NO_LIB', 266af6298daSManojkiran Eda '-DBOOST_NO_RTTI', 267af6298daSManojkiran Eda '-DBOOST_NO_TYPEID', 268af6298daSManojkiran Eda '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING', 269af6298daSManojkiran Eda '-DBOOST_URL_STANDALONE', 27019a8815aSEd Tanous '-DBOOST_URL_HEADER_ONLY', 27158e42b18SEd Tanous '-DBOOST_ALLOW_DEPRECATED_HEADERS', 27258e42b18SEd Tanous '-DJSON_NOEXCEPTION' 273af6298daSManojkiran Eda]), 274af6298daSManojkiran Edalanguage : 'cpp') 275af6298daSManojkiran Eda 276af6298daSManojkiran Eda# Find the dependency modules, if not found use meson wrap to get them 277af6298daSManojkiran Eda# automatically during the configure step 278ceb8ddc1SJason M. Billsbmcweb_dependencies = [] 279af6298daSManojkiran Eda 280af6298daSManojkiran Edapam = cxx.find_library('pam', required: get_option('pam')) 281af6298daSManojkiran Edaatomic = cxx.find_library('atomic', required: true) 282af6298daSManojkiran Edaopenssl = dependency('openssl', required : true) 283ceb8ddc1SJason M. Billsbmcweb_dependencies += [pam, atomic, openssl] 284af6298daSManojkiran Eda 2857bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required : false, include_type: 'system') 286af6298daSManojkiran Edaif not sdbusplus.found() 287af6298daSManojkiran Eda sdbusplus_proj = subproject('sdbusplus', required: true) 288af6298daSManojkiran Eda sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 289af6298daSManojkiran Eda sdbusplus = sdbusplus.as_system('system') 290af6298daSManojkiran Edaendif 291ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus 292af6298daSManojkiran Eda 293af6298daSManojkiran Edaif get_option('rest').enabled() 294*565c0911SPatrick Williams tinyxml = dependency('tinyxml2', 295*565c0911SPatrick Williams default_options: ['tests=false'], 296*565c0911SPatrick Williams include_type: 'system', 297*565c0911SPatrick Williams ) 298ceb8ddc1SJason M. Bills bmcweb_dependencies += tinyxml 299af6298daSManojkiran Edaendif 300af6298daSManojkiran Eda 301af6298daSManojkiran Edasystemd = dependency('systemd') 302af6298daSManojkiran Edazlib = dependency('zlib') 303ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib] 304af6298daSManojkiran Eda 305af6298daSManojkiran Edaif cxx.has_header('nlohmann/json.hpp') 306af6298daSManojkiran Eda nlohmann_json = declare_dependency() 307af6298daSManojkiran Edaelse 308259df359SJosh Lehan nlohmann_json_proj = subproject('nlohmann', required: true) 309259df359SJosh Lehan nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep') 310b00dcc27SEd Tanous nlohmann_json = nlohmann_json.as_system('system') 311af6298daSManojkiran Edaendif 312ceb8ddc1SJason M. Billsbmcweb_dependencies += nlohmann_json 313af6298daSManojkiran Eda 3147bb985eeSEd Tanousboost = dependency('boost',version : '>=1.75.0', required : false, include_type: 'system') 315af6298daSManojkiran Edaif not boost.found() 316af6298daSManojkiran Eda subproject('boost', required: false) 31765f73659SEd Tanous boost_inc = include_directories('subprojects/boost_1_75_0/', is_system:true) 318af6298daSManojkiran Eda boost = declare_dependency(include_directories : boost_inc) 319b00dcc27SEd Tanous boost = boost.as_system('system') 320af6298daSManojkiran Edaendif 321ceb8ddc1SJason M. Billsbmcweb_dependencies += boost 322af6298daSManojkiran Eda 323af6298daSManojkiran Edaif cxx.has_header('boost/url/url_view.hpp') 324af6298daSManojkiran Eda boost_url = declare_dependency() 325af6298daSManojkiran Edaelse 326af6298daSManojkiran Eda subproject('boost-url', required: false) 327af6298daSManojkiran Eda boost_url_inc = include_directories('subprojects/boost-url/include', is_system:true) 328af6298daSManojkiran Eda boost_url= declare_dependency(include_directories : boost_url_inc) 329b00dcc27SEd Tanous boost_url = boost_url.as_system('system') 330af6298daSManojkiran Edaendif 331ceb8ddc1SJason M. Billsbmcweb_dependencies += boost_url 332af6298daSManojkiran Eda 333af6298daSManojkiran Edaif get_option('tests').enabled() 334af6298daSManojkiran Eda gtest = dependency('gtest', main: true,disabler: true, required : false) 335af6298daSManojkiran Eda gmock = dependency('gmock', required : false) 336af6298daSManojkiran Eda if not gtest.found() and get_option('tests').enabled() 337af6298daSManojkiran Eda gtest_proj = subproject('gtest', required: true) 338af6298daSManojkiran Eda gtest = gtest_proj.get_variable('gtest_main_dep') 339af6298daSManojkiran Eda gmock = gtest_proj.get_variable('gmock_dep') 340af6298daSManojkiran Eda endif 341b00dcc27SEd Tanous gtest = gtest.as_system('system') 342b00dcc27SEd Tanous gmock = gmock.as_system('system') 343af6298daSManojkiran Edaendif 344af6298daSManojkiran Eda 345af6298daSManojkiran Eda# Source files 346af6298daSManojkiran Eda 347cf2f932eSEd Tanoussrcfiles_bmcweb = [ 348cf2f932eSEd Tanous 'src/webserver_main.cpp', 349cf2f932eSEd Tanous 'redfish-core/src/error_messages.cpp', 350d32c4fa9SEd Tanous 'redfish-core/src/utils/json_utils.cpp', 351d32c4fa9SEd Tanous 'src/boost_url.cpp' 352cf2f932eSEd Tanous] 353af6298daSManojkiran Eda 354cf2f932eSEd Tanoussrcfiles_unittest = [ 355cf2f932eSEd Tanous 'include/ut/dbus_utility_test.cpp', 356647b3cdcSGeorge Liu 'include/ut/http_utility_test.cpp', 357a8544a5bSEd Tanous 'include/ut/human_sort_test.cpp', 35817a897dfSManojkiran Eda 'redfish-core/ut/privileges_test.cpp', 359af6298daSManojkiran Eda 'redfish-core/ut/lock_test.cpp', 3607c0bbe7dSSunitha Harish 'redfish-core/ut/configfile_test.cpp', 3614dbb8aeaSWludzik, Jozef 'redfish-core/ut/time_utils_test.cpp', 362cf2f932eSEd Tanous 'http/ut/utility_test.cpp' 363cf2f932eSEd Tanous] 364af6298daSManojkiran Eda 365af6298daSManojkiran Eda# Gather the Configuration data 366af6298daSManojkiran Eda 367af6298daSManojkiran Edaconf_data = configuration_data() 368af6298daSManojkiran Edaconf_data.set('BMCWEB_HTTP_REQ_BODY_LIMIT_MB', get_option('http-body-limit')) 3690260d9d6SEd Tanousxss_enabled = get_option('insecure-disable-xss') 370feaf1500SEd Tanousconf_data.set10('BMCWEB_INSECURE_DISABLE_XSS_PREVENTION', xss_enabled.enabled()) 371af6298daSManojkiran Edaconf_data.set('MESON_INSTALL_PREFIX', get_option('prefix')) 37254d1355fSVivekanand Veeracholanconf_data.set('HTTPS_PORT', get_option('https_port')) 37375312981SEd Tanousconfigure_file(input: 'bmcweb_config.h.in', 37475312981SEd Tanous output: 'bmcweb_config.h', 375af6298daSManojkiran Eda configuration: conf_data) 376af6298daSManojkiran Eda 377af6298daSManojkiran Eda# Configure and install systemd unit files 378af6298daSManojkiran Eda 3796a779931SPatrick Williamssystemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') 380af6298daSManojkiran Eda 381af6298daSManojkiran Edabindir = get_option('prefix') + '/' +get_option('bindir') 382af6298daSManojkiran Eda 383af6298daSManojkiran Edasummary({ 384af6298daSManojkiran Eda 'prefix' : get_option('prefix'), 385af6298daSManojkiran Eda 'bindir' : bindir, 386af6298daSManojkiran Eda 'systemd unit directory' : systemd_system_unit_dir 387af6298daSManojkiran Eda }, section : 'Directories') 388af6298daSManojkiran Eda 38954d1355fSVivekanand Veeracholanconfigure_file(input : 'bmcweb.socket.in', 390af6298daSManojkiran Eda output : 'bmcweb.socket', 391af6298daSManojkiran Eda install_dir: systemd_system_unit_dir, 39254d1355fSVivekanand Veeracholan configuration: conf_data, 393af6298daSManojkiran Eda install : true) 394af6298daSManojkiran Eda 395af6298daSManojkiran Edaconfigure_file(input : 'bmcweb.service.in', 396af6298daSManojkiran Eda output : 'bmcweb.service', 397af6298daSManojkiran Eda install_dir: systemd_system_unit_dir, 398af6298daSManojkiran Eda configuration: conf_data, 399af6298daSManojkiran Eda install : true) 400af6298daSManojkiran Eda 401af6298daSManojkiran Eda# Copy pam-webserver to etc/pam.d 402af6298daSManojkiran Edaconfigure_file(input : 'pam-webserver', 403af6298daSManojkiran Eda output : 'webserver', 404af6298daSManojkiran Eda copy : true, 405af6298daSManojkiran Eda install_dir: '/etc/pam.d', 406af6298daSManojkiran Eda install : true) 407af6298daSManojkiran Eda 408af6298daSManojkiran Edainstall_subdir('static', install_dir : 'share/www', strip_directory : true) 409af6298daSManojkiran Eda 410af6298daSManojkiran Eda# Generate the bmcweb executable and the test binary 411af6298daSManojkiran Eda 412af6298daSManojkiran Edaexecutable('bmcweb',srcfiles_bmcweb, 413af6298daSManojkiran Eda include_directories : incdir, 414ceb8ddc1SJason M. Bills dependencies: bmcweb_dependencies, 4155e34b67aSEd Tanous link_args: '-Wl,--gc-sections', 416af6298daSManojkiran Eda install: true, 417af6298daSManojkiran Eda install_dir:bindir) 418af6298daSManojkiran Eda 419af6298daSManojkiran Edaif(get_option('tests').enabled()) 420af6298daSManojkiran Eda foreach src_test : srcfiles_unittest 421af6298daSManojkiran Eda testname = src_test.split('/')[-1].split('.')[0] 422d32c4fa9SEd Tanous test(testname,executable(testname, 423d32c4fa9SEd Tanous [src_test, 424d32c4fa9SEd Tanous 'src/boost_url.cpp'], 425af6298daSManojkiran Eda include_directories : incdir, 426af6298daSManojkiran Eda install_dir: bindir, 427af6298daSManojkiran Eda dependencies: [ 428cf2f932eSEd Tanous boost, 429cf2f932eSEd Tanous boost_url, 430cf2f932eSEd Tanous gtest, 431cf2f932eSEd Tanous openssl, 432cf2f932eSEd Tanous gmock, 433cf2f932eSEd Tanous nlohmann_json, 434cf2f932eSEd Tanous sdbusplus, 435cf2f932eSEd Tanous pam 436af6298daSManojkiran Eda ])) 437af6298daSManojkiran Eda endforeach 438af6298daSManojkiran Edaendif 439