1f2caadceSEd Tanousproject( 2f2caadceSEd Tanous 'bmcweb', 3f2caadceSEd Tanous 'cpp', 4af6298daSManojkiran Eda version: '1.0', 56107da1eSEd Tanous meson_version: '>=0.63.0', 6af6298daSManojkiran Eda default_options: [ 7cb2ed190SManojkiran Eda 'b_lto_mode=default', 8f523c324SEd Tanous 'b_lto_threads=0', 9f523c324SEd Tanous 'b_lto=true', 10f523c324SEd Tanous 'b_ndebug=if-release', 11f523c324SEd Tanous 'buildtype=debugoptimized', 12f523c324SEd Tanous 'cpp_rtti=false', 13f523c324SEd Tanous 'cpp_std=c++20', 14f523c324SEd Tanous 'warning_level=3', 15f523c324SEd Tanous 'werror=true', 16f2caadceSEd Tanous ], 17f2caadceSEd Tanous) 18af6298daSManojkiran Eda 19af6298daSManojkiran Eda# Project related links 20af6298daSManojkiran Eda 21af6298daSManojkiran Edaproject_pretty_name = 'bmcweb' 22af6298daSManojkiran Edaproject_url = 'https://github.com/openbmc/' + project_pretty_name 23af6298daSManojkiran Edaproject_issues_url = project_url + '/issues/new' 24af6298daSManojkiran Edasummary('Issues', project_issues_url, section: 'Report Issues') 25af6298daSManojkiran Eda 26af6298daSManojkiran Eda# Validate the c++ Standard 27af6298daSManojkiran Eda 28c52ee72bSPatrick Williamsif get_option('cpp_std') != 'c++20' 29c52ee72bSPatrick Williams error('This project requires c++20 support') 30af6298daSManojkiran Edaendif 31af6298daSManojkiran Eda 32af6298daSManojkiran Eda# Get compiler and default build type 33af6298daSManojkiran Eda 34af6298daSManojkiran Edacxx = meson.get_compiler('cpp') 35af6298daSManojkiran Edabuild = get_option('buildtype') 36af6298daSManojkiran Edaoptimization = get_option('optimization') 37af6298daSManojkiran Edasummary('Build Type', build, section: 'Build Info') 38af6298daSManojkiran Edasummary('Optimization', optimization, section: 'Build Info') 39af6298daSManojkiran Eda 40af6298daSManojkiran Eda# remove debug information for minsize buildtype 41af6298daSManojkiran Edaif (get_option('buildtype') == 'minsize') 425e34b67aSEd Tanous add_project_arguments(['-fdata-sections', '-ffunction-sections'], language: 'cpp') 43af6298daSManojkiran Eda add_project_arguments('-DNDEBUG', language: 'cpp') 44af6298daSManojkiran Edaendif 45af6298daSManojkiran Eda 46f8ca6d79SEd Tanousif (get_option('dns-resolver') == 'systemd-dbus') 47f8ca6d79SEd Tanous add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp') 48f8ca6d79SEd Tanousendif 49f8ca6d79SEd Tanous 50af6298daSManojkiran Eda# Disable lto when compiling with no optimization 51af6298daSManojkiran Edaif (get_option('optimization') == '0') 52af6298daSManojkiran Eda add_project_arguments('-fno-lto', language: 'cpp') 53af6298daSManojkiran Eda message('Disabling lto & its supported features as optimization is disabled') 54af6298daSManojkiran Edaendif 55af6298daSManojkiran Eda 56af6298daSManojkiran Eda# Include Directories 57af6298daSManojkiran Eda 58f2caadceSEd Tanousincdir = include_directories('include', 'redfish-core/include', 'redfish-core/lib', 'http') 59af6298daSManojkiran Eda 60af6298daSManojkiran Eda# Get the options and enable the respective features 61af6298daSManojkiran Eda## create a MAP of "options : feature_flag" 62af6298daSManojkiran Eda 63af6298daSManojkiran Edafeature_map = { 642d74fbc4SManojkiran Eda 'basic-auth': '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION', 652d74fbc4SManojkiran Eda 'cookie-auth': '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION', 662d74fbc4SManojkiran Eda 'google-api': '-DBMCWEB_ENABLE_GOOGLE_API', 672d74fbc4SManojkiran Eda 'host-serial-socket': '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET', 682d74fbc4SManojkiran Eda 'ibm-management-console': '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE', 69a43ea82fSNan Zhou 'insecure-disable-auth': '-DBMCWEB_INSECURE_DISABLE_AUTHX', 70af6298daSManojkiran Eda 'insecure-disable-csrf': '-DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION', 71af6298daSManojkiran Eda 'insecure-disable-ssl': '-DBMCWEB_INSECURE_DISABLE_SSL', 722d74fbc4SManojkiran Eda 'insecure-push-style-notification': '-DBMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', 732d74fbc4SManojkiran Eda 'insecure-tftp-update': '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', 741aa0c2b8SEd Tanous 'insecure-ignore-content-type': '-DBMCWEB_INSECURE_IGNORE_CONTENT_TYPE', 75af6298daSManojkiran Eda 'kvm': '-DBMCWEB_ENABLE_KVM', 76af6298daSManojkiran Eda 'mutual-tls-auth': '-DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION', 777fb33566SCarson Labrado 'redfish-aggregation': '-DBMCWEB_ENABLE_REDFISH_AGGREGATION', 78f523c324SEd Tanous 'redfish-allow-deprecated-power-thermal': '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL', 79af6298daSManojkiran Eda 'redfish-bmc-journal': '-DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL', 80af6298daSManojkiran Eda 'redfish-cpu-log': '-DBMCWEB_ENABLE_REDFISH_CPU_LOG', 81af6298daSManojkiran Eda 'redfish-dbus-log': '-DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES', 823fad0d59SRavi Teja 'redfish-dump-log': '-DBMCWEB_ENABLE_REDFISH_DUMP_LOG', 83f523c324SEd Tanous 'redfish-host-logger': '-DBMCWEB_ENABLE_REDFISH_HOST_LOGGER', 842d74fbc4SManojkiran Eda 'redfish-new-powersubsystem-thermalsubsystem': '-DBMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM', 8554dce7f5SGunnar Mills 'redfish-oem-manager-fan-data': '-DBMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA', 86f523c324SEd Tanous 'redfish-provisioning-feature': '-DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE', 87f523c324SEd Tanous 'redfish': '-DBMCWEB_ENABLE_REDFISH', 88f523c324SEd Tanous 'rest': '-DBMCWEB_ENABLE_DBUS_REST', 892d74fbc4SManojkiran Eda 'session-auth': '-DBMCWEB_ENABLE_SESSION_AUTHENTICATION', 90af6298daSManojkiran Eda 'static-hosting': '-DBMCWEB_ENABLE_STATIC_HOSTING', 917f3e84a1SEd Tanous 'experimental-redfish-multi-computer-system': '-DBMCWEB_ENABLE_MULTI_COMPUTERSYSTEM', 92af6298daSManojkiran Eda 'vm-websocket': '-DBMCWEB_ENABLE_VM_WEBSOCKET', 932d74fbc4SManojkiran Eda 'xtoken-auth': '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION', 94f523c324SEd Tanous #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', 95af6298daSManojkiran Eda} 96af6298daSManojkiran Eda 97af6298daSManojkiran Eda# Get the options status and build a project summary to show which flags are 98af6298daSManojkiran Eda# being enabled during the configuration time. 99af6298daSManojkiran Eda 100af6298daSManojkiran Edaforeach option_key, option_value : feature_map 101549bed29SPatrick Williams if (get_option(option_key).allowed()) 102f2caadceSEd Tanous if ( 103f2caadceSEd Tanous option_key == 'mutual-tls-auth' 104f2caadceSEd Tanous or option_key == 'insecure-disable-ssl' 105f2caadceSEd Tanous ) 106f2caadceSEd Tanous if ( 107f2caadceSEd Tanous get_option('insecure-disable-ssl').disabled() 108f2caadceSEd Tanous or get_option('mutual-tls-auth').disabled() 109f2caadceSEd Tanous ) 110af6298daSManojkiran Eda add_project_arguments(option_value, language: 'cpp') 111af6298daSManojkiran Eda summary(option_key, option_value, section: 'Enabled Features') 112af6298daSManojkiran Eda endif 113f2caadceSEd Tanous elif ( 114f2caadceSEd Tanous option_key in [ 115f2caadceSEd Tanous 'basic-auth', 116f2caadceSEd Tanous 'cookie-auth', 117f2caadceSEd Tanous 'session-auth', 118f2caadceSEd Tanous 'xtoken-auth', 119f2caadceSEd Tanous 'mutual-tls-auth', 120f2caadceSEd Tanous ] 121f2caadceSEd Tanous ) 1223acced2cSNan Zhou if (get_option('insecure-disable-auth').disabled()) 1233acced2cSNan Zhou add_project_arguments(option_value, language: 'cpp') 1243acced2cSNan Zhou summary(option_key, option_value, section: 'Enabled Features') 1253acced2cSNan Zhou endif 126af6298daSManojkiran Eda else 127af6298daSManojkiran Eda summary(option_key, option_value, section: 'Enabled Features') 128af6298daSManojkiran Eda add_project_arguments(option_value, language: 'cpp') 129af6298daSManojkiran Eda endif 130af6298daSManojkiran Eda else 131af6298daSManojkiran Eda if (option_key == 'insecure-disable-ssl') 132af6298daSManojkiran Eda summary('ssl', '-DBMCWEB_ENABLE_SSL', section: 'Enabled Features') 133af6298daSManojkiran Eda add_project_arguments('-DBMCWEB_ENABLE_SSL', language: 'cpp') 134af6298daSManojkiran Eda endif 135af6298daSManojkiran Eda endif 136af6298daSManojkiran Edaendforeach 137af6298daSManojkiran Eda 138549bed29SPatrick Williamsif (get_option('tests').allowed()) 139af6298daSManojkiran Eda summary('unittest', 'NA', section: 'Enabled Features') 140af6298daSManojkiran Edaendif 141af6298daSManojkiran Eda 142af6298daSManojkiran Eda# Add compiler arguments 143af6298daSManojkiran Eda 144ade3f093SEd Tanousif (cxx.get_id() == 'clang') 145ade3f093SEd Tanous if (cxx.version().version_compare('<17.0')) 146ade3f093SEd Tanous error('This project requires clang-17 or higher') 147ade3f093SEd Tanous endif 148af6298daSManojkiran Eda add_project_arguments( 149af6298daSManojkiran Eda '-Weverything', 150ade3f093SEd Tanous '-Wformat=2', 151af6298daSManojkiran Eda '-Wno-c++98-compat-pedantic', 152f523c324SEd Tanous '-Wno-c++98-compat', 153f523c324SEd Tanous '-Wno-documentation-unknown-command', 154f523c324SEd Tanous '-Wno-documentation', 155af6298daSManojkiran Eda '-Wno-exit-time-destructors', 156f523c324SEd Tanous '-Wno-global-constructors', 157f523c324SEd Tanous '-Wno-newline-eof', 158f523c324SEd Tanous '-Wno-padded', 159af6298daSManojkiran Eda '-Wno-shadow', 160af6298daSManojkiran Eda '-Wno-used-but-marked-unused', 161af6298daSManojkiran Eda '-Wno-weak-vtables', 162e6801eb4SEd Tanous '-Wno-switch-enum', 16372b90760SEd Tanous '-Wno-unused-macros', 1644da0490bSEd Tanous '-Wno-covered-switch-default', 165f2caadceSEd Tanous language: 'cpp', 166f2caadceSEd Tanous ) 167af6298daSManojkiran Edaendif 168af6298daSManojkiran Eda 169ade3f093SEd Tanousif (cxx.get_id() == 'gcc') 170ade3f093SEd Tanous if (cxx.version().version_compare('<13.0')) 171ade3f093SEd Tanous error('This project requires gcc-13 or higher') 172ade3f093SEd Tanous endif 173af6298daSManojkiran Eda 174af6298daSManojkiran Eda add_project_arguments( 175ade3f093SEd Tanous '-Wformat=2', 176ade3f093SEd Tanous '-Wcast-align', 177ade3f093SEd Tanous '-Wconversion', 178ade3f093SEd Tanous '-Woverloaded-virtual', 179ade3f093SEd Tanous '-Wsign-conversion', 180ade3f093SEd Tanous '-Wunused', 181af6298daSManojkiran Eda '-Wduplicated-cond', 182af6298daSManojkiran Eda '-Wduplicated-branches', 183af6298daSManojkiran Eda '-Wlogical-op', 184af6298daSManojkiran Eda '-Wnull-dereference', 185079360aeSEd Tanous '-Wunused-parameter', 186af6298daSManojkiran Eda '-Wdouble-promotion', 1878a592810SEd Tanous '-Wshadow', 18830f11eb4SEd Tanous '-Wno-psabi', 189ade3f093SEd Tanous '-Wno-attributes', 190f2caadceSEd Tanous language: 'cpp', 191f2caadceSEd Tanous ) 192c66403c3SEd Tanousendif 193af6298daSManojkiran Eda 194af6298daSManojkiran Edaif (get_option('buildtype') != 'plain') 195af6298daSManojkiran Eda if (get_option('b_lto') == true and get_option('optimization') != '0') 196af6298daSManojkiran Eda # Reduce the binary size by removing unnecessary 197af6298daSManojkiran Eda # dynamic symbol table entries 198af6298daSManojkiran Eda 199af6298daSManojkiran Eda add_project_arguments( 200f2caadceSEd Tanous cxx.get_supported_arguments( 201f2caadceSEd Tanous [ 202af6298daSManojkiran Eda '-fno-fat-lto-objects', 203af6298daSManojkiran Eda '-fvisibility=hidden', 204f2caadceSEd Tanous '-fvisibility-inlines-hidden', 205f2caadceSEd Tanous ], 206f2caadceSEd Tanous ), 207f2caadceSEd Tanous language: 'cpp', 208f2caadceSEd Tanous ) 209af6298daSManojkiran Eda 210af6298daSManojkiran Eda if cxx.has_link_argument('-Wl,--exclude-libs,ALL') 211af6298daSManojkiran Eda add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp') 212af6298daSManojkiran Eda endif 213af6298daSManojkiran Eda endif 214c66403c3SEd Tanousendif 215af6298daSManojkiran Eda 216f2caadceSEd Tanousif ( 217f2caadceSEd Tanous get_option('bmcweb-logging') != 'disabled' 218f2caadceSEd Tanous or get_option('buildtype').startswith('debug') 219f2caadceSEd Tanous) 220f2caadceSEd Tanous add_project_arguments(['-DBMCWEB_ENABLE_DEBUG'], language: 'cpp') 221af6298daSManojkiran Eda 222662aa6e3SMyung Bae summary('debug', '-DBMCWEB_ENABLE_DEBUG', section: 'Enabled Features') 223e8204933SGeorge Liuendif 224af6298daSManojkiran Eda 225af6298daSManojkiran Eda# Set Compiler Security flags 226af6298daSManojkiran Eda 227af6298daSManojkiran Edasecurity_flags = [ 228af6298daSManojkiran Eda '-fstack-protector-strong', 229af6298daSManojkiran Eda '-fPIE', 230af6298daSManojkiran Eda '-fPIC', 231af6298daSManojkiran Eda '-D_FORTIFY_SOURCE=2', 232af6298daSManojkiran Eda '-Wformat', 233f2caadceSEd Tanous '-Wformat-security', 234af6298daSManojkiran Eda] 235af6298daSManojkiran Eda 236af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize' 237af6298daSManojkiran Eda 238f2caadceSEd Tanousif not ( 239f2caadceSEd Tanous get_option('buildtype') == 'plain' 240f2caadceSEd Tanous or get_option('buildtype').startswith('debug') 241f2caadceSEd Tanous) 242f2caadceSEd Tanous add_project_arguments(cxx.get_supported_arguments([security_flags]), language: 'cpp') 243af6298daSManojkiran Edaendif 244af6298daSManojkiran Eda 245af6298daSManojkiran Eda# Boost dependency configuration 246af6298daSManojkiran Eda 247af6298daSManojkiran Edaadd_project_arguments( 248f2caadceSEd Tanous cxx.get_supported_arguments( 249f2caadceSEd Tanous [ 2506fd29553SEd Tanous '-DBOOST_ASIO_DISABLE_CONCEPTS', 251af6298daSManojkiran Eda '-DBOOST_ALL_NO_LIB', 25258e42b18SEd Tanous '-DBOOST_ALLOW_DEPRECATED_HEADERS', 253f523c324SEd Tanous '-DBOOST_ASIO_DISABLE_THREADS', 254f523c324SEd Tanous '-DBOOST_ASIO_NO_DEPRECATED', 255f523c324SEd Tanous '-DBOOST_ASIO_SEPARATE_COMPILATION', 256f523c324SEd Tanous '-DBOOST_BEAST_SEPARATE_COMPILATION', 2579e710e7fSEd Tanous '-DBOOST_EXCEPTION_DISABLE', 258f706551dSEd Tanous '-DBOOST_NO_EXCEPTIONS', 259ab6b6fecSEd Tanous '-DBOOST_URL_NO_SOURCE_LOCATION', 2609e710e7fSEd Tanous '-DJSON_NOEXCEPTION', 261209aa909SEd Tanous '-DOPENSSL_NO_FILENAMES', 262f706551dSEd Tanous '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES', 263f2caadceSEd Tanous ], 264f2caadceSEd Tanous ), 265f2caadceSEd Tanous language: 'cpp', 266f2caadceSEd Tanous) 267af6298daSManojkiran Eda 268af6298daSManojkiran Eda# Find the dependency modules, if not found use meson wrap to get them 269af6298daSManojkiran Eda# automatically during the configure step 270ceb8ddc1SJason M. Billsbmcweb_dependencies = [] 271af6298daSManojkiran Eda 2728682c5adSNan Zhoupam = cxx.find_library('pam', required: true) 273af6298daSManojkiran Edaatomic = cxx.find_library('atomic', required: true) 274e7923997SEd Tanousbmcweb_dependencies += [pam, atomic] 275e7923997SEd Tanous 276e7923997SEd Tanousopenssl = dependency('openssl', required: false, version: '>=3.0.0') 277e7923997SEd Tanousif not openssl.found() or get_option('b_sanitize') != 'none' 278e7923997SEd Tanous openssl_proj = subproject( 279e7923997SEd Tanous 'openssl', 280e7923997SEd Tanous required: true, 281f2caadceSEd Tanous default_options: ['warning_level=0', 'werror=false'], 282e7923997SEd Tanous ) 283e7923997SEd Tanous openssl = openssl_proj.get_variable('openssl_dep') 284e7923997SEd Tanous openssl = openssl.as_system('system') 285e7923997SEd Tanousendif 286e7923997SEd Tanousbmcweb_dependencies += [openssl] 287af6298daSManojkiran Eda 288fca2cbeaSEd Tanousnghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false) 289fca2cbeaSEd Tanousif not nghttp2.found() 290fca2cbeaSEd Tanous cmake = import('cmake') 291fca2cbeaSEd Tanous opt_var = cmake.subproject_options() 292*211cfa49SEd Tanous opt_var.add_cmake_defines( 293*211cfa49SEd Tanous { 294*211cfa49SEd Tanous 'ENABLE_LIB_ONLY': true, 295*211cfa49SEd Tanous 'ENABLE_STATIC_LIB': true, 296*211cfa49SEd Tanous }, 297*211cfa49SEd Tanous ) 298fca2cbeaSEd Tanous nghttp2_ex = cmake.subproject('nghttp2', options: opt_var) 299*211cfa49SEd Tanous nghttp2 = nghttp2_ex.dependency('nghttp2') 300fca2cbeaSEd Tanousendif 301fca2cbeaSEd Tanousbmcweb_dependencies += nghttp2 302fca2cbeaSEd Tanous 3037bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required: false, include_type: 'system') 304af6298daSManojkiran Edaif not sdbusplus.found() 305af6298daSManojkiran Eda sdbusplus_proj = subproject('sdbusplus', required: true) 306af6298daSManojkiran Eda sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 307af6298daSManojkiran Eda sdbusplus = sdbusplus.as_system('system') 308af6298daSManojkiran Edaendif 309ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus 310af6298daSManojkiran Eda 311c9374ff6SEd Tanoustinyxml = dependency( 312c9374ff6SEd Tanous 'tinyxml2', 313565c0911SPatrick Williams include_type: 'system', 314c9374ff6SEd Tanous version: '>=9.0.0', 31560e299bdSKonstantin Aladyshev default_options: ['tests=false'], 316565c0911SPatrick Williams) 317c9374ff6SEd Tanousif not tinyxml.found() 318c9374ff6SEd Tanous tinyxml_proj = subproject('tinyxml2', required: true) 319c9374ff6SEd Tanous tinyxml = tinyxml_proj.get_variable('tinyxml_dep') 320c9374ff6SEd Tanous tinyxml = tinyxml.as_system('system') 321c9374ff6SEd Tanousendif 322ceb8ddc1SJason M. Billsbmcweb_dependencies += tinyxml 323af6298daSManojkiran Eda 324af6298daSManojkiran Edasystemd = dependency('systemd') 325af6298daSManojkiran Edazlib = dependency('zlib') 326ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib] 327af6298daSManojkiran Eda 328dfd5547bSPatrick Williamsnlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system') 329dfd5547bSPatrick Williamsbmcweb_dependencies += nlohmann_json_dep 330af6298daSManojkiran Eda 3312b5b4daeSCarson Labradoboost = dependency( 3322b5b4daeSCarson Labrado 'boost', 3332b5b4daeSCarson Labrado modules: [ 3342b5b4daeSCarson Labrado 'url', 3352b5b4daeSCarson Labrado ], 336619b8609SEd Tanous version: '>=1.84.0', 3372b5b4daeSCarson Labrado required: false, 338f2caadceSEd Tanous include_type: 'system', 3392b5b4daeSCarson Labrado) 3406fd29553SEd Tanousif boost.found() 3416fd29553SEd Tanous bmcweb_dependencies += [boost] 3426fd29553SEd Tanouselse 3436fd29553SEd Tanous cmake = import('cmake') 3446fd29553SEd Tanous opt = cmake.subproject_options() 345f2caadceSEd Tanous opt.add_cmake_defines( 346f2caadceSEd Tanous { 347144983c5SEd Tanous 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid', 348144983c5SEd Tanous 'BUILD_SHARED_LIBS': 'OFF', 349f2caadceSEd Tanous }, 350f2caadceSEd Tanous ) 351144983c5SEd Tanous 3526fd29553SEd Tanous boost = cmake.subproject('boost', required: true, options: opt) 3532b5b4daeSCarson Labrado boost_asio = boost.dependency('boost_asio').as_system() 3542b5b4daeSCarson Labrado boost_beast = boost.dependency('boost_beast').as_system() 3552b5b4daeSCarson Labrado boost_callable_traits = boost.dependency('boost_callable_traits').as_system() 3566fd29553SEd Tanous boost_headers = boost.dependency('boost_headers').as_system() 3572b5b4daeSCarson Labrado boost_process = boost.dependency('boost_process').as_system() 3582b5b4daeSCarson Labrado boost_type_index = boost.dependency('boost_type_index').as_system() 3592b5b4daeSCarson Labrado boost_url = boost.dependency('boost_url').as_system() 3602b5b4daeSCarson Labrado boost_uuid = boost.dependency('boost_uuid').as_system() 3612b5b4daeSCarson Labrado bmcweb_dependencies += [ 3622b5b4daeSCarson Labrado boost_asio, 3632b5b4daeSCarson Labrado boost_beast, 3642b5b4daeSCarson Labrado boost_callable_traits, 3652b5b4daeSCarson Labrado boost_headers, 3662b5b4daeSCarson Labrado boost_process, 3672b5b4daeSCarson Labrado boost_type_index, 3682b5b4daeSCarson Labrado boost_url, 369f2caadceSEd Tanous boost_uuid, 3702b5b4daeSCarson Labrado ] 371af6298daSManojkiran Edaendif 372af6298daSManojkiran Eda 373549bed29SPatrick Williamsif get_option('tests').allowed() 374f2caadceSEd Tanous gtest = dependency( 375f2caadceSEd Tanous 'gtest', 376f2caadceSEd Tanous main: true, 377f2caadceSEd Tanous version: '>=1.14.0', 378f2caadceSEd Tanous disabler: true, 379f2caadceSEd Tanous required: false, 380f2caadceSEd Tanous ) 381af6298daSManojkiran Eda gmock = dependency('gmock', required: false) 382549bed29SPatrick Williams if not gtest.found() and get_option('tests').allowed() 383af6298daSManojkiran Eda gtest_proj = subproject('gtest', required: true) 384af6298daSManojkiran Eda gtest = gtest_proj.get_variable('gtest_main_dep') 385af6298daSManojkiran Eda gmock = gtest_proj.get_variable('gmock_dep') 386af6298daSManojkiran Eda endif 387b00dcc27SEd Tanous gtest = gtest.as_system('system') 388b00dcc27SEd Tanous gmock = gmock.as_system('system') 389af6298daSManojkiran Edaendif 390af6298daSManojkiran Eda 3914efe3e0cSPatrick Williamssystemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir') 392af6298daSManojkiran Eda 393af6298daSManojkiran Edabindir = get_option('prefix') + '/' + get_option('bindir') 394af6298daSManojkiran Eda 395f2caadceSEd Tanoussummary( 396f2caadceSEd Tanous { 397af6298daSManojkiran Eda 'prefix': get_option('prefix'), 398af6298daSManojkiran Eda 'bindir': bindir, 399f2caadceSEd Tanous 'systemd unit directory': systemd_system_unit_dir, 400f2caadceSEd Tanous }, 401f2caadceSEd Tanous section: 'Directories', 402f2caadceSEd Tanous) 403af6298daSManojkiran Eda 404af6298daSManojkiran Edainstall_subdir('static', install_dir: 'share/www', strip_directory: true) 405af6298daSManojkiran Eda 406307386e8SNan Zhou# Config subdirectory 407307386e8SNan Zhou 408307386e8SNan Zhousubdir('config') 409307386e8SNan Zhoubmcweb_dependencies += conf_h_dep 410307386e8SNan Zhou 41102f1cd9bSEd Tanous# Source files 4120ad63df8SNan Zhoufs = import('fs') 413af6298daSManojkiran Eda 4140ad63df8SNan Zhousrcfiles_bmcweb = files( 4153cd7072bSEd Tanous # end large files 4163cd7072bSEd Tanous 41702f1cd9bSEd Tanous 'redfish-core/src/error_messages.cpp', 418f2caadceSEd Tanous # Begin large files, should be at the beginning 419f2caadceSEd Tanous 'redfish-core/src/redfish.cpp', 420d1d411f9SSui Chen 'redfish-core/src/registries.cpp', 421d02aad39SEd Tanous 'redfish-core/src/utils/dbus_utils.cpp', 42202f1cd9bSEd Tanous 'redfish-core/src/utils/json_utils.cpp', 4233cd7072bSEd Tanous 'redfish-core/src/utils/time_utils.cpp', 424f523c324SEd Tanous 'src/boost_asio.cpp', 425f2caadceSEd Tanous 'src/boost_asio_ssl.cpp', 426f523c324SEd Tanous 'src/boost_beast.cpp', 4276384e323SNan Zhou 'src/dbus_singleton.cpp', 42861e349acSEd Tanous 'src/json_html_serializer.cpp', 4292c6ffdb0SEd Tanous 'src/ossl_random.cpp', 430f2caadceSEd Tanous 'src/webserver_run.cpp', 4310ad63df8SNan Zhou) 43202f1cd9bSEd Tanous 43342bbcd87SEd Tanousbmcweblib = static_library( 43442bbcd87SEd Tanous 'bmcweblib', 43542bbcd87SEd Tanous srcfiles_bmcweb, 43642bbcd87SEd Tanous include_directories: incdir, 43742bbcd87SEd Tanous dependencies: bmcweb_dependencies, 43842bbcd87SEd Tanous) 43942bbcd87SEd Tanous 44002f1cd9bSEd Tanous# Generate the bmcweb executable 44102f1cd9bSEd Tanousexecutable( 44202f1cd9bSEd Tanous 'bmcweb', 44342bbcd87SEd Tanous 'src/webserver_main.cpp', 444af6298daSManojkiran Eda include_directories: incdir, 445ceb8ddc1SJason M. Bills dependencies: bmcweb_dependencies, 44642bbcd87SEd Tanous link_with: bmcweblib, 4475e34b67aSEd Tanous link_args: '-Wl,--gc-sections', 448af6298daSManojkiran Eda install: true, 449f2caadceSEd Tanous install_dir: bindir, 45002f1cd9bSEd Tanous) 45102f1cd9bSEd Tanous 4520ad63df8SNan Zhousrcfiles_unittest = files( 453c33a039bSNan Zhou 'test/http/crow_getroutes_test.cpp', 45452dd6932SEd Tanous 'test/http/http2_connection_test.cpp', 455f2caadceSEd Tanous 'test/http/http_body_test.cpp', 4564fa45dffSEd Tanous 'test/http/http_connection_test.cpp', 4578e3f7032SAbhilash Raju 'test/http/http_response_test.cpp', 458f2caadceSEd Tanous 'test/http/mutual_tls.cpp', 459f2caadceSEd Tanous 'test/http/mutual_tls_meta.cpp', 460f2caadceSEd Tanous 'test/http/parsing_test.cpp', 461f2caadceSEd Tanous 'test/http/router_test.cpp', 462f2caadceSEd Tanous 'test/http/server_sent_event_test.cpp', 463c33a039bSNan Zhou 'test/http/utility_test.cpp', 4642c9efc3cSEd Tanous 'test/http/verb_test.cpp', 465e1452beaSEd Tanous 'test/include/async_resolve_test.cpp', 46611e8f60dSEd Tanous 'test/include/credential_pipe_test.cpp', 467f2caadceSEd Tanous 'test/include/dbus_utility_test.cpp', 468f2caadceSEd Tanous 'test/include/google/google_service_root_test.cpp', 469f2caadceSEd Tanous 'test/include/http_utility_test.cpp', 470f2caadceSEd Tanous 'test/include/human_sort_test.cpp', 471c33a039bSNan Zhou 'test/include/ibm/configfile_test.cpp', 472f2caadceSEd Tanous 'test/include/json_html_serializer.cpp', 473c33a039bSNan Zhou 'test/include/multipart_test.cpp', 474c33a039bSNan Zhou 'test/include/openbmc_dbus_rest_test.cpp', 4752c6ffdb0SEd Tanous 'test/include/ossl_random.cpp', 476f2caadceSEd Tanous 'test/include/str_utility_test.cpp', 477c33a039bSNan Zhou 'test/redfish-core/include/privileges_test.cpp', 4787e8890c5SCarson Labrado 'test/redfish-core/include/redfish_aggregator_test.cpp', 479c33a039bSNan Zhou 'test/redfish-core/include/registries_test.cpp', 480d02aad39SEd Tanous 'test/redfish-core/include/utils/dbus_utils.cpp', 481f2caadceSEd Tanous 'test/redfish-core/include/utils/hex_utils_test.cpp', 482c33a039bSNan Zhou 'test/redfish-core/include/utils/ip_utils_test.cpp', 483c33a039bSNan Zhou 'test/redfish-core/include/utils/json_utils_test.cpp', 484c33a039bSNan Zhou 'test/redfish-core/include/utils/query_param_test.cpp', 485c33a039bSNan Zhou 'test/redfish-core/include/utils/stl_utils_test.cpp', 486c33a039bSNan Zhou 'test/redfish-core/include/utils/time_utils_test.cpp', 487c33a039bSNan Zhou 'test/redfish-core/lib/chassis_test.cpp', 488c33a039bSNan Zhou 'test/redfish-core/lib/log_services_dump_test.cpp', 48975e8e218SMyung Bae 'test/redfish-core/lib/log_services_test.cpp', 490e610b316SJagpal Singh Gill 'test/redfish-core/lib/manager_diagnostic_data_test.cpp', 491f2caadceSEd Tanous 'test/redfish-core/lib/power_subsystem_test.cpp', 492f2caadceSEd Tanous 'test/redfish-core/lib/sensors_test.cpp', 493f2caadceSEd Tanous 'test/redfish-core/lib/service_root_test.cpp', 494f2caadceSEd Tanous 'test/redfish-core/lib/system_test.cpp', 495f2caadceSEd Tanous 'test/redfish-core/lib/thermal_subsystem_test.cpp', 496f2caadceSEd Tanous 'test/redfish-core/lib/update_service_test.cpp', 4970ad63df8SNan Zhou) 498af6298daSManojkiran Eda 499549bed29SPatrick Williamsif (get_option('tests').allowed()) 50002f1cd9bSEd Tanous # generate the test executable 5010ad63df8SNan Zhou foreach test_src : srcfiles_unittest 5020ad63df8SNan Zhou test_bin = executable( 5030ad63df8SNan Zhou fs.stem(test_src), 50442bbcd87SEd Tanous test_src, 50542bbcd87SEd Tanous link_with: bmcweblib, 506af6298daSManojkiran Eda include_directories: incdir, 507af6298daSManojkiran Eda install_dir: bindir, 508f2caadceSEd Tanous dependencies: bmcweb_dependencies 509f2caadceSEd Tanous + [ 510cf2f932eSEd Tanous gtest, 511cf2f932eSEd Tanous gmock, 512f2caadceSEd Tanous ], 51302f1cd9bSEd Tanous ) 5140ad63df8SNan Zhou test(fs.stem(test_src), test_bin) 5150ad63df8SNan Zhou endforeach 516af6298daSManojkiran Edaendif 517