| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 1 | project( | 
 | 2 |     'bmcweb', | 
 | 3 |     'cpp', | 
 | 4 |     version: '1.0', | 
| Ed Tanous | 8dc3ddf | 2024-06-25 13:00:16 -0700 | [diff] [blame] | 5 |     meson_version: '>=1.3.0', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 6 |     default_options: [ | 
 | 7 |         'b_lto_mode=default', | 
 | 8 |         'b_lto_threads=0', | 
 | 9 |         'b_lto=true', | 
 | 10 |         'b_ndebug=if-release', | 
 | 11 |         'buildtype=debugoptimized', | 
 | 12 |         'cpp_rtti=false', | 
| Patrick Williams | 921cfcd | 2023-08-23 06:31:07 -0500 | [diff] [blame] | 13 |         'cpp_std=c++23', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 14 |         'warning_level=3', | 
 | 15 |         'werror=true', | 
 | 16 |     ], | 
 | 17 | ) | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 18 |  | 
 | 19 | # Project related links | 
 | 20 |  | 
 | 21 | project_pretty_name = 'bmcweb' | 
 | 22 | project_url = 'https://github.com/openbmc/' + project_pretty_name | 
 | 23 | project_issues_url = project_url + '/issues/new' | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 24 | summary('Issues', project_issues_url, section: 'Report Issues') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 25 |  | 
 | 26 | # Validate the c++ Standard | 
 | 27 |  | 
| Patrick Williams | 921cfcd | 2023-08-23 06:31:07 -0500 | [diff] [blame] | 28 | if get_option('cpp_std') != 'c++23' | 
 | 29 |     error('This project requires c++23 support') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 30 | endif | 
 | 31 |  | 
 | 32 | # Get compiler and default build type | 
 | 33 |  | 
 | 34 | cxx = meson.get_compiler('cpp') | 
 | 35 | build = get_option('buildtype') | 
 | 36 | optimization = get_option('optimization') | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 37 | summary('Build Type', build, section: 'Build Info') | 
 | 38 | summary('Optimization', optimization, section: 'Build Info') | 
| Ed Tanous | 5e34b67 | 2021-02-05 14:21:27 -0800 | [diff] [blame] | 39 |  | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 40 | # remove debug information for minsize buildtype | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 41 | if (get_option('buildtype') == 'minsize') | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 42 |     add_project_arguments( | 
 | 43 |         ['-fdata-sections', '-ffunction-sections'], | 
 | 44 |         language: 'cpp', | 
 | 45 |     ) | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 46 |     add_project_arguments('-DNDEBUG', language: 'cpp') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 47 | endif | 
 | 48 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 49 | if (get_option('dns-resolver') == 'systemd-dbus') | 
 | 50 |     add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp') | 
| Ed Tanous | f8ca6d7 | 2022-06-28 12:12:03 -0700 | [diff] [blame] | 51 | endif | 
 | 52 |  | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 53 | # Disable lto when compiling with no optimization | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 54 | if (get_option('optimization') == '0') | 
 | 55 |     add_project_arguments('-fno-lto', language: 'cpp') | 
 | 56 |     message('Disabling lto & its supported features as optimization is disabled') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 57 | endif | 
 | 58 |  | 
 | 59 | # Include Directories | 
| Ed Tanous | 3b28fa2 | 2024-09-23 14:51:55 -0700 | [diff] [blame] | 60 | incdir = [ | 
 | 61 |     include_directories( | 
 | 62 |         'include', | 
 | 63 |         'redfish-core/include', | 
 | 64 |         'redfish-core/lib', | 
 | 65 |         'http', | 
 | 66 |     ), | 
 | 67 | ] | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 68 |  | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 69 | # Add compiler arguments | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 70 | boost_flags = ['-Wno-unused-parameter'] | 
 | 71 | nghttp2_flags = [] | 
| Ed Tanous | ade3f09 | 2024-03-13 13:28:36 -0700 | [diff] [blame] | 72 | if (cxx.get_id() == 'clang') | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 73 |     if (cxx.version().version_compare('<17.0')) | 
 | 74 |         error('This project requires clang-17 or higher') | 
 | 75 |     endif | 
 | 76 |     add_project_arguments( | 
 | 77 |         '-Weverything', | 
 | 78 |         '-Wformat=2', | 
| Ed Tanous | 3d15864 | 2025-05-12 14:20:49 -0700 | [diff] [blame] | 79 |         # https://github.com/llvm/llvm-project/issues/101614 | 
 | 80 |         '-fno-builtin-std-forward_like', | 
| Ed Tanous | 25991f7 | 2024-06-13 18:10:25 -0700 | [diff] [blame] | 81 |         '-Wno-c++20-extensions', | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 82 |         '-Wno-c++26-extensions', | 
| Ed Tanous | b5edf03 | 2025-02-09 09:45:00 -0800 | [diff] [blame] | 83 |         '-Wno-c++98-compat', | 
 | 84 |         '-Wno-c++98-compat-pedantic', | 
 | 85 |         '-Wno-covered-switch-default', | 
 | 86 |         '-Wno-disabled-macro-expansion', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 87 |         '-Wno-documentation', | 
| Ed Tanous | b5edf03 | 2025-02-09 09:45:00 -0800 | [diff] [blame] | 88 |         '-Wno-documentation-unknown-command', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 89 |         '-Wno-exit-time-destructors', | 
 | 90 |         '-Wno-global-constructors', | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 91 |         '-Wno-missing-include-dirs', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 92 |         '-Wno-newline-eof', | 
 | 93 |         '-Wno-padded', | 
 | 94 |         '-Wno-shadow', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 95 |         '-Wno-switch-enum', | 
| Ed Tanous | 724985f | 2024-06-05 09:19:06 -0700 | [diff] [blame] | 96 |         '-Wno-unneeded-internal-declaration', | 
| Ed Tanous | 60b8de3 | 2024-12-18 11:01:53 -0800 | [diff] [blame] | 97 |         '-Wno-unsafe-buffer-usage-in-container', | 
| Ed Tanous | 3d15864 | 2025-05-12 14:20:49 -0700 | [diff] [blame] | 98 |         '-Wno-unsafe-buffer-usage-in-libc-call', | 
| Ed Tanous | b5edf03 | 2025-02-09 09:45:00 -0800 | [diff] [blame] | 99 |         '-Wno-unused-macros', | 
 | 100 |         '-Wno-used-but-marked-unused', | 
 | 101 |         '-Wno-weak-vtables', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 102 |         language: 'cpp', | 
 | 103 |     ) | 
| Ed Tanous | 5c467f9 | 2025-06-05 11:22:53 -0700 | [diff] [blame] | 104 |     if (cxx.version().version_compare('>=21.0')) | 
 | 105 |         # TODO(Ed) These warnings look valid and need cleaned up. | 
 | 106 |         add_project_arguments( | 
 | 107 |             '-Wno-unique-object-duplication', | 
 | 108 |             '-Wno-nrvo', | 
 | 109 |             language: 'cpp', | 
 | 110 |         ) | 
 | 111 |     endif | 
 | 112 |  | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 113 |     boost_flags += ['-Wno-strict-prototypes', '-Wno-unused-but-set-variable'] | 
 | 114 |     nghttp2_flags += ['-Wno-extra-semi'] | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 115 | endif | 
 | 116 |  | 
| Ed Tanous | ade3f09 | 2024-03-13 13:28:36 -0700 | [diff] [blame] | 117 | if (cxx.get_id() == 'gcc') | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 118 |     if (cxx.version().version_compare('<13.0')) | 
 | 119 |         error('This project requires gcc-13 or higher') | 
 | 120 |     endif | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 121 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 122 |     add_project_arguments( | 
 | 123 |         '-Wformat=2', | 
 | 124 |         '-Wcast-align', | 
 | 125 |         '-Wconversion', | 
 | 126 |         '-Woverloaded-virtual', | 
 | 127 |         '-Wsign-conversion', | 
 | 128 |         '-Wunused', | 
 | 129 |         '-Wduplicated-cond', | 
 | 130 |         '-Wduplicated-branches', | 
 | 131 |         '-Wlogical-op', | 
 | 132 |         '-Wnull-dereference', | 
 | 133 |         '-Wunused-parameter', | 
 | 134 |         '-Wdouble-promotion', | 
 | 135 |         '-Wshadow', | 
 | 136 |         '-Wno-psabi', | 
 | 137 |         '-Wno-attributes', | 
 | 138 |         language: 'cpp', | 
 | 139 |     ) | 
| Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 140 | endif | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 141 |  | 
| Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 142 | if (get_option('buildtype') != 'plain') | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 143 |     if (get_option('b_lto') == true and get_option('optimization') != '0') | 
 | 144 |         # Reduce the binary size by removing unnecessary | 
 | 145 |         # dynamic symbol table entries | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 146 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 147 |         add_project_arguments( | 
 | 148 |             cxx.get_supported_arguments( | 
 | 149 |                 [ | 
 | 150 |                     '-fno-fat-lto-objects', | 
 | 151 |                     '-fvisibility=hidden', | 
 | 152 |                     '-fvisibility-inlines-hidden', | 
 | 153 |                 ], | 
 | 154 |             ), | 
 | 155 |             language: 'cpp', | 
 | 156 |         ) | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 157 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 158 |         if cxx.has_link_argument('-Wl,--exclude-libs,ALL') | 
 | 159 |             add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp') | 
 | 160 |         endif | 
| George Liu | e820493 | 2021-02-01 14:42:49 +0800 | [diff] [blame] | 161 |     endif | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 162 | endif | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 163 | # Set Compiler Security flags | 
 | 164 |  | 
 | 165 | security_flags = [ | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 166 |     '-fstack-protector-strong', | 
 | 167 |     '-fPIE', | 
 | 168 |     '-fPIC', | 
 | 169 |     '-D_FORTIFY_SOURCE=2', | 
 | 170 |     '-Wformat', | 
 | 171 |     '-Wformat-security', | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 172 | ] | 
 | 173 |  | 
 | 174 | ## Add security flags for builds of type 'release','debugoptimized' and 'minsize' | 
| Ed Tanous | 42448d9 | 2025-08-25 17:47:19 -0700 | [diff] [blame] | 175 | plain = get_option('buildtype') == 'plain' | 
 | 176 | debug = get_option('buildtype').startswith('debug') | 
 | 177 | if not (plain or debug) | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 178 |     add_project_arguments( | 
 | 179 |         cxx.get_supported_arguments([security_flags]), | 
 | 180 |         language: 'cpp', | 
 | 181 |     ) | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 182 | endif | 
 | 183 |  | 
 | 184 | # Boost dependency configuration | 
 | 185 |  | 
 | 186 | add_project_arguments( | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 187 |     cxx.get_supported_arguments( | 
 | 188 |         [ | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 189 |             '-DBOOST_ALL_NO_LIB', | 
 | 190 |             '-DBOOST_ALLOW_DEPRECATED_HEADERS', | 
 | 191 |             '-DBOOST_ASIO_DISABLE_THREADS', | 
 | 192 |             '-DBOOST_ASIO_NO_DEPRECATED', | 
 | 193 |             '-DBOOST_ASIO_SEPARATE_COMPILATION', | 
 | 194 |             '-DBOOST_BEAST_SEPARATE_COMPILATION', | 
 | 195 |             '-DBOOST_EXCEPTION_DISABLE', | 
 | 196 |             '-DBOOST_NO_EXCEPTIONS', | 
 | 197 |             '-DBOOST_URL_NO_SOURCE_LOCATION', | 
| Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 198 |             '-DBOOST_SPIRIT_X3_NO_RTTI', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 199 |             '-DJSON_NOEXCEPTION', | 
| Ed Tanous | 82b286f | 2025-05-06 13:29:48 -0700 | [diff] [blame] | 200 |             '-DJSON_USE_IMPLICIT_CONVERSIONS=0', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 201 |             '-DOPENSSL_NO_FILENAMES', | 
 | 202 |             '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES', | 
 | 203 |         ], | 
 | 204 |     ), | 
 | 205 |     language: 'cpp', | 
 | 206 | ) | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 207 |  | 
 | 208 | # Find the dependency modules, if not found use meson wrap to get them | 
 | 209 | # automatically during the configure step | 
| Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 210 | bmcweb_dependencies = [] | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 211 |  | 
| Nan Zhou | 8682c5a | 2021-11-13 11:00:07 -0800 | [diff] [blame] | 212 | pam = cxx.find_library('pam', required: true) | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 213 | atomic = cxx.find_library('atomic', required: true) | 
| Ed Tanous | e792399 | 2023-12-03 14:14:02 -0800 | [diff] [blame] | 214 | bmcweb_dependencies += [pam, atomic] | 
 | 215 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 216 | openssl = dependency('openssl', required: false, version: '>=3.0.0') | 
| Ed Tanous | d033fd1 | 2025-03-13 11:16:24 -0700 | [diff] [blame] | 217 | if not openssl.found() | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 218 |     openssl_proj = subproject( | 
 | 219 |         'openssl', | 
 | 220 |         required: true, | 
 | 221 |         default_options: ['warning_level=0', 'werror=false'], | 
 | 222 |     ) | 
 | 223 |     openssl = openssl_proj.get_variable('openssl_dep') | 
 | 224 |     openssl = openssl.as_system('system') | 
| Ed Tanous | e792399 | 2023-12-03 14:14:02 -0800 | [diff] [blame] | 225 | endif | 
 | 226 | bmcweb_dependencies += [openssl] | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 227 |  | 
| Ed Tanous | b253906 | 2024-03-12 16:58:35 -0700 | [diff] [blame] | 228 | zstd = dependency('libzstd', required: get_option('http-zstd').allowed()) | 
 | 229 | if zstd.found() | 
 | 230 |     add_project_arguments('-DHAVE_ZSTD', language: 'cpp') | 
 | 231 |     bmcweb_dependencies += [zstd] | 
 | 232 | endif | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 233 | nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false) | 
| Ed Tanous | fca2cbe | 2021-01-28 14:49:59 -0800 | [diff] [blame] | 234 | if not nghttp2.found() | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 235 |     cmake = import('cmake') | 
 | 236 |     opt_var = cmake.subproject_options() | 
| Ed Tanous | 211cfa4 | 2024-04-17 13:43:14 -0700 | [diff] [blame] | 237 |     opt_var.add_cmake_defines( | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 238 |         { | 
 | 239 |             'CMAKE_C_FLAGS': ' '.join(nghttp2_flags), | 
 | 240 |             'CMAKE_CXX_FLAGS': ' '.join(nghttp2_flags), | 
 | 241 |             'ENABLE_LIB_ONLY': true, | 
 | 242 |             'ENABLE_STATIC_LIB': true, | 
 | 243 |         }, | 
| Ed Tanous | 211cfa4 | 2024-04-17 13:43:14 -0700 | [diff] [blame] | 244 |     ) | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 245 |     nghttp2_ex = cmake.subproject('nghttp2', options: opt_var) | 
| Ed Tanous | 211cfa4 | 2024-04-17 13:43:14 -0700 | [diff] [blame] | 246 |     nghttp2 = nghttp2_ex.dependency('nghttp2') | 
| Ed Tanous | fca2cbe | 2021-01-28 14:49:59 -0800 | [diff] [blame] | 247 | endif | 
 | 248 | bmcweb_dependencies += nghttp2 | 
 | 249 |  | 
| Patrick Williams | f57b2ec | 2025-08-11 10:53:16 -0400 | [diff] [blame] | 250 | sdbusplus = dependency('sdbusplus') | 
| Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 251 | bmcweb_dependencies += sdbusplus | 
| Aushim Nagarkatti | bd1299b | 2024-08-12 17:11:04 -0700 | [diff] [blame] | 252 |  | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 253 | cli11 = dependency('CLI11', required: false, include_type: 'system') | 
| Aushim Nagarkatti | bd1299b | 2024-08-12 17:11:04 -0700 | [diff] [blame] | 254 | if not cli11.found() | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 255 |     cli11_proj = subproject('cli11', required: true) | 
 | 256 |     cli11 = cli11_proj.get_variable('CLI11_dep') | 
 | 257 |     cli11 = cli11.as_system('system') | 
| Aushim Nagarkatti | bd1299b | 2024-08-12 17:11:04 -0700 | [diff] [blame] | 258 | endif | 
| Alexander Hansen | 8de0542 | 2025-08-06 18:47:41 +0200 | [diff] [blame] | 259 | bmcweb_dependencies += cli11 | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 260 |  | 
| Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 261 | tinyxml = dependency( | 
 | 262 |     'tinyxml2', | 
| Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 263 |     include_type: 'system', | 
| Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 264 |     version: '>=9.0.0', | 
| Konstantin Aladyshev | 60e299b | 2024-04-03 11:44:51 +0300 | [diff] [blame] | 265 |     default_options: ['tests=false'], | 
| Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 266 | ) | 
| Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 267 | if not tinyxml.found() | 
 | 268 |     tinyxml_proj = subproject('tinyxml2', required: true) | 
 | 269 |     tinyxml = tinyxml_proj.get_variable('tinyxml_dep') | 
 | 270 |     tinyxml = tinyxml.as_system('system') | 
 | 271 | endif | 
| Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 272 | bmcweb_dependencies += tinyxml | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 273 |  | 
 | 274 | systemd = dependency('systemd') | 
| Patrick Williams | 058f54e | 2024-09-03 16:07:55 -0400 | [diff] [blame] | 275 | libsystemd = dependency('libsystemd') | 
| Ed Tanous | 77dcace | 2024-09-07 16:38:05 -0700 | [diff] [blame] | 276 | add_project_arguments( | 
 | 277 |     '-DLIBSYSTEMD_VERSION=' + libsystemd.version(), | 
 | 278 |     language: 'cpp', | 
 | 279 | ) | 
| Ed Tanous | 055713e | 2024-07-17 17:19:36 -0700 | [diff] [blame] | 280 |  | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 281 | zlib = dependency('zlib') | 
| Patrick Williams | 058f54e | 2024-09-03 16:07:55 -0400 | [diff] [blame] | 282 | bmcweb_dependencies += [libsystemd, zlib] | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 283 |  | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 284 | nlohmann_json_dep = dependency( | 
 | 285 |     'nlohmann_json', | 
| Patrick Williams | 0183e47 | 2024-10-10 12:31:07 -0400 | [diff] [blame] | 286 |     version: '>=3.11.3', | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 287 |     include_type: 'system', | 
 | 288 | ) | 
| Patrick Williams | dfd5547 | 2023-12-07 11:50:37 -0600 | [diff] [blame] | 289 | bmcweb_dependencies += nlohmann_json_dep | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 290 |  | 
| Carson Labrado | 2b5b4da | 2023-10-18 00:02:10 +0000 | [diff] [blame] | 291 | boost = dependency( | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 292 |     'boost', | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 293 |     modules: ['url'], | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 294 |     version: '>=1.84.0', | 
 | 295 |     required: false, | 
| Ed Tanous | 5e2f099 | 2024-12-02 20:23:51 -0800 | [diff] [blame] | 296 |     static: true, | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 297 |     include_type: 'system', | 
| Carson Labrado | 2b5b4da | 2023-10-18 00:02:10 +0000 | [diff] [blame] | 298 | ) | 
| Jayanth Othayoth | 90fcc26 | 2024-11-11 06:24:49 -0600 | [diff] [blame] | 299 |  | 
 | 300 | # Boost version is 1.86 or higher to include the 'process' module | 
 | 301 | if boost.version().version_compare('>=1.86.0') | 
 | 302 |     boost = dependency( | 
 | 303 |         'boost', | 
 | 304 |         modules: ['url', 'process'], | 
 | 305 |         version: '>=1.86.0', | 
| Ed Tanous | 5e2f099 | 2024-12-02 20:23:51 -0800 | [diff] [blame] | 306 |         static: true, | 
| Jayanth Othayoth | 90fcc26 | 2024-11-11 06:24:49 -0600 | [diff] [blame] | 307 |         required: false, | 
 | 308 |         include_type: 'system', | 
 | 309 |     ) | 
 | 310 | endif | 
 | 311 |  | 
| Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 312 | if boost.found() | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 313 |     bmcweb_dependencies += [boost] | 
| Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 314 | else | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 315 |     cmake = import('cmake') | 
 | 316 |     opt = cmake.subproject_options() | 
| Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 317 |     boost_libs = [ | 
 | 318 |         'asio', | 
 | 319 |         'beast', | 
 | 320 |         'circular_buffer', | 
 | 321 |         'callable_traits', | 
 | 322 |         'headers', | 
 | 323 |         'process', | 
 | 324 |         'type_index', | 
 | 325 |         'url', | 
 | 326 |         'uuid', | 
 | 327 |         'spirit', | 
 | 328 |     ] | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 329 |     opt.add_cmake_defines( | 
 | 330 |         { | 
| Ed Tanous | 27f5ecf | 2025-02-09 09:46:52 -0800 | [diff] [blame] | 331 |             'CMAKE_CXX_FLAGS': ' '.join(boost_flags), | 
 | 332 |             'CMAKE_C_FLAGS': ' '.join(boost_flags), | 
| Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 333 |             'BOOST_INCLUDE_LIBRARIES': ';'.join(boost_libs), | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 334 |             'BUILD_SHARED_LIBS': 'OFF', | 
 | 335 |         }, | 
 | 336 |     ) | 
| Ed Tanous | 144983c | 2024-03-28 00:39:10 -0700 | [diff] [blame] | 337 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 338 |     boost = cmake.subproject('boost', required: true, options: opt) | 
| Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 339 |     foreach boost_lib : boost_libs | 
 | 340 |         boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system() | 
 | 341 |         bmcweb_dependencies += [boost_lib_instance] | 
 | 342 |     endforeach | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 343 | endif | 
 | 344 |  | 
| Patrick Williams | 1174aad | 2025-07-09 11:27:58 -0400 | [diff] [blame] | 345 | systemd_system_unit_dir = systemd.get_variable('systemd_system_unit_dir') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 346 |  | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 347 | bindir = get_option('prefix') + '/' + get_option('bindir') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 348 |  | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 349 | summary( | 
 | 350 |     { | 
 | 351 |         'prefix': get_option('prefix'), | 
 | 352 |         'bindir': bindir, | 
 | 353 |         'systemd unit directory': systemd_system_unit_dir, | 
 | 354 |     }, | 
 | 355 |     section: 'Directories', | 
 | 356 | ) | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 357 |  | 
| Ed Tanous | a529a6a | 2024-05-29 16:51:37 -0700 | [diff] [blame] | 358 | subdir('static') | 
 | 359 | subdir('redfish-core') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 360 |  | 
| Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 361 | # Config subdirectory | 
| Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 362 | subdir('config') | 
 | 363 | bmcweb_dependencies += conf_h_dep | 
 | 364 |  | 
| Ed Tanous | 3b28fa2 | 2024-09-23 14:51:55 -0700 | [diff] [blame] | 365 | test_sources = [] | 
 | 366 | subdir('features') | 
 | 367 |  | 
| Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 368 | # Source files | 
| Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 369 | fs = import('fs') | 
| Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 370 |  | 
| Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 371 | srcfiles_bmcweb = files( | 
| Ed Tanous | 724985f | 2024-06-05 09:19:06 -0700 | [diff] [blame] | 372 |     'http/mutual_tls.cpp', | 
| Ed Tanous | e60300a | 2025-02-23 12:31:53 -0800 | [diff] [blame] | 373 |     'http/routing/sserule.cpp', | 
| Ed Tanous | beb96b0 | 2025-02-09 09:22:46 -0800 | [diff] [blame] | 374 |     'http/routing/websocketrule.cpp', | 
| Ed Tanous | b253906 | 2024-03-12 16:58:35 -0700 | [diff] [blame] | 375 |     'http/zstd_decompressor.cpp', | 
| Ed Tanous | b26ff34 | 2024-11-22 11:47:08 -0800 | [diff] [blame] | 376 |     'redfish-core/src/dbus_log_watcher.cpp', | 
| Ed Tanous | 6c038f2 | 2025-01-14 09:46:04 -0800 | [diff] [blame] | 377 |     'redfish-core/src/error_message_utils.cpp', | 
| Patrick Williams | 2405091 | 2025-02-01 08:38:29 -0500 | [diff] [blame] | 378 |     'redfish-core/src/error_messages.cpp', | 
| Alexander Hansen | b80ba2e | 2024-11-18 12:24:35 +0100 | [diff] [blame] | 379 |     'redfish-core/src/event_log.cpp', | 
| Ed Tanous | 2185dde | 2024-11-22 11:33:51 -0800 | [diff] [blame] | 380 |     'redfish-core/src/filesystem_log_watcher.cpp', | 
| Ed Tanous | 25991f7 | 2024-06-13 18:10:25 -0700 | [diff] [blame] | 381 |     'redfish-core/src/filter_expr_executor.cpp', | 
| Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 382 |     'redfish-core/src/filter_expr_printer.cpp', | 
| Ed Tanous | a8a5bc1 | 2024-12-02 15:43:16 -0800 | [diff] [blame] | 383 |     'redfish-core/src/heartbeat_messages.cpp', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 384 |     'redfish-core/src/redfish.cpp', | 
 | 385 |     'redfish-core/src/registries.cpp', | 
| Ed Tanous | a8a5bc1 | 2024-12-02 15:43:16 -0800 | [diff] [blame] | 386 |     'redfish-core/src/resource_messages.cpp', | 
| Alexander Hansen | 02c1e29 | 2024-11-15 14:30:40 +0100 | [diff] [blame] | 387 |     'redfish-core/src/subscription.cpp', | 
| Ed Tanous | a8a5bc1 | 2024-12-02 15:43:16 -0800 | [diff] [blame] | 388 |     'redfish-core/src/task_messages.cpp', | 
| Alexander Hansen | d3616d1 | 2025-08-12 13:25:55 +0200 | [diff] [blame] | 389 |     'redfish-core/src/update_messages.cpp', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 390 |     'redfish-core/src/utils/dbus_utils.cpp', | 
 | 391 |     'redfish-core/src/utils/json_utils.cpp', | 
 | 392 |     'redfish-core/src/utils/time_utils.cpp', | 
 | 393 |     'src/boost_asio.cpp', | 
 | 394 |     'src/boost_asio_ssl.cpp', | 
 | 395 |     'src/boost_beast.cpp', | 
 | 396 |     'src/dbus_singleton.cpp', | 
| Ed Tanous | bb1c7d3 | 2025-02-09 09:39:19 -0800 | [diff] [blame] | 397 |     'src/dbus_utility.cpp', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 398 |     'src/json_html_serializer.cpp', | 
 | 399 |     'src/ossl_random.cpp', | 
| Ed Tanous | 724985f | 2024-06-05 09:19:06 -0700 | [diff] [blame] | 400 |     'src/ssl_key_handler.cpp', | 
| Alexander Hansen | 8de0542 | 2025-08-06 18:47:41 +0200 | [diff] [blame] | 401 |     'src/webserver_cli.cpp', | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 402 |     'src/webserver_run.cpp', | 
| Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 403 | ) | 
| Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 404 |  | 
| Ed Tanous | 42bbcd8 | 2023-01-07 18:04:28 -0800 | [diff] [blame] | 405 | bmcweblib = static_library( | 
| Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 406 |     'bmcweblib', | 
 | 407 |     srcfiles_bmcweb, | 
 | 408 |     include_directories: incdir, | 
 | 409 |     dependencies: bmcweb_dependencies, | 
| Ed Tanous | 42bbcd8 | 2023-01-07 18:04:28 -0800 | [diff] [blame] | 410 | ) | 
 | 411 |  | 
| Alexander Hansen | 8de0542 | 2025-08-06 18:47:41 +0200 | [diff] [blame] | 412 | # Generate the bmcweb daemon | 
| Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 413 | executable( | 
| Alexander Hansen | 8de0542 | 2025-08-06 18:47:41 +0200 | [diff] [blame] | 414 |     'bmcweb', | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 415 |     'src/webserver_main.cpp', | 
 | 416 |     include_directories: incdir, | 
 | 417 |     dependencies: bmcweb_dependencies, | 
 | 418 |     link_with: bmcweblib, | 
 | 419 |     link_args: '-Wl,--gc-sections', | 
 | 420 |     install: true, | 
| Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 421 |     install_dir: bindir, | 
| Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 422 | ) | 
 | 423 |  | 
| Alexander Hansen | d49d847 | 2025-07-21 15:30:52 +0200 | [diff] [blame] | 424 | subdir('test') |