1*f2caadceSEd Tanousproject( 2*f2caadceSEd Tanous 'bmcweb', 3*f2caadceSEd 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', 16*f2caadceSEd Tanous ], 17*f2caadceSEd 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 58*f2caadceSEd 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()) 102*f2caadceSEd Tanous if ( 103*f2caadceSEd Tanous option_key == 'mutual-tls-auth' 104*f2caadceSEd Tanous or option_key == 'insecure-disable-ssl' 105*f2caadceSEd Tanous ) 106*f2caadceSEd Tanous if ( 107*f2caadceSEd Tanous get_option('insecure-disable-ssl').disabled() 108*f2caadceSEd Tanous or get_option('mutual-tls-auth').disabled() 109*f2caadceSEd Tanous ) 110af6298daSManojkiran Eda add_project_arguments(option_value, language: 'cpp') 111af6298daSManojkiran Eda summary(option_key, option_value, section: 'Enabled Features') 112af6298daSManojkiran Eda endif 113*f2caadceSEd Tanous elif ( 114*f2caadceSEd Tanous option_key in [ 115*f2caadceSEd Tanous 'basic-auth', 116*f2caadceSEd Tanous 'cookie-auth', 117*f2caadceSEd Tanous 'session-auth', 118*f2caadceSEd Tanous 'xtoken-auth', 119*f2caadceSEd Tanous 'mutual-tls-auth', 120*f2caadceSEd Tanous ] 121*f2caadceSEd 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', 165*f2caadceSEd Tanous language: 'cpp', 166*f2caadceSEd 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', 190*f2caadceSEd Tanous language: 'cpp', 191*f2caadceSEd 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( 200*f2caadceSEd Tanous cxx.get_supported_arguments( 201*f2caadceSEd Tanous [ 202af6298daSManojkiran Eda '-fno-fat-lto-objects', 203af6298daSManojkiran Eda '-fvisibility=hidden', 204*f2caadceSEd Tanous '-fvisibility-inlines-hidden', 205*f2caadceSEd Tanous ], 206*f2caadceSEd Tanous ), 207*f2caadceSEd Tanous language: 'cpp', 208*f2caadceSEd 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 216*f2caadceSEd Tanousif ( 217*f2caadceSEd Tanous get_option('bmcweb-logging') != 'disabled' 218*f2caadceSEd Tanous or get_option('buildtype').startswith('debug') 219*f2caadceSEd Tanous) 220*f2caadceSEd 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', 233*f2caadceSEd Tanous '-Wformat-security', 234af6298daSManojkiran Eda] 235af6298daSManojkiran Eda 236af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize' 237af6298daSManojkiran Eda 238*f2caadceSEd Tanousif not ( 239*f2caadceSEd Tanous get_option('buildtype') == 'plain' 240*f2caadceSEd Tanous or get_option('buildtype').startswith('debug') 241*f2caadceSEd Tanous) 242*f2caadceSEd 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( 248*f2caadceSEd Tanous cxx.get_supported_arguments( 249*f2caadceSEd 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', 263*f2caadceSEd Tanous ], 264*f2caadceSEd Tanous ), 265*f2caadceSEd Tanous language: 'cpp', 266*f2caadceSEd 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, 281*f2caadceSEd 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*f2caadceSEd Tanous opt_var.add_cmake_defines({'ENABLE_LIB_ONLY': true, 'ENABLE_STATIC_LIB': true}) 293fca2cbeaSEd Tanous nghttp2_ex = cmake.subproject('nghttp2', options: opt_var) 294144983c5SEd Tanous nghttp2 = nghttp2_ex.dependency('nghttp2_static') 295fca2cbeaSEd Tanousendif 296fca2cbeaSEd Tanousbmcweb_dependencies += nghttp2 297fca2cbeaSEd Tanous 2987bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required: false, include_type: 'system') 299af6298daSManojkiran Edaif not sdbusplus.found() 300af6298daSManojkiran Eda sdbusplus_proj = subproject('sdbusplus', required: true) 301af6298daSManojkiran Eda sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') 302af6298daSManojkiran Eda sdbusplus = sdbusplus.as_system('system') 303af6298daSManojkiran Edaendif 304ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus 305af6298daSManojkiran Eda 306c9374ff6SEd Tanoustinyxml = dependency( 307c9374ff6SEd Tanous 'tinyxml2', 308565c0911SPatrick Williams include_type: 'system', 309c9374ff6SEd Tanous version: '>=9.0.0', 31060e299bdSKonstantin Aladyshev default_options: ['tests=false'], 311565c0911SPatrick Williams) 312c9374ff6SEd Tanousif not tinyxml.found() 313c9374ff6SEd Tanous tinyxml_proj = subproject('tinyxml2', required: true) 314c9374ff6SEd Tanous tinyxml = tinyxml_proj.get_variable('tinyxml_dep') 315c9374ff6SEd Tanous tinyxml = tinyxml.as_system('system') 316c9374ff6SEd Tanousendif 317ceb8ddc1SJason M. Billsbmcweb_dependencies += tinyxml 318af6298daSManojkiran Eda 319af6298daSManojkiran Edasystemd = dependency('systemd') 320af6298daSManojkiran Edazlib = dependency('zlib') 321ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib] 322af6298daSManojkiran Eda 323dfd5547bSPatrick Williamsnlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system') 324dfd5547bSPatrick Williamsbmcweb_dependencies += nlohmann_json_dep 325af6298daSManojkiran Eda 3262b5b4daeSCarson Labradoboost = dependency( 3272b5b4daeSCarson Labrado 'boost', 3282b5b4daeSCarson Labrado modules: [ 3292b5b4daeSCarson Labrado 'url', 3302b5b4daeSCarson Labrado ], 331619b8609SEd Tanous version: '>=1.84.0', 3322b5b4daeSCarson Labrado required: false, 333*f2caadceSEd Tanous include_type: 'system', 3342b5b4daeSCarson Labrado) 3356fd29553SEd Tanousif boost.found() 3366fd29553SEd Tanous bmcweb_dependencies += [boost] 3376fd29553SEd Tanouselse 3386fd29553SEd Tanous cmake = import('cmake') 3396fd29553SEd Tanous opt = cmake.subproject_options() 340*f2caadceSEd Tanous opt.add_cmake_defines( 341*f2caadceSEd Tanous { 342144983c5SEd Tanous 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid', 343144983c5SEd Tanous 'BUILD_SHARED_LIBS': 'OFF', 344*f2caadceSEd Tanous }, 345*f2caadceSEd Tanous ) 346144983c5SEd Tanous 3476fd29553SEd Tanous boost = cmake.subproject('boost', required: true, options: opt) 3482b5b4daeSCarson Labrado boost_asio = boost.dependency('boost_asio').as_system() 3492b5b4daeSCarson Labrado boost_beast = boost.dependency('boost_beast').as_system() 3502b5b4daeSCarson Labrado boost_callable_traits = boost.dependency('boost_callable_traits').as_system() 3516fd29553SEd Tanous boost_headers = boost.dependency('boost_headers').as_system() 3522b5b4daeSCarson Labrado boost_process = boost.dependency('boost_process').as_system() 3532b5b4daeSCarson Labrado boost_type_index = boost.dependency('boost_type_index').as_system() 3542b5b4daeSCarson Labrado boost_url = boost.dependency('boost_url').as_system() 3552b5b4daeSCarson Labrado boost_uuid = boost.dependency('boost_uuid').as_system() 3562b5b4daeSCarson Labrado bmcweb_dependencies += [ 3572b5b4daeSCarson Labrado boost_asio, 3582b5b4daeSCarson Labrado boost_beast, 3592b5b4daeSCarson Labrado boost_callable_traits, 3602b5b4daeSCarson Labrado boost_headers, 3612b5b4daeSCarson Labrado boost_process, 3622b5b4daeSCarson Labrado boost_type_index, 3632b5b4daeSCarson Labrado boost_url, 364*f2caadceSEd Tanous boost_uuid, 3652b5b4daeSCarson Labrado ] 366af6298daSManojkiran Edaendif 367af6298daSManojkiran Eda 368549bed29SPatrick Williamsif get_option('tests').allowed() 369*f2caadceSEd Tanous gtest = dependency( 370*f2caadceSEd Tanous 'gtest', 371*f2caadceSEd Tanous main: true, 372*f2caadceSEd Tanous version: '>=1.14.0', 373*f2caadceSEd Tanous disabler: true, 374*f2caadceSEd Tanous required: false, 375*f2caadceSEd Tanous ) 376af6298daSManojkiran Eda gmock = dependency('gmock', required: false) 377549bed29SPatrick Williams if not gtest.found() and get_option('tests').allowed() 378af6298daSManojkiran Eda gtest_proj = subproject('gtest', required: true) 379af6298daSManojkiran Eda gtest = gtest_proj.get_variable('gtest_main_dep') 380af6298daSManojkiran Eda gmock = gtest_proj.get_variable('gmock_dep') 381af6298daSManojkiran Eda endif 382b00dcc27SEd Tanous gtest = gtest.as_system('system') 383b00dcc27SEd Tanous gmock = gmock.as_system('system') 384af6298daSManojkiran Edaendif 385af6298daSManojkiran Eda 3864efe3e0cSPatrick Williamssystemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir') 387af6298daSManojkiran Eda 388af6298daSManojkiran Edabindir = get_option('prefix') + '/' + get_option('bindir') 389af6298daSManojkiran Eda 390*f2caadceSEd Tanoussummary( 391*f2caadceSEd Tanous { 392af6298daSManojkiran Eda 'prefix': get_option('prefix'), 393af6298daSManojkiran Eda 'bindir': bindir, 394*f2caadceSEd Tanous 'systemd unit directory': systemd_system_unit_dir, 395*f2caadceSEd Tanous }, 396*f2caadceSEd Tanous section: 'Directories', 397*f2caadceSEd Tanous) 398af6298daSManojkiran Eda 399af6298daSManojkiran Edainstall_subdir('static', install_dir: 'share/www', strip_directory: true) 400af6298daSManojkiran Eda 401307386e8SNan Zhou# Config subdirectory 402307386e8SNan Zhou 403307386e8SNan Zhousubdir('config') 404307386e8SNan Zhoubmcweb_dependencies += conf_h_dep 405307386e8SNan Zhou 40602f1cd9bSEd Tanous# Source files 4070ad63df8SNan Zhoufs = import('fs') 408af6298daSManojkiran Eda 4090ad63df8SNan Zhousrcfiles_bmcweb = files( 4103cd7072bSEd Tanous # end large files 4113cd7072bSEd Tanous 41202f1cd9bSEd Tanous 'redfish-core/src/error_messages.cpp', 413*f2caadceSEd Tanous # Begin large files, should be at the beginning 414*f2caadceSEd Tanous 'redfish-core/src/redfish.cpp', 415d1d411f9SSui Chen 'redfish-core/src/registries.cpp', 416d02aad39SEd Tanous 'redfish-core/src/utils/dbus_utils.cpp', 41702f1cd9bSEd Tanous 'redfish-core/src/utils/json_utils.cpp', 4183cd7072bSEd Tanous 'redfish-core/src/utils/time_utils.cpp', 419f523c324SEd Tanous 'src/boost_asio.cpp', 420*f2caadceSEd Tanous 'src/boost_asio_ssl.cpp', 421f523c324SEd Tanous 'src/boost_beast.cpp', 4226384e323SNan Zhou 'src/dbus_singleton.cpp', 42361e349acSEd Tanous 'src/json_html_serializer.cpp', 4242c6ffdb0SEd Tanous 'src/ossl_random.cpp', 425*f2caadceSEd Tanous 'src/webserver_run.cpp', 4260ad63df8SNan Zhou) 42702f1cd9bSEd Tanous 42842bbcd87SEd Tanousbmcweblib = static_library( 42942bbcd87SEd Tanous 'bmcweblib', 43042bbcd87SEd Tanous srcfiles_bmcweb, 43142bbcd87SEd Tanous include_directories: incdir, 43242bbcd87SEd Tanous dependencies: bmcweb_dependencies, 43342bbcd87SEd Tanous) 43442bbcd87SEd Tanous 43502f1cd9bSEd Tanous# Generate the bmcweb executable 43602f1cd9bSEd Tanousexecutable( 43702f1cd9bSEd Tanous 'bmcweb', 43842bbcd87SEd Tanous 'src/webserver_main.cpp', 439af6298daSManojkiran Eda include_directories: incdir, 440ceb8ddc1SJason M. Bills dependencies: bmcweb_dependencies, 44142bbcd87SEd Tanous link_with: bmcweblib, 4425e34b67aSEd Tanous link_args: '-Wl,--gc-sections', 443af6298daSManojkiran Eda install: true, 444*f2caadceSEd Tanous install_dir: bindir, 44502f1cd9bSEd Tanous) 44602f1cd9bSEd Tanous 4470ad63df8SNan Zhousrcfiles_unittest = files( 448c33a039bSNan Zhou 'test/http/crow_getroutes_test.cpp', 44952dd6932SEd Tanous 'test/http/http2_connection_test.cpp', 450*f2caadceSEd Tanous 'test/http/http_body_test.cpp', 4514fa45dffSEd Tanous 'test/http/http_connection_test.cpp', 4528e3f7032SAbhilash Raju 'test/http/http_response_test.cpp', 453*f2caadceSEd Tanous 'test/http/mutual_tls.cpp', 454*f2caadceSEd Tanous 'test/http/mutual_tls_meta.cpp', 455*f2caadceSEd Tanous 'test/http/parsing_test.cpp', 456*f2caadceSEd Tanous 'test/http/router_test.cpp', 457*f2caadceSEd Tanous 'test/http/server_sent_event_test.cpp', 458c33a039bSNan Zhou 'test/http/utility_test.cpp', 4592c9efc3cSEd Tanous 'test/http/verb_test.cpp', 460e1452beaSEd Tanous 'test/include/async_resolve_test.cpp', 46111e8f60dSEd Tanous 'test/include/credential_pipe_test.cpp', 462*f2caadceSEd Tanous 'test/include/dbus_utility_test.cpp', 463*f2caadceSEd Tanous 'test/include/google/google_service_root_test.cpp', 464*f2caadceSEd Tanous 'test/include/http_utility_test.cpp', 465*f2caadceSEd Tanous 'test/include/human_sort_test.cpp', 466c33a039bSNan Zhou 'test/include/ibm/configfile_test.cpp', 467c33a039bSNan Zhou 'test/include/ibm/lock_test.cpp', 468*f2caadceSEd Tanous 'test/include/json_html_serializer.cpp', 469c33a039bSNan Zhou 'test/include/multipart_test.cpp', 470c33a039bSNan Zhou 'test/include/openbmc_dbus_rest_test.cpp', 4712c6ffdb0SEd Tanous 'test/include/ossl_random.cpp', 472*f2caadceSEd Tanous 'test/include/str_utility_test.cpp', 473c33a039bSNan Zhou 'test/redfish-core/include/privileges_test.cpp', 4747e8890c5SCarson Labrado 'test/redfish-core/include/redfish_aggregator_test.cpp', 475c33a039bSNan Zhou 'test/redfish-core/include/registries_test.cpp', 476d02aad39SEd Tanous 'test/redfish-core/include/utils/dbus_utils.cpp', 477*f2caadceSEd Tanous 'test/redfish-core/include/utils/hex_utils_test.cpp', 478c33a039bSNan Zhou 'test/redfish-core/include/utils/ip_utils_test.cpp', 479c33a039bSNan Zhou 'test/redfish-core/include/utils/json_utils_test.cpp', 480c33a039bSNan Zhou 'test/redfish-core/include/utils/query_param_test.cpp', 481c33a039bSNan Zhou 'test/redfish-core/include/utils/stl_utils_test.cpp', 482c33a039bSNan Zhou 'test/redfish-core/include/utils/time_utils_test.cpp', 483c33a039bSNan Zhou 'test/redfish-core/lib/chassis_test.cpp', 484c33a039bSNan Zhou 'test/redfish-core/lib/log_services_dump_test.cpp', 48575e8e218SMyung Bae 'test/redfish-core/lib/log_services_test.cpp', 486e610b316SJagpal Singh Gill 'test/redfish-core/lib/manager_diagnostic_data_test.cpp', 487*f2caadceSEd Tanous 'test/redfish-core/lib/power_subsystem_test.cpp', 488*f2caadceSEd Tanous 'test/redfish-core/lib/sensors_test.cpp', 489*f2caadceSEd Tanous 'test/redfish-core/lib/service_root_test.cpp', 490*f2caadceSEd Tanous 'test/redfish-core/lib/system_test.cpp', 491*f2caadceSEd Tanous 'test/redfish-core/lib/thermal_subsystem_test.cpp', 492*f2caadceSEd Tanous 'test/redfish-core/lib/update_service_test.cpp', 4930ad63df8SNan Zhou) 494af6298daSManojkiran Eda 495549bed29SPatrick Williamsif (get_option('tests').allowed()) 49602f1cd9bSEd Tanous # generate the test executable 4970ad63df8SNan Zhou foreach test_src : srcfiles_unittest 4980ad63df8SNan Zhou test_bin = executable( 4990ad63df8SNan Zhou fs.stem(test_src), 50042bbcd87SEd Tanous test_src, 50142bbcd87SEd Tanous link_with: bmcweblib, 502af6298daSManojkiran Eda include_directories: incdir, 503af6298daSManojkiran Eda install_dir: bindir, 504*f2caadceSEd Tanous dependencies: bmcweb_dependencies 505*f2caadceSEd Tanous + [ 506cf2f932eSEd Tanous gtest, 507cf2f932eSEd Tanous gmock, 508*f2caadceSEd Tanous ], 50902f1cd9bSEd Tanous ) 5100ad63df8SNan Zhou test(fs.stem(test_src), test_bin) 5110ad63df8SNan Zhou endforeach 512af6298daSManojkiran Edaendif 513