xref: /openbmc/bmcweb/meson.build (revision bd1299b74c25fa6123cab497d4b8370689a7a999)
1f2caadceSEd Tanousproject(
2f2caadceSEd Tanous    'bmcweb',
3f2caadceSEd Tanous    'cpp',
4af6298daSManojkiran Eda    version: '1.0',
58dc3ddf6SEd Tanous    meson_version: '>=1.3.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',
13921cfcd1SPatrick Williams        'cpp_std=c++23',
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
28921cfcd1SPatrick Williamsif get_option('cpp_std') != 'c++23'
29921cfcd1SPatrick Williams    error('This project requires c++23 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')
59*bd1299b7SAushim Nagarkattiincdir_cli = include_directories(
60*bd1299b7SAushim Nagarkatti  'http',
61*bd1299b7SAushim Nagarkatti  'include'
62*bd1299b7SAushim Nagarkatti)
63af6298daSManojkiran Eda
64549bed29SPatrick Williamsif (get_option('tests').allowed())
6525b54dbaSEd Tanous    summary('unittest', 'NA', section: 'Features')
66af6298daSManojkiran Edaendif
67af6298daSManojkiran Eda
68af6298daSManojkiran Eda# Add compiler arguments
69af6298daSManojkiran Eda
70ade3f093SEd Tanousif (cxx.get_id() == 'clang')
71ade3f093SEd Tanous    if (cxx.version().version_compare('<17.0'))
72ade3f093SEd Tanous        error('This project requires clang-17 or higher')
73ade3f093SEd Tanous    endif
74af6298daSManojkiran Eda    add_project_arguments(
75af6298daSManojkiran Eda        '-Weverything',
76ade3f093SEd Tanous        '-Wformat=2',
77af6298daSManojkiran Eda        '-Wno-c++98-compat-pedantic',
78f523c324SEd Tanous        '-Wno-c++98-compat',
7925991f7dSEd Tanous        '-Wno-c++20-extensions',
80f523c324SEd Tanous        '-Wno-documentation-unknown-command',
81f523c324SEd Tanous        '-Wno-documentation',
82af6298daSManojkiran Eda        '-Wno-exit-time-destructors',
83f523c324SEd Tanous        '-Wno-global-constructors',
84f523c324SEd Tanous        '-Wno-newline-eof',
85f523c324SEd Tanous        '-Wno-padded',
86af6298daSManojkiran Eda        '-Wno-shadow',
87af6298daSManojkiran Eda        '-Wno-used-but-marked-unused',
88af6298daSManojkiran Eda        '-Wno-weak-vtables',
89e6801eb4SEd Tanous        '-Wno-switch-enum',
9072b90760SEd Tanous        '-Wno-unused-macros',
914da0490bSEd Tanous        '-Wno-covered-switch-default',
92f88b2170SEd Tanous        '-Wno-disabled-macro-expansion',
93724985ffSEd Tanous        '-Wno-unneeded-internal-declaration',
94f2caadceSEd Tanous        language: 'cpp',
95f2caadceSEd Tanous    )
96af6298daSManojkiran Edaendif
97af6298daSManojkiran Eda
98ade3f093SEd Tanousif (cxx.get_id() == 'gcc')
99ade3f093SEd Tanous    if (cxx.version().version_compare('<13.0'))
100ade3f093SEd Tanous        error('This project requires gcc-13 or higher')
101ade3f093SEd Tanous    endif
102af6298daSManojkiran Eda
103af6298daSManojkiran Eda    add_project_arguments(
104ade3f093SEd Tanous        '-Wformat=2',
105ade3f093SEd Tanous        '-Wcast-align',
106ade3f093SEd Tanous        '-Wconversion',
107ade3f093SEd Tanous        '-Woverloaded-virtual',
108ade3f093SEd Tanous        '-Wsign-conversion',
109ade3f093SEd Tanous        '-Wunused',
110af6298daSManojkiran Eda        '-Wduplicated-cond',
111af6298daSManojkiran Eda        '-Wduplicated-branches',
112af6298daSManojkiran Eda        '-Wlogical-op',
113af6298daSManojkiran Eda        '-Wnull-dereference',
114079360aeSEd Tanous        '-Wunused-parameter',
115af6298daSManojkiran Eda        '-Wdouble-promotion',
1168a592810SEd Tanous        '-Wshadow',
11730f11eb4SEd Tanous        '-Wno-psabi',
118ade3f093SEd Tanous        '-Wno-attributes',
119f2caadceSEd Tanous        language: 'cpp',
120f2caadceSEd Tanous    )
121c66403c3SEd Tanousendif
122af6298daSManojkiran Eda
123af6298daSManojkiran Edaif (get_option('buildtype') != 'plain')
124af6298daSManojkiran Eda    if (get_option('b_lto') == true and get_option('optimization') != '0')
125af6298daSManojkiran Eda        # Reduce the binary size by removing unnecessary
126af6298daSManojkiran Eda        # dynamic symbol table entries
127af6298daSManojkiran Eda
128af6298daSManojkiran Eda        add_project_arguments(
129f2caadceSEd Tanous            cxx.get_supported_arguments(
130f2caadceSEd Tanous                [
131af6298daSManojkiran Eda                    '-fno-fat-lto-objects',
132af6298daSManojkiran Eda                    '-fvisibility=hidden',
133f2caadceSEd Tanous                    '-fvisibility-inlines-hidden',
134f2caadceSEd Tanous                ],
135f2caadceSEd Tanous            ),
136f2caadceSEd Tanous            language: 'cpp',
137f2caadceSEd Tanous        )
138af6298daSManojkiran Eda
139af6298daSManojkiran Eda        if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
140af6298daSManojkiran Eda            add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
141af6298daSManojkiran Eda        endif
142af6298daSManojkiran Eda    endif
143c66403c3SEd Tanousendif
144af6298daSManojkiran Eda# Set Compiler Security flags
145af6298daSManojkiran Eda
146af6298daSManojkiran Edasecurity_flags = [
147af6298daSManojkiran Eda    '-fstack-protector-strong',
148af6298daSManojkiran Eda    '-fPIE',
149af6298daSManojkiran Eda    '-fPIC',
150af6298daSManojkiran Eda    '-D_FORTIFY_SOURCE=2',
151af6298daSManojkiran Eda    '-Wformat',
152f2caadceSEd Tanous    '-Wformat-security',
153af6298daSManojkiran Eda]
154af6298daSManojkiran Eda
155af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
156af6298daSManojkiran Eda
157f2caadceSEd Tanousif not (
158f2caadceSEd Tanous    get_option('buildtype') == 'plain'
159f2caadceSEd Tanous    or get_option('buildtype').startswith('debug')
160f2caadceSEd Tanous)
161f2caadceSEd Tanous    add_project_arguments(cxx.get_supported_arguments([security_flags]), language: 'cpp')
162af6298daSManojkiran Edaendif
163af6298daSManojkiran Eda
164af6298daSManojkiran Eda# Boost dependency configuration
165af6298daSManojkiran Eda
166af6298daSManojkiran Edaadd_project_arguments(
167f2caadceSEd Tanous    cxx.get_supported_arguments(
168f2caadceSEd Tanous        [
1696fd29553SEd Tanous            '-DBOOST_ASIO_DISABLE_CONCEPTS',
170af6298daSManojkiran Eda            '-DBOOST_ALL_NO_LIB',
17158e42b18SEd Tanous            '-DBOOST_ALLOW_DEPRECATED_HEADERS',
172f523c324SEd Tanous            '-DBOOST_ASIO_DISABLE_THREADS',
173f523c324SEd Tanous            '-DBOOST_ASIO_NO_DEPRECATED',
174f523c324SEd Tanous            '-DBOOST_ASIO_SEPARATE_COMPILATION',
175f523c324SEd Tanous            '-DBOOST_BEAST_SEPARATE_COMPILATION',
1769e710e7fSEd Tanous            '-DBOOST_EXCEPTION_DISABLE',
177f706551dSEd Tanous            '-DBOOST_NO_EXCEPTIONS',
178ab6b6fecSEd Tanous            '-DBOOST_URL_NO_SOURCE_LOCATION',
179f88b2170SEd Tanous            '-DBOOST_SPIRIT_X3_NO_RTTI',
1809e710e7fSEd Tanous            '-DJSON_NOEXCEPTION',
181209aa909SEd Tanous            '-DOPENSSL_NO_FILENAMES',
182f706551dSEd Tanous            '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
183f2caadceSEd Tanous        ],
184f2caadceSEd Tanous    ),
185f2caadceSEd Tanous    language: 'cpp',
186f2caadceSEd Tanous)
187af6298daSManojkiran Eda
188af6298daSManojkiran Eda# Find the dependency modules, if not found use meson wrap to get them
189af6298daSManojkiran Eda# automatically during the configure step
190ceb8ddc1SJason M. Billsbmcweb_dependencies = []
191*bd1299b7SAushim Nagarkattibmcweb_cli_dependencies = []
192af6298daSManojkiran Eda
1938682c5adSNan Zhoupam = cxx.find_library('pam', required: true)
194af6298daSManojkiran Edaatomic = cxx.find_library('atomic', required: true)
195e7923997SEd Tanousbmcweb_dependencies += [pam, atomic]
196e7923997SEd Tanous
197e7923997SEd Tanousopenssl = dependency('openssl', required: false, version: '>=3.0.0')
198e7923997SEd Tanousif not openssl.found() or get_option('b_sanitize') != 'none'
199e7923997SEd Tanous    openssl_proj = subproject(
200e7923997SEd Tanous        'openssl',
201e7923997SEd Tanous        required: true,
202f2caadceSEd Tanous        default_options: ['warning_level=0', 'werror=false'],
203e7923997SEd Tanous    )
204e7923997SEd Tanous    openssl = openssl_proj.get_variable('openssl_dep')
205e7923997SEd Tanous    openssl = openssl.as_system('system')
206e7923997SEd Tanousendif
207e7923997SEd Tanousbmcweb_dependencies += [openssl]
208af6298daSManojkiran Eda
209fca2cbeaSEd Tanousnghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false)
210fca2cbeaSEd Tanousif not nghttp2.found()
211fca2cbeaSEd Tanous    cmake = import('cmake')
212fca2cbeaSEd Tanous    opt_var = cmake.subproject_options()
213211cfa49SEd Tanous    opt_var.add_cmake_defines(
214211cfa49SEd Tanous        {
215211cfa49SEd Tanous            'ENABLE_LIB_ONLY': true,
216211cfa49SEd Tanous            'ENABLE_STATIC_LIB': true,
217211cfa49SEd Tanous        },
218211cfa49SEd Tanous    )
219fca2cbeaSEd Tanous    nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
220211cfa49SEd Tanous    nghttp2 = nghttp2_ex.dependency('nghttp2')
221fca2cbeaSEd Tanousendif
222fca2cbeaSEd Tanousbmcweb_dependencies += nghttp2
223fca2cbeaSEd Tanous
2247bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
225af6298daSManojkiran Edaif not sdbusplus.found()
226af6298daSManojkiran Eda    sdbusplus_proj = subproject('sdbusplus', required: true)
227af6298daSManojkiran Eda    sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
228af6298daSManojkiran Eda    sdbusplus = sdbusplus.as_system('system')
229af6298daSManojkiran Edaendif
230ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus
231*bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += sdbusplus
232*bd1299b7SAushim Nagarkatti
233*bd1299b7SAushim Nagarkatticli11 = dependency('CLI11', required : false, include_type: 'system')
234*bd1299b7SAushim Nagarkattiif not cli11.found()
235*bd1299b7SAushim Nagarkatti  cli11_proj = subproject('cli11', required: true)
236*bd1299b7SAushim Nagarkatti  cli11 = cli11_proj.get_variable('CLI11_dep')
237*bd1299b7SAushim Nagarkatti  cli11 = cli11.as_system('system')
238*bd1299b7SAushim Nagarkattiendif
239*bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += cli11
240*bd1299b7SAushim Nagarkatti
241af6298daSManojkiran Eda
242c9374ff6SEd Tanoustinyxml = dependency(
243c9374ff6SEd Tanous    'tinyxml2',
244565c0911SPatrick Williams    include_type: 'system',
245c9374ff6SEd Tanous    version: '>=9.0.0',
24660e299bdSKonstantin Aladyshev    default_options: ['tests=false'],
247565c0911SPatrick Williams)
248c9374ff6SEd Tanousif not tinyxml.found()
249c9374ff6SEd Tanous    tinyxml_proj = subproject('tinyxml2', required: true)
250c9374ff6SEd Tanous    tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
251c9374ff6SEd Tanous    tinyxml = tinyxml.as_system('system')
252c9374ff6SEd Tanousendif
253ceb8ddc1SJason M. Billsbmcweb_dependencies += tinyxml
254af6298daSManojkiran Eda
255af6298daSManojkiran Edasystemd = dependency('systemd')
256055713e4SEd Tanousadd_project_arguments('-DSYSTEMD_VERSION=' + systemd.version(), language: 'cpp')
257055713e4SEd Tanous
258af6298daSManojkiran Edazlib = dependency('zlib')
259ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib]
260af6298daSManojkiran Eda
261dfd5547bSPatrick Williamsnlohmann_json_dep = dependency('nlohmann_json', version: '>=3.11.2', include_type: 'system')
262dfd5547bSPatrick Williamsbmcweb_dependencies += nlohmann_json_dep
263af6298daSManojkiran Eda
2642b5b4daeSCarson Labradoboost = dependency(
2652b5b4daeSCarson Labrado    'boost',
2662b5b4daeSCarson Labrado    modules: [
2672b5b4daeSCarson Labrado        'url',
2682b5b4daeSCarson Labrado    ],
269619b8609SEd Tanous    version: '>=1.84.0',
2702b5b4daeSCarson Labrado    required: false,
271f2caadceSEd Tanous    include_type: 'system',
2722b5b4daeSCarson Labrado)
2736fd29553SEd Tanousif boost.found()
2746fd29553SEd Tanous  bmcweb_dependencies += [boost]
275*bd1299b7SAushim Nagarkatti  bmcweb_cli_dependencies += [boost]
2766fd29553SEd Tanouselse
2776fd29553SEd Tanous    cmake = import('cmake')
2786fd29553SEd Tanous    opt = cmake.subproject_options()
279f80a87f2SEd Tanous    boost_libs = [
280f80a87f2SEd Tanous        'asio',
281f80a87f2SEd Tanous        'beast',
282f80a87f2SEd Tanous        'circular_buffer',
283f80a87f2SEd Tanous        'callable_traits',
284f80a87f2SEd Tanous        'headers',
285f80a87f2SEd Tanous        'process',
286f80a87f2SEd Tanous        'type_index',
287f80a87f2SEd Tanous        'url',
288f80a87f2SEd Tanous        'uuid',
289f80a87f2SEd Tanous        'spirit',
290f80a87f2SEd Tanous    ]
291f2caadceSEd Tanous    opt.add_cmake_defines(
292f2caadceSEd Tanous        {
2934ed30a8bSEd Tanous            # 1.86.0 fails this.  Hopefully fixed in 1.86.1
2944ed30a8bSEd Tanous            'CMAKE_CXX_FLAGS': '-Wno-unused-parameter',
295f80a87f2SEd Tanous            'BOOST_INCLUDE_LIBRARIES': ';'.join(boost_libs),
296144983c5SEd Tanous            'BUILD_SHARED_LIBS': 'OFF',
297f2caadceSEd Tanous        },
298f2caadceSEd Tanous    )
299144983c5SEd Tanous
3006fd29553SEd Tanous    boost = cmake.subproject('boost', required: true, options: opt)
301f80a87f2SEd Tanous    foreach boost_lib : boost_libs
302f80a87f2SEd Tanous        boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system()
303f80a87f2SEd Tanous        bmcweb_dependencies += [boost_lib_instance]
304*bd1299b7SAushim Nagarkatti        bmcweb_cli_dependencies += [boost_lib_instance]
305f80a87f2SEd Tanous    endforeach
306af6298daSManojkiran Edaendif
307af6298daSManojkiran Eda
308549bed29SPatrick Williamsif get_option('tests').allowed()
309f2caadceSEd Tanous    gtest = dependency(
310f2caadceSEd Tanous        'gtest',
311f2caadceSEd Tanous        main: true,
312f2caadceSEd Tanous        version: '>=1.14.0',
313f2caadceSEd Tanous        disabler: true,
314f2caadceSEd Tanous        required: false,
315f2caadceSEd Tanous    )
316af6298daSManojkiran Eda    gmock = dependency('gmock', required: false)
317549bed29SPatrick Williams    if not gtest.found() and get_option('tests').allowed()
318af6298daSManojkiran Eda        gtest_proj = subproject('gtest', required: true)
319af6298daSManojkiran Eda        gtest = gtest_proj.get_variable('gtest_main_dep')
320af6298daSManojkiran Eda        gmock = gtest_proj.get_variable('gmock_dep')
321af6298daSManojkiran Eda    endif
322b00dcc27SEd Tanous    gtest = gtest.as_system('system')
323b00dcc27SEd Tanous    gmock = gmock.as_system('system')
324af6298daSManojkiran Edaendif
325af6298daSManojkiran Eda
3264efe3e0cSPatrick Williamssystemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
327af6298daSManojkiran Eda
328af6298daSManojkiran Edabindir = get_option('prefix') + '/' +get_option('bindir')
329*bd1299b7SAushim Nagarkattilibexec = get_option('prefix') + '/' + get_option('libexecdir')
330af6298daSManojkiran Eda
331f2caadceSEd Tanoussummary(
332f2caadceSEd Tanous    {
333af6298daSManojkiran Eda        'prefix': get_option('prefix'),
334af6298daSManojkiran Eda        'bindir': bindir,
335f2caadceSEd Tanous        'systemd unit directory': systemd_system_unit_dir,
336f2caadceSEd Tanous    },
337f2caadceSEd Tanous    section: 'Directories',
338f2caadceSEd Tanous)
339af6298daSManojkiran Eda
340a529a6aaSEd Tanoussubdir('static')
341a529a6aaSEd Tanoussubdir('redfish-core')
342af6298daSManojkiran Eda
343307386e8SNan Zhou# Config subdirectory
344307386e8SNan Zhousubdir('config')
345307386e8SNan Zhoubmcweb_dependencies += conf_h_dep
346*bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += conf_h_dep
347307386e8SNan Zhou
34802f1cd9bSEd Tanous# Source files
3490ad63df8SNan Zhoufs = import('fs')
350af6298daSManojkiran Eda
3510ad63df8SNan Zhousrcfiles_bmcweb = files(
352724985ffSEd Tanous    'http/mutual_tls.cpp',
35302f1cd9bSEd Tanous    'redfish-core/src/error_messages.cpp',
35425991f7dSEd Tanous    'redfish-core/src/filter_expr_executor.cpp',
355f88b2170SEd Tanous    'redfish-core/src/filter_expr_printer.cpp',
356f2caadceSEd Tanous    'redfish-core/src/redfish.cpp',
357d1d411f9SSui Chen    'redfish-core/src/registries.cpp',
358d02aad39SEd Tanous    'redfish-core/src/utils/dbus_utils.cpp',
35902f1cd9bSEd Tanous    'redfish-core/src/utils/json_utils.cpp',
3603cd7072bSEd Tanous    'redfish-core/src/utils/time_utils.cpp',
361f523c324SEd Tanous    'src/boost_asio.cpp',
362f2caadceSEd Tanous    'src/boost_asio_ssl.cpp',
363f523c324SEd Tanous    'src/boost_beast.cpp',
3646384e323SNan Zhou    'src/dbus_singleton.cpp',
36561e349acSEd Tanous    'src/json_html_serializer.cpp',
3662c6ffdb0SEd Tanous    'src/ossl_random.cpp',
367724985ffSEd Tanous    'src/ssl_key_handler.cpp',
368f2caadceSEd Tanous    'src/webserver_run.cpp',
3690ad63df8SNan Zhou)
37002f1cd9bSEd Tanous
37142bbcd87SEd Tanousbmcweblib = static_library(
37242bbcd87SEd Tanous    'bmcweblib',
37342bbcd87SEd Tanous    srcfiles_bmcweb,
37442bbcd87SEd Tanous    include_directories: incdir,
37542bbcd87SEd Tanous    dependencies: bmcweb_dependencies,
37642bbcd87SEd Tanous)
37742bbcd87SEd Tanous
378*bd1299b7SAushim Nagarkatti# Generate the bmcwebd daemon
37902f1cd9bSEd Tanousexecutable(
380*bd1299b7SAushim Nagarkatti  'bmcwebd',
38142bbcd87SEd Tanous  'src/webserver_main.cpp',
382af6298daSManojkiran Eda  include_directories : incdir,
383ceb8ddc1SJason M. Bills  dependencies: bmcweb_dependencies,
38442bbcd87SEd Tanous  link_with: bmcweblib,
3855e34b67aSEd Tanous  link_args: '-Wl,--gc-sections',
386af6298daSManojkiran Eda  install: true,
387*bd1299b7SAushim Nagarkatti  install_dir:libexec
388*bd1299b7SAushim Nagarkatti)
389*bd1299b7SAushim Nagarkatti
390*bd1299b7SAushim Nagarkatti# Generate the bmcweb CLI application
391*bd1299b7SAushim Nagarkattiexecutable(
392*bd1299b7SAushim Nagarkatti  'bmcweb',
393*bd1299b7SAushim Nagarkatti  ['src/webserver_cli.cpp','src/boost_asio.cpp'],
394*bd1299b7SAushim Nagarkatti  include_directories : incdir_cli,
395*bd1299b7SAushim Nagarkatti  dependencies: bmcweb_cli_dependencies,
396*bd1299b7SAushim Nagarkatti  install: true,
397*bd1299b7SAushim Nagarkatti  install_dir:bindir
39802f1cd9bSEd Tanous)
39902f1cd9bSEd Tanous
4000ad63df8SNan Zhousrcfiles_unittest = files(
401c33a039bSNan Zhou    'test/http/crow_getroutes_test.cpp',
40252dd6932SEd Tanous    'test/http/http2_connection_test.cpp',
403f2caadceSEd Tanous    'test/http/http_body_test.cpp',
4044fa45dffSEd Tanous    'test/http/http_connection_test.cpp',
4058e3f7032SAbhilash Raju    'test/http/http_response_test.cpp',
406f2caadceSEd Tanous    'test/http/mutual_tls.cpp',
407f2caadceSEd Tanous    'test/http/mutual_tls_meta.cpp',
408f2caadceSEd Tanous    'test/http/parsing_test.cpp',
409f2caadceSEd Tanous    'test/http/router_test.cpp',
410f2caadceSEd Tanous    'test/http/server_sent_event_test.cpp',
411c33a039bSNan Zhou    'test/http/utility_test.cpp',
4122c9efc3cSEd Tanous    'test/http/verb_test.cpp',
413e1452beaSEd Tanous    'test/include/async_resolve_test.cpp',
41411e8f60dSEd Tanous    'test/include/credential_pipe_test.cpp',
415f2caadceSEd Tanous    'test/include/dbus_utility_test.cpp',
416f2caadceSEd Tanous    'test/include/google/google_service_root_test.cpp',
417f2caadceSEd Tanous    'test/include/http_utility_test.cpp',
418f2caadceSEd Tanous    'test/include/human_sort_test.cpp',
419c33a039bSNan Zhou    'test/include/ibm/configfile_test.cpp',
420f2caadceSEd Tanous    'test/include/json_html_serializer.cpp',
421c33a039bSNan Zhou    'test/include/multipart_test.cpp',
422c33a039bSNan Zhou    'test/include/openbmc_dbus_rest_test.cpp',
4232c6ffdb0SEd Tanous    'test/include/ossl_random.cpp',
424099225ccSEd Tanous    'test/include/ssl_key_handler_test.cpp',
425f2caadceSEd Tanous    'test/include/str_utility_test.cpp',
426c33a039bSNan Zhou    'test/redfish-core/include/privileges_test.cpp',
42725991f7dSEd Tanous    'test/redfish-core/include/filter_expr_executor_test.cpp',
428f88b2170SEd Tanous    'test/redfish-core/include/filter_expr_parser_test.cpp',
4297e8890c5SCarson Labrado    'test/redfish-core/include/redfish_aggregator_test.cpp',
430c33a039bSNan Zhou    'test/redfish-core/include/registries_test.cpp',
431d02aad39SEd Tanous    'test/redfish-core/include/utils/dbus_utils.cpp',
432f2caadceSEd Tanous    'test/redfish-core/include/utils/hex_utils_test.cpp',
433c33a039bSNan Zhou    'test/redfish-core/include/utils/ip_utils_test.cpp',
434c33a039bSNan Zhou    'test/redfish-core/include/utils/json_utils_test.cpp',
435c33a039bSNan Zhou    'test/redfish-core/include/utils/query_param_test.cpp',
4361516c21bSJanet Adkins    'test/redfish-core/include/utils/sensor_utils_test.cpp',
437c33a039bSNan Zhou    'test/redfish-core/include/utils/stl_utils_test.cpp',
438c33a039bSNan Zhou    'test/redfish-core/include/utils/time_utils_test.cpp',
439c33a039bSNan Zhou    'test/redfish-core/lib/chassis_test.cpp',
440c33a039bSNan Zhou    'test/redfish-core/lib/log_services_dump_test.cpp',
44175e8e218SMyung Bae    'test/redfish-core/lib/log_services_test.cpp',
442e610b316SJagpal Singh Gill    'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
443090ab8e1SEd Tanous    'test/redfish-core/lib/metadata_test.cpp',
444f2caadceSEd Tanous    'test/redfish-core/lib/power_subsystem_test.cpp',
445f2caadceSEd Tanous    'test/redfish-core/lib/service_root_test.cpp',
446f2caadceSEd Tanous    'test/redfish-core/lib/system_test.cpp',
447f2caadceSEd Tanous    'test/redfish-core/lib/thermal_subsystem_test.cpp',
448f2caadceSEd Tanous    'test/redfish-core/lib/update_service_test.cpp',
4490ad63df8SNan Zhou)
450af6298daSManojkiran Eda
451549bed29SPatrick Williamsif (get_option('tests').allowed())
45202f1cd9bSEd Tanous    # generate the test executable
4530ad63df8SNan Zhou    foreach test_src : srcfiles_unittest
4540ad63df8SNan Zhou        test_bin = executable(
4550ad63df8SNan Zhou            fs.stem(test_src),
45642bbcd87SEd Tanous            test_src,
45742bbcd87SEd Tanous            link_with: bmcweblib,
458af6298daSManojkiran Eda            include_directories: incdir,
459af6298daSManojkiran Eda            install_dir: bindir,
460f2caadceSEd Tanous            dependencies: bmcweb_dependencies
461f2caadceSEd Tanous            + [
462cf2f932eSEd Tanous                gtest,
463cf2f932eSEd Tanous                gmock,
464f2caadceSEd Tanous            ],
46502f1cd9bSEd Tanous        )
4660ad63df8SNan Zhou        test(fs.stem(test_src), test_bin)
4670ad63df8SNan Zhou    endforeach
468af6298daSManojkiran Edaendif
469