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', |
| 13 | 'cpp_std=c++20', |
| 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 | c52ee72 | 2021-10-06 15:17:42 -0500 | [diff] [blame] | 28 | if get_option('cpp_std') != 'c++20' |
| 29 | error('This project requires c++20 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') |
| 42 | add_project_arguments(['-fdata-sections', '-ffunction-sections'], language: 'cpp') |
| 43 | add_project_arguments('-DNDEBUG', language: 'cpp') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 44 | endif |
| 45 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 46 | if (get_option('dns-resolver') == 'systemd-dbus') |
| 47 | add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp') |
Ed Tanous | f8ca6d7 | 2022-06-28 12:12:03 -0700 | [diff] [blame] | 48 | endif |
| 49 | |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 50 | # Disable lto when compiling with no optimization |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 51 | if (get_option('optimization') == '0') |
| 52 | add_project_arguments('-fno-lto', language: 'cpp') |
| 53 | message('Disabling lto & its supported features as optimization is disabled') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 54 | endif |
| 55 | |
| 56 | # Include Directories |
| 57 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 58 | incdir = include_directories('include', 'redfish-core/include', 'redfish-core/lib', 'http') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 59 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 60 | if (get_option('tests').allowed()) |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 61 | summary('unittest', 'NA', section: 'Features') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 62 | endif |
| 63 | |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 64 | # Add compiler arguments |
| 65 | |
Ed Tanous | ade3f09 | 2024-03-13 13:28:36 -0700 | [diff] [blame] | 66 | if (cxx.get_id() == 'clang') |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 67 | if (cxx.version().version_compare('<17.0')) |
| 68 | error('This project requires clang-17 or higher') |
| 69 | endif |
| 70 | add_project_arguments( |
| 71 | '-Weverything', |
| 72 | '-Wformat=2', |
| 73 | '-Wno-c++98-compat-pedantic', |
| 74 | '-Wno-c++98-compat', |
Ed Tanous | 25991f7 | 2024-06-13 18:10:25 -0700 | [diff] [blame] | 75 | '-Wno-c++20-extensions', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 76 | '-Wno-documentation-unknown-command', |
| 77 | '-Wno-documentation', |
| 78 | '-Wno-exit-time-destructors', |
| 79 | '-Wno-global-constructors', |
| 80 | '-Wno-newline-eof', |
| 81 | '-Wno-padded', |
| 82 | '-Wno-shadow', |
| 83 | '-Wno-used-but-marked-unused', |
| 84 | '-Wno-weak-vtables', |
| 85 | '-Wno-switch-enum', |
| 86 | '-Wno-unused-macros', |
| 87 | '-Wno-covered-switch-default', |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 88 | '-Wno-disabled-macro-expansion', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 89 | language: 'cpp', |
| 90 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 91 | endif |
| 92 | |
Ed Tanous | ade3f09 | 2024-03-13 13:28:36 -0700 | [diff] [blame] | 93 | if (cxx.get_id() == 'gcc') |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 94 | if (cxx.version().version_compare('<13.0')) |
| 95 | error('This project requires gcc-13 or higher') |
| 96 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 97 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 98 | add_project_arguments( |
| 99 | '-Wformat=2', |
| 100 | '-Wcast-align', |
| 101 | '-Wconversion', |
| 102 | '-Woverloaded-virtual', |
| 103 | '-Wsign-conversion', |
| 104 | '-Wunused', |
| 105 | '-Wduplicated-cond', |
| 106 | '-Wduplicated-branches', |
| 107 | '-Wlogical-op', |
| 108 | '-Wnull-dereference', |
| 109 | '-Wunused-parameter', |
| 110 | '-Wdouble-promotion', |
| 111 | '-Wshadow', |
| 112 | '-Wno-psabi', |
| 113 | '-Wno-attributes', |
| 114 | language: 'cpp', |
| 115 | ) |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 116 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 117 | |
Ed Tanous | c66403c | 2021-09-22 15:28:57 -0700 | [diff] [blame] | 118 | if (get_option('buildtype') != 'plain') |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 119 | if (get_option('b_lto') == true and get_option('optimization') != '0') |
| 120 | # Reduce the binary size by removing unnecessary |
| 121 | # dynamic symbol table entries |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 122 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 123 | add_project_arguments( |
| 124 | cxx.get_supported_arguments( |
| 125 | [ |
| 126 | '-fno-fat-lto-objects', |
| 127 | '-fvisibility=hidden', |
| 128 | '-fvisibility-inlines-hidden', |
| 129 | ], |
| 130 | ), |
| 131 | language: 'cpp', |
| 132 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 133 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 134 | if cxx.has_link_argument('-Wl,--exclude-libs,ALL') |
| 135 | add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp') |
| 136 | endif |
George Liu | e820493 | 2021-02-01 14:42:49 +0800 | [diff] [blame] | 137 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 138 | endif |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 139 | # Set Compiler Security flags |
| 140 | |
| 141 | security_flags = [ |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 142 | '-fstack-protector-strong', |
| 143 | '-fPIE', |
| 144 | '-fPIC', |
| 145 | '-D_FORTIFY_SOURCE=2', |
| 146 | '-Wformat', |
| 147 | '-Wformat-security', |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 148 | ] |
| 149 | |
| 150 | ## Add security flags for builds of type 'release','debugoptimized' and 'minsize' |
| 151 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 152 | if not ( |
| 153 | get_option('buildtype') == 'plain' |
| 154 | or get_option('buildtype').startswith('debug') |
| 155 | ) |
| 156 | add_project_arguments(cxx.get_supported_arguments([security_flags]), language: 'cpp') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 157 | endif |
| 158 | |
| 159 | # Boost dependency configuration |
| 160 | |
| 161 | add_project_arguments( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 162 | cxx.get_supported_arguments( |
| 163 | [ |
| 164 | '-DBOOST_ASIO_DISABLE_CONCEPTS', |
| 165 | '-DBOOST_ALL_NO_LIB', |
| 166 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
| 167 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 168 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 169 | '-DBOOST_ASIO_SEPARATE_COMPILATION', |
| 170 | '-DBOOST_BEAST_SEPARATE_COMPILATION', |
| 171 | '-DBOOST_EXCEPTION_DISABLE', |
| 172 | '-DBOOST_NO_EXCEPTIONS', |
| 173 | '-DBOOST_URL_NO_SOURCE_LOCATION', |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 174 | '-DBOOST_SPIRIT_X3_NO_RTTI', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 175 | '-DJSON_NOEXCEPTION', |
| 176 | '-DOPENSSL_NO_FILENAMES', |
| 177 | '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES', |
| 178 | ], |
| 179 | ), |
| 180 | language: 'cpp', |
| 181 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 182 | |
| 183 | # Find the dependency modules, if not found use meson wrap to get them |
| 184 | # automatically during the configure step |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 185 | bmcweb_dependencies = [] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 186 | |
Nan Zhou | 8682c5a | 2021-11-13 11:00:07 -0800 | [diff] [blame] | 187 | pam = cxx.find_library('pam', required: true) |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 188 | atomic = cxx.find_library('atomic', required: true) |
Ed Tanous | e792399 | 2023-12-03 14:14:02 -0800 | [diff] [blame] | 189 | bmcweb_dependencies += [pam, atomic] |
| 190 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 191 | openssl = dependency('openssl', required: false, version: '>=3.0.0') |
Ed Tanous | e792399 | 2023-12-03 14:14:02 -0800 | [diff] [blame] | 192 | if not openssl.found() or get_option('b_sanitize') != 'none' |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 193 | openssl_proj = subproject( |
| 194 | 'openssl', |
| 195 | required: true, |
| 196 | default_options: ['warning_level=0', 'werror=false'], |
| 197 | ) |
| 198 | openssl = openssl_proj.get_variable('openssl_dep') |
| 199 | openssl = openssl.as_system('system') |
Ed Tanous | e792399 | 2023-12-03 14:14:02 -0800 | [diff] [blame] | 200 | endif |
| 201 | bmcweb_dependencies += [openssl] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 202 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 203 | nghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false) |
Ed Tanous | fca2cbe | 2021-01-28 14:49:59 -0800 | [diff] [blame] | 204 | if not nghttp2.found() |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 205 | cmake = import('cmake') |
| 206 | opt_var = cmake.subproject_options() |
Ed Tanous | 211cfa4 | 2024-04-17 13:43:14 -0700 | [diff] [blame] | 207 | opt_var.add_cmake_defines( |
| 208 | { |
| 209 | 'ENABLE_LIB_ONLY': true, |
| 210 | 'ENABLE_STATIC_LIB': true, |
| 211 | }, |
| 212 | ) |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 213 | nghttp2_ex = cmake.subproject('nghttp2', options: opt_var) |
Ed Tanous | 211cfa4 | 2024-04-17 13:43:14 -0700 | [diff] [blame] | 214 | nghttp2 = nghttp2_ex.dependency('nghttp2') |
Ed Tanous | fca2cbe | 2021-01-28 14:49:59 -0800 | [diff] [blame] | 215 | endif |
| 216 | bmcweb_dependencies += nghttp2 |
| 217 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 218 | sdbusplus = dependency('sdbusplus', required: false, include_type: 'system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 219 | if not sdbusplus.found() |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 220 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 221 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 222 | sdbusplus = sdbusplus.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 223 | endif |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 224 | bmcweb_dependencies += sdbusplus |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 225 | |
Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 226 | tinyxml = dependency( |
| 227 | 'tinyxml2', |
Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 228 | include_type: 'system', |
Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 229 | version: '>=9.0.0', |
Konstantin Aladyshev | 60e299b | 2024-04-03 11:44:51 +0300 | [diff] [blame] | 230 | default_options: ['tests=false'], |
Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 231 | ) |
Ed Tanous | c9374ff | 2023-05-26 09:42:08 -0700 | [diff] [blame] | 232 | if not tinyxml.found() |
| 233 | tinyxml_proj = subproject('tinyxml2', required: true) |
| 234 | tinyxml = tinyxml_proj.get_variable('tinyxml_dep') |
| 235 | tinyxml = tinyxml.as_system('system') |
| 236 | endif |
Cody Smith | 3a097b2 | 2022-05-19 14:22:32 -0700 | [diff] [blame] | 237 | bmcweb_dependencies += tinyxml |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 238 | |
| 239 | systemd = dependency('systemd') |
| 240 | zlib = dependency('zlib') |
Jason M. Bills | ceb8ddc | 2020-11-23 14:38:39 -0800 | [diff] [blame] | 241 | bmcweb_dependencies += [systemd, zlib] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 242 | |
Patrick Williams | dfd5547 | 2023-12-07 11:50:37 -0600 | [diff] [blame] | 243 | nlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system') |
| 244 | bmcweb_dependencies += nlohmann_json_dep |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 245 | |
Carson Labrado | 2b5b4da | 2023-10-18 00:02:10 +0000 | [diff] [blame] | 246 | boost = dependency( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 247 | 'boost', |
| 248 | modules: [ |
| 249 | 'url', |
Carson Labrado | 2b5b4da | 2023-10-18 00:02:10 +0000 | [diff] [blame] | 250 | ], |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 251 | version: '>=1.84.0', |
| 252 | required: false, |
| 253 | include_type: 'system', |
Carson Labrado | 2b5b4da | 2023-10-18 00:02:10 +0000 | [diff] [blame] | 254 | ) |
Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 255 | if boost.found() |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 256 | bmcweb_dependencies += [boost] |
Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 257 | else |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 258 | cmake = import('cmake') |
| 259 | opt = cmake.subproject_options() |
| 260 | opt.add_cmake_defines( |
| 261 | { |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 262 | 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid;spirit', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 263 | 'BUILD_SHARED_LIBS': 'OFF', |
| 264 | }, |
| 265 | ) |
Ed Tanous | 144983c | 2024-03-28 00:39:10 -0700 | [diff] [blame] | 266 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 267 | boost = cmake.subproject('boost', required: true, options: opt) |
| 268 | boost_asio = boost.dependency('boost_asio').as_system() |
| 269 | boost_beast = boost.dependency('boost_beast').as_system() |
| 270 | boost_callable_traits = boost.dependency('boost_callable_traits').as_system() |
| 271 | boost_headers = boost.dependency('boost_headers').as_system() |
| 272 | boost_process = boost.dependency('boost_process').as_system() |
| 273 | boost_type_index = boost.dependency('boost_type_index').as_system() |
| 274 | boost_url = boost.dependency('boost_url').as_system() |
| 275 | boost_uuid = boost.dependency('boost_uuid').as_system() |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 276 | boost_spirit = boost.dependency('boost_spirit').as_system() |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 277 | bmcweb_dependencies += [ |
| 278 | boost_asio, |
| 279 | boost_beast, |
| 280 | boost_callable_traits, |
| 281 | boost_headers, |
| 282 | boost_process, |
| 283 | boost_type_index, |
| 284 | boost_url, |
| 285 | boost_uuid, |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 286 | boost_spirit, |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 287 | ] |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 288 | endif |
| 289 | |
Patrick Williams | 549bed2 | 2023-11-29 06:45:06 -0600 | [diff] [blame] | 290 | if get_option('tests').allowed() |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 291 | gtest = dependency( |
| 292 | 'gtest', |
| 293 | main: true, |
| 294 | version: '>=1.14.0', |
| 295 | disabler: true, |
| 296 | required: false, |
| 297 | ) |
| 298 | gmock = dependency('gmock', required: false) |
| 299 | if not gtest.found() and get_option('tests').allowed() |
| 300 | gtest_proj = subproject('gtest', required: true) |
| 301 | gtest = gtest_proj.get_variable('gtest_main_dep') |
| 302 | gmock = gtest_proj.get_variable('gmock_dep') |
| 303 | endif |
| 304 | gtest = gtest.as_system('system') |
| 305 | gmock = gmock.as_system('system') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 306 | endif |
| 307 | |
Patrick Williams | 4efe3e0 | 2023-04-12 08:05:58 -0500 | [diff] [blame] | 308 | systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 309 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 310 | bindir = get_option('prefix') + '/' + get_option('bindir') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 311 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 312 | summary( |
| 313 | { |
| 314 | 'prefix': get_option('prefix'), |
| 315 | 'bindir': bindir, |
| 316 | 'systemd unit directory': systemd_system_unit_dir, |
| 317 | }, |
| 318 | section: 'Directories', |
| 319 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 320 | |
Ed Tanous | a529a6a | 2024-05-29 16:51:37 -0700 | [diff] [blame] | 321 | subdir('static') |
| 322 | subdir('redfish-core') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 323 | |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 324 | # Config subdirectory |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 325 | subdir('config') |
| 326 | bmcweb_dependencies += conf_h_dep |
| 327 | |
Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 328 | # Source files |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 329 | fs = import('fs') |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 330 | |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 331 | srcfiles_bmcweb = files( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 332 | # end large files |
Ed Tanous | 3cd7072 | 2024-04-06 09:24:01 -0700 | [diff] [blame] | 333 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 334 | 'redfish-core/src/error_messages.cpp', |
| 335 | # Begin large files, should be at the beginning |
Ed Tanous | 25991f7 | 2024-06-13 18:10:25 -0700 | [diff] [blame] | 336 | 'redfish-core/src/filter_expr_executor.cpp', |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 337 | 'redfish-core/src/filter_expr_printer.cpp', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 338 | 'redfish-core/src/redfish.cpp', |
| 339 | 'redfish-core/src/registries.cpp', |
| 340 | 'redfish-core/src/utils/dbus_utils.cpp', |
| 341 | 'redfish-core/src/utils/json_utils.cpp', |
| 342 | 'redfish-core/src/utils/time_utils.cpp', |
| 343 | 'src/boost_asio.cpp', |
| 344 | 'src/boost_asio_ssl.cpp', |
| 345 | 'src/boost_beast.cpp', |
| 346 | 'src/dbus_singleton.cpp', |
| 347 | 'src/json_html_serializer.cpp', |
| 348 | 'src/ossl_random.cpp', |
| 349 | 'src/webserver_run.cpp', |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 350 | ) |
Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 351 | |
Ed Tanous | 42bbcd8 | 2023-01-07 18:04:28 -0800 | [diff] [blame] | 352 | bmcweblib = static_library( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 353 | 'bmcweblib', |
| 354 | srcfiles_bmcweb, |
| 355 | include_directories: incdir, |
| 356 | dependencies: bmcweb_dependencies, |
Ed Tanous | 42bbcd8 | 2023-01-07 18:04:28 -0800 | [diff] [blame] | 357 | ) |
| 358 | |
Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 359 | # Generate the bmcweb executable |
| 360 | executable( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 361 | 'bmcweb', |
| 362 | 'src/webserver_main.cpp', |
| 363 | include_directories: incdir, |
| 364 | dependencies: bmcweb_dependencies, |
| 365 | link_with: bmcweblib, |
| 366 | link_args: '-Wl,--gc-sections', |
| 367 | install: true, |
| 368 | install_dir: bindir, |
Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 369 | ) |
| 370 | |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 371 | srcfiles_unittest = files( |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 372 | 'test/http/crow_getroutes_test.cpp', |
| 373 | 'test/http/http2_connection_test.cpp', |
| 374 | 'test/http/http_body_test.cpp', |
| 375 | 'test/http/http_connection_test.cpp', |
| 376 | 'test/http/http_response_test.cpp', |
| 377 | 'test/http/mutual_tls.cpp', |
| 378 | 'test/http/mutual_tls_meta.cpp', |
| 379 | 'test/http/parsing_test.cpp', |
| 380 | 'test/http/router_test.cpp', |
| 381 | 'test/http/server_sent_event_test.cpp', |
| 382 | 'test/http/utility_test.cpp', |
| 383 | 'test/http/verb_test.cpp', |
| 384 | 'test/include/async_resolve_test.cpp', |
| 385 | 'test/include/credential_pipe_test.cpp', |
| 386 | 'test/include/dbus_utility_test.cpp', |
| 387 | 'test/include/google/google_service_root_test.cpp', |
| 388 | 'test/include/http_utility_test.cpp', |
| 389 | 'test/include/human_sort_test.cpp', |
| 390 | 'test/include/ibm/configfile_test.cpp', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 391 | 'test/include/json_html_serializer.cpp', |
| 392 | 'test/include/multipart_test.cpp', |
| 393 | 'test/include/openbmc_dbus_rest_test.cpp', |
| 394 | 'test/include/ossl_random.cpp', |
Ed Tanous | 099225c | 2024-03-27 22:03:05 -0700 | [diff] [blame] | 395 | 'test/include/ssl_key_handler_test.cpp', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 396 | 'test/include/str_utility_test.cpp', |
| 397 | 'test/redfish-core/include/privileges_test.cpp', |
Ed Tanous | 25991f7 | 2024-06-13 18:10:25 -0700 | [diff] [blame] | 398 | 'test/redfish-core/include/filter_expr_executor_test.cpp', |
Ed Tanous | f88b217 | 2022-04-15 13:55:05 -0700 | [diff] [blame] | 399 | 'test/redfish-core/include/filter_expr_parser_test.cpp', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 400 | 'test/redfish-core/include/redfish_aggregator_test.cpp', |
| 401 | 'test/redfish-core/include/registries_test.cpp', |
| 402 | 'test/redfish-core/include/utils/dbus_utils.cpp', |
| 403 | 'test/redfish-core/include/utils/hex_utils_test.cpp', |
| 404 | 'test/redfish-core/include/utils/ip_utils_test.cpp', |
| 405 | 'test/redfish-core/include/utils/json_utils_test.cpp', |
| 406 | 'test/redfish-core/include/utils/query_param_test.cpp', |
| 407 | 'test/redfish-core/include/utils/stl_utils_test.cpp', |
| 408 | 'test/redfish-core/include/utils/time_utils_test.cpp', |
| 409 | 'test/redfish-core/lib/chassis_test.cpp', |
| 410 | 'test/redfish-core/lib/log_services_dump_test.cpp', |
| 411 | 'test/redfish-core/lib/log_services_test.cpp', |
| 412 | 'test/redfish-core/lib/manager_diagnostic_data_test.cpp', |
Ed Tanous | 090ab8e | 2024-05-18 16:07:23 -0700 | [diff] [blame] | 413 | 'test/redfish-core/lib/metadata_test.cpp', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 414 | 'test/redfish-core/lib/power_subsystem_test.cpp', |
| 415 | 'test/redfish-core/lib/sensors_test.cpp', |
| 416 | 'test/redfish-core/lib/service_root_test.cpp', |
| 417 | 'test/redfish-core/lib/system_test.cpp', |
| 418 | 'test/redfish-core/lib/thermal_subsystem_test.cpp', |
| 419 | 'test/redfish-core/lib/update_service_test.cpp', |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 420 | ) |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 421 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 422 | if (get_option('tests').allowed()) |
Ed Tanous | 02f1cd9 | 2021-10-27 12:09:06 -0700 | [diff] [blame] | 423 | # generate the test executable |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 424 | foreach test_src : srcfiles_unittest |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 425 | test_bin = executable( |
| 426 | fs.stem(test_src), |
| 427 | test_src, |
| 428 | link_with: bmcweblib, |
| 429 | include_directories: incdir, |
| 430 | install_dir: bindir, |
| 431 | dependencies: bmcweb_dependencies |
| 432 | + [ |
| 433 | gtest, |
| 434 | gmock, |
| 435 | ], |
| 436 | ) |
| 437 | test(fs.stem(test_src), test_bin) |
Nan Zhou | 0ad63df | 2022-10-17 23:03:21 +0000 | [diff] [blame] | 438 | endforeach |
Manojkiran Eda | af6298d | 2020-05-27 08:51:32 +0530 | [diff] [blame] | 439 | endif |