xref: /openbmc/bmcweb/meson.build (revision 92e26be5be5219dc04df63961b563ec2906aa217)
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')
42*92e26be5SEd Tanous    add_project_arguments(
43*92e26be5SEd Tanous        ['-fdata-sections', '-ffunction-sections'],
44*92e26be5SEd Tanous        language: 'cpp',
45*92e26be5SEd Tanous    )
46af6298daSManojkiran Eda    add_project_arguments('-DNDEBUG', language: 'cpp')
47af6298daSManojkiran Edaendif
48af6298daSManojkiran Eda
49f8ca6d79SEd Tanousif (get_option('dns-resolver') == 'systemd-dbus')
50f8ca6d79SEd Tanous    add_project_arguments('-DBMCWEB_DBUS_DNS_RESOLVER', language: 'cpp')
51f8ca6d79SEd Tanousendif
52f8ca6d79SEd Tanous
53af6298daSManojkiran Eda# Disable lto when compiling with no optimization
54af6298daSManojkiran Edaif (get_option('optimization') == '0')
55af6298daSManojkiran Eda    add_project_arguments('-fno-lto', language: 'cpp')
56af6298daSManojkiran Eda    message('Disabling lto & its supported features as optimization is disabled')
57af6298daSManojkiran Edaendif
58af6298daSManojkiran Eda
59af6298daSManojkiran Eda# Include Directories
60af6298daSManojkiran Eda
61*92e26be5SEd Tanousincdir = include_directories(
62*92e26be5SEd Tanous    'include',
63*92e26be5SEd Tanous    'redfish-core/include',
64*92e26be5SEd Tanous    'redfish-core/lib',
65bd1299b7SAushim Nagarkatti    'http',
66bd1299b7SAushim Nagarkatti)
67*92e26be5SEd Tanousincdir_cli = include_directories('http', 'include')
68af6298daSManojkiran Eda
69549bed29SPatrick Williamsif (get_option('tests').allowed())
7025b54dbaSEd Tanous    summary('unittest', 'NA', section: 'Features')
71af6298daSManojkiran Edaendif
72af6298daSManojkiran Eda
73af6298daSManojkiran Eda# Add compiler arguments
74af6298daSManojkiran Eda
75ade3f093SEd Tanousif (cxx.get_id() == 'clang')
76ade3f093SEd Tanous    if (cxx.version().version_compare('<17.0'))
77ade3f093SEd Tanous        error('This project requires clang-17 or higher')
78ade3f093SEd Tanous    endif
79af6298daSManojkiran Eda    add_project_arguments(
80af6298daSManojkiran Eda        '-Weverything',
81ade3f093SEd Tanous        '-Wformat=2',
82af6298daSManojkiran Eda        '-Wno-c++98-compat-pedantic',
83f523c324SEd Tanous        '-Wno-c++98-compat',
8425991f7dSEd Tanous        '-Wno-c++20-extensions',
85f523c324SEd Tanous        '-Wno-documentation-unknown-command',
86f523c324SEd Tanous        '-Wno-documentation',
87af6298daSManojkiran Eda        '-Wno-exit-time-destructors',
88f523c324SEd Tanous        '-Wno-global-constructors',
89f523c324SEd Tanous        '-Wno-newline-eof',
90f523c324SEd Tanous        '-Wno-padded',
91af6298daSManojkiran Eda        '-Wno-shadow',
92af6298daSManojkiran Eda        '-Wno-used-but-marked-unused',
93af6298daSManojkiran Eda        '-Wno-weak-vtables',
94e6801eb4SEd Tanous        '-Wno-switch-enum',
9572b90760SEd Tanous        '-Wno-unused-macros',
964da0490bSEd Tanous        '-Wno-covered-switch-default',
97f88b2170SEd Tanous        '-Wno-disabled-macro-expansion',
98724985ffSEd Tanous        '-Wno-unneeded-internal-declaration',
99f2caadceSEd Tanous        language: 'cpp',
100f2caadceSEd Tanous    )
101af6298daSManojkiran Edaendif
102af6298daSManojkiran Eda
103ade3f093SEd Tanousif (cxx.get_id() == 'gcc')
104ade3f093SEd Tanous    if (cxx.version().version_compare('<13.0'))
105ade3f093SEd Tanous        error('This project requires gcc-13 or higher')
106ade3f093SEd Tanous    endif
107af6298daSManojkiran Eda
108af6298daSManojkiran Eda    add_project_arguments(
109ade3f093SEd Tanous        '-Wformat=2',
110ade3f093SEd Tanous        '-Wcast-align',
111ade3f093SEd Tanous        '-Wconversion',
112ade3f093SEd Tanous        '-Woverloaded-virtual',
113ade3f093SEd Tanous        '-Wsign-conversion',
114ade3f093SEd Tanous        '-Wunused',
115af6298daSManojkiran Eda        '-Wduplicated-cond',
116af6298daSManojkiran Eda        '-Wduplicated-branches',
117af6298daSManojkiran Eda        '-Wlogical-op',
118af6298daSManojkiran Eda        '-Wnull-dereference',
119079360aeSEd Tanous        '-Wunused-parameter',
120af6298daSManojkiran Eda        '-Wdouble-promotion',
1218a592810SEd Tanous        '-Wshadow',
12230f11eb4SEd Tanous        '-Wno-psabi',
123ade3f093SEd Tanous        '-Wno-attributes',
124f2caadceSEd Tanous        language: 'cpp',
125f2caadceSEd Tanous    )
126c66403c3SEd Tanousendif
127af6298daSManojkiran Eda
128af6298daSManojkiran Edaif (get_option('buildtype') != 'plain')
129af6298daSManojkiran Eda    if (get_option('b_lto') == true and get_option('optimization') != '0')
130af6298daSManojkiran Eda        # Reduce the binary size by removing unnecessary
131af6298daSManojkiran Eda        # dynamic symbol table entries
132af6298daSManojkiran Eda
133af6298daSManojkiran Eda        add_project_arguments(
134f2caadceSEd Tanous            cxx.get_supported_arguments(
135f2caadceSEd Tanous                [
136af6298daSManojkiran Eda                    '-fno-fat-lto-objects',
137af6298daSManojkiran Eda                    '-fvisibility=hidden',
138f2caadceSEd Tanous                    '-fvisibility-inlines-hidden',
139f2caadceSEd Tanous                ],
140f2caadceSEd Tanous            ),
141f2caadceSEd Tanous            language: 'cpp',
142f2caadceSEd Tanous        )
143af6298daSManojkiran Eda
144af6298daSManojkiran Eda        if cxx.has_link_argument('-Wl,--exclude-libs,ALL')
145af6298daSManojkiran Eda            add_project_link_arguments('-Wl,--exclude-libs,ALL', language: 'cpp')
146af6298daSManojkiran Eda        endif
147af6298daSManojkiran Eda    endif
148c66403c3SEd Tanousendif
149af6298daSManojkiran Eda# Set Compiler Security flags
150af6298daSManojkiran Eda
151af6298daSManojkiran Edasecurity_flags = [
152af6298daSManojkiran Eda    '-fstack-protector-strong',
153af6298daSManojkiran Eda    '-fPIE',
154af6298daSManojkiran Eda    '-fPIC',
155af6298daSManojkiran Eda    '-D_FORTIFY_SOURCE=2',
156af6298daSManojkiran Eda    '-Wformat',
157f2caadceSEd Tanous    '-Wformat-security',
158af6298daSManojkiran Eda]
159af6298daSManojkiran Eda
160af6298daSManojkiran Eda## Add security flags for builds of type 'release','debugoptimized' and 'minsize'
161af6298daSManojkiran Eda
162*92e26be5SEd Tanousif not (get_option('buildtype') == 'plain'
163f2caadceSEd Tanousor get_option('buildtype').startswith('debug')
164f2caadceSEd Tanous)
165*92e26be5SEd Tanous    add_project_arguments(
166*92e26be5SEd Tanous        cxx.get_supported_arguments([security_flags]),
167*92e26be5SEd Tanous        language: 'cpp',
168*92e26be5SEd Tanous    )
169af6298daSManojkiran Edaendif
170af6298daSManojkiran Eda
171af6298daSManojkiran Eda# Boost dependency configuration
172af6298daSManojkiran Eda
173af6298daSManojkiran Edaadd_project_arguments(
174f2caadceSEd Tanous    cxx.get_supported_arguments(
175f2caadceSEd Tanous        [
1766fd29553SEd Tanous            '-DBOOST_ASIO_DISABLE_CONCEPTS',
177af6298daSManojkiran Eda            '-DBOOST_ALL_NO_LIB',
17858e42b18SEd Tanous            '-DBOOST_ALLOW_DEPRECATED_HEADERS',
179f523c324SEd Tanous            '-DBOOST_ASIO_DISABLE_THREADS',
180f523c324SEd Tanous            '-DBOOST_ASIO_NO_DEPRECATED',
181f523c324SEd Tanous            '-DBOOST_ASIO_SEPARATE_COMPILATION',
182f523c324SEd Tanous            '-DBOOST_BEAST_SEPARATE_COMPILATION',
1839e710e7fSEd Tanous            '-DBOOST_EXCEPTION_DISABLE',
184f706551dSEd Tanous            '-DBOOST_NO_EXCEPTIONS',
185ab6b6fecSEd Tanous            '-DBOOST_URL_NO_SOURCE_LOCATION',
186f88b2170SEd Tanous            '-DBOOST_SPIRIT_X3_NO_RTTI',
1879e710e7fSEd Tanous            '-DJSON_NOEXCEPTION',
188209aa909SEd Tanous            '-DOPENSSL_NO_FILENAMES',
189f706551dSEd Tanous            '-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
190f2caadceSEd Tanous        ],
191f2caadceSEd Tanous    ),
192f2caadceSEd Tanous    language: 'cpp',
193f2caadceSEd Tanous)
194af6298daSManojkiran Eda
195af6298daSManojkiran Eda# Find the dependency modules, if not found use meson wrap to get them
196af6298daSManojkiran Eda# automatically during the configure step
197ceb8ddc1SJason M. Billsbmcweb_dependencies = []
198bd1299b7SAushim Nagarkattibmcweb_cli_dependencies = []
199af6298daSManojkiran Eda
2008682c5adSNan Zhoupam = cxx.find_library('pam', required: true)
201af6298daSManojkiran Edaatomic = cxx.find_library('atomic', required: true)
202e7923997SEd Tanousbmcweb_dependencies += [pam, atomic]
203e7923997SEd Tanous
204e7923997SEd Tanousopenssl = dependency('openssl', required: false, version: '>=3.0.0')
205e7923997SEd Tanousif not openssl.found() or get_option('b_sanitize') != 'none'
206e7923997SEd Tanous    openssl_proj = subproject(
207e7923997SEd Tanous        'openssl',
208e7923997SEd Tanous        required: true,
209f2caadceSEd Tanous        default_options: ['warning_level=0', 'werror=false'],
210e7923997SEd Tanous    )
211e7923997SEd Tanous    openssl = openssl_proj.get_variable('openssl_dep')
212e7923997SEd Tanous    openssl = openssl.as_system('system')
213e7923997SEd Tanousendif
214e7923997SEd Tanousbmcweb_dependencies += [openssl]
215af6298daSManojkiran Eda
216fca2cbeaSEd Tanousnghttp2 = dependency('libnghttp2', version: '>=1.52.0', required: false)
217fca2cbeaSEd Tanousif not nghttp2.found()
218fca2cbeaSEd Tanous    cmake = import('cmake')
219fca2cbeaSEd Tanous    opt_var = cmake.subproject_options()
220211cfa49SEd Tanous    opt_var.add_cmake_defines(
221*92e26be5SEd Tanous        {'ENABLE_LIB_ONLY': true, 'ENABLE_STATIC_LIB': true},
222211cfa49SEd Tanous    )
223fca2cbeaSEd Tanous    nghttp2_ex = cmake.subproject('nghttp2', options: opt_var)
224211cfa49SEd Tanous    nghttp2 = nghttp2_ex.dependency('nghttp2')
225fca2cbeaSEd Tanousendif
226fca2cbeaSEd Tanousbmcweb_dependencies += nghttp2
227fca2cbeaSEd Tanous
2287bb985eeSEd Tanoussdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
229af6298daSManojkiran Edaif not sdbusplus.found()
230af6298daSManojkiran Eda    sdbusplus_proj = subproject('sdbusplus', required: true)
231af6298daSManojkiran Eda    sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
232af6298daSManojkiran Eda    sdbusplus = sdbusplus.as_system('system')
233af6298daSManojkiran Edaendif
234ceb8ddc1SJason M. Billsbmcweb_dependencies += sdbusplus
235bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += sdbusplus
236bd1299b7SAushim Nagarkatti
237bd1299b7SAushim Nagarkatticli11 = dependency('CLI11', required: false, include_type: 'system')
238bd1299b7SAushim Nagarkattiif not cli11.found()
239bd1299b7SAushim Nagarkatti    cli11_proj = subproject('cli11', required: true)
240bd1299b7SAushim Nagarkatti    cli11 = cli11_proj.get_variable('CLI11_dep')
241bd1299b7SAushim Nagarkatti    cli11 = cli11.as_system('system')
242bd1299b7SAushim Nagarkattiendif
243bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += cli11
244bd1299b7SAushim Nagarkatti
245af6298daSManojkiran Eda
246c9374ff6SEd Tanoustinyxml = dependency(
247c9374ff6SEd Tanous    'tinyxml2',
248565c0911SPatrick Williams    include_type: 'system',
249c9374ff6SEd Tanous    version: '>=9.0.0',
25060e299bdSKonstantin Aladyshev    default_options: ['tests=false'],
251565c0911SPatrick Williams)
252c9374ff6SEd Tanousif not tinyxml.found()
253c9374ff6SEd Tanous    tinyxml_proj = subproject('tinyxml2', required: true)
254c9374ff6SEd Tanous    tinyxml = tinyxml_proj.get_variable('tinyxml_dep')
255c9374ff6SEd Tanous    tinyxml = tinyxml.as_system('system')
256c9374ff6SEd Tanousendif
257ceb8ddc1SJason M. Billsbmcweb_dependencies += tinyxml
258af6298daSManojkiran Eda
259af6298daSManojkiran Edasystemd = dependency('systemd')
260055713e4SEd Tanousadd_project_arguments('-DSYSTEMD_VERSION=' + systemd.version(), language: 'cpp')
261055713e4SEd Tanous
262af6298daSManojkiran Edazlib = dependency('zlib')
263ceb8ddc1SJason M. Billsbmcweb_dependencies += [systemd, zlib]
264af6298daSManojkiran Eda
265*92e26be5SEd Tanousnlohmann_json_dep = dependency(
266*92e26be5SEd Tanous    'nlohmann_json',
267*92e26be5SEd Tanous    version: '>=3.11.2',
268*92e26be5SEd Tanous    include_type: 'system',
269*92e26be5SEd Tanous)
270dfd5547bSPatrick Williamsbmcweb_dependencies += nlohmann_json_dep
271af6298daSManojkiran Eda
2722b5b4daeSCarson Labradoboost = dependency(
2732b5b4daeSCarson Labrado    'boost',
274*92e26be5SEd Tanous    modules: ['url'],
275619b8609SEd Tanous    version: '>=1.84.0',
2762b5b4daeSCarson Labrado    required: false,
277f2caadceSEd Tanous    include_type: 'system',
2782b5b4daeSCarson Labrado)
2796fd29553SEd Tanousif boost.found()
2806fd29553SEd Tanous    bmcweb_dependencies += [boost]
281bd1299b7SAushim Nagarkatti    bmcweb_cli_dependencies += [boost]
2826fd29553SEd Tanouselse
2836fd29553SEd Tanous    cmake = import('cmake')
2846fd29553SEd Tanous    opt = cmake.subproject_options()
285f80a87f2SEd Tanous    boost_libs = [
286f80a87f2SEd Tanous        'asio',
287f80a87f2SEd Tanous        'beast',
288f80a87f2SEd Tanous        'circular_buffer',
289f80a87f2SEd Tanous        'callable_traits',
290f80a87f2SEd Tanous        'headers',
291f80a87f2SEd Tanous        'process',
292f80a87f2SEd Tanous        'type_index',
293f80a87f2SEd Tanous        'url',
294f80a87f2SEd Tanous        'uuid',
295f80a87f2SEd Tanous        'spirit',
296f80a87f2SEd Tanous    ]
297f2caadceSEd Tanous    opt.add_cmake_defines(
298f2caadceSEd Tanous        {
2994ed30a8bSEd Tanous            # 1.86.0 fails this.  Hopefully fixed in 1.86.1
3004ed30a8bSEd Tanous            'CMAKE_CXX_FLAGS': '-Wno-unused-parameter',
301f80a87f2SEd Tanous            'BOOST_INCLUDE_LIBRARIES': ';'.join(boost_libs),
302144983c5SEd Tanous            'BUILD_SHARED_LIBS': 'OFF',
303f2caadceSEd Tanous        },
304f2caadceSEd Tanous    )
305144983c5SEd Tanous
3066fd29553SEd Tanous    boost = cmake.subproject('boost', required: true, options: opt)
307f80a87f2SEd Tanous    foreach boost_lib : boost_libs
308f80a87f2SEd Tanous        boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system()
309f80a87f2SEd Tanous        bmcweb_dependencies += [boost_lib_instance]
310bd1299b7SAushim Nagarkatti        bmcweb_cli_dependencies += [boost_lib_instance]
311f80a87f2SEd Tanous    endforeach
312af6298daSManojkiran Edaendif
313af6298daSManojkiran Eda
314549bed29SPatrick Williamsif get_option('tests').allowed()
315f2caadceSEd Tanous    gtest = dependency(
316f2caadceSEd Tanous        'gtest',
317f2caadceSEd Tanous        main: true,
318f2caadceSEd Tanous        version: '>=1.14.0',
319f2caadceSEd Tanous        disabler: true,
320f2caadceSEd Tanous        required: false,
321f2caadceSEd Tanous    )
322af6298daSManojkiran Eda    gmock = dependency('gmock', required: false)
323549bed29SPatrick Williams    if not gtest.found() and get_option('tests').allowed()
324af6298daSManojkiran Eda        gtest_proj = subproject('gtest', required: true)
325af6298daSManojkiran Eda        gtest = gtest_proj.get_variable('gtest_main_dep')
326af6298daSManojkiran Eda        gmock = gtest_proj.get_variable('gmock_dep')
327af6298daSManojkiran Eda    endif
328b00dcc27SEd Tanous    gtest = gtest.as_system('system')
329b00dcc27SEd Tanous    gmock = gmock.as_system('system')
330af6298daSManojkiran Edaendif
331af6298daSManojkiran Eda
3324efe3e0cSPatrick Williamssystemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
333af6298daSManojkiran Eda
334af6298daSManojkiran Edabindir = get_option('prefix') + '/' + get_option('bindir')
335bd1299b7SAushim Nagarkattilibexec = get_option('prefix') + '/' + get_option('libexecdir')
336af6298daSManojkiran Eda
337f2caadceSEd Tanoussummary(
338f2caadceSEd Tanous    {
339af6298daSManojkiran Eda        'prefix': get_option('prefix'),
340af6298daSManojkiran Eda        'bindir': bindir,
341f2caadceSEd Tanous        'systemd unit directory': systemd_system_unit_dir,
342f2caadceSEd Tanous    },
343f2caadceSEd Tanous    section: 'Directories',
344f2caadceSEd Tanous)
345af6298daSManojkiran Eda
346a529a6aaSEd Tanoussubdir('static')
347a529a6aaSEd Tanoussubdir('redfish-core')
348af6298daSManojkiran Eda
349307386e8SNan Zhou# Config subdirectory
350307386e8SNan Zhousubdir('config')
351307386e8SNan Zhoubmcweb_dependencies += conf_h_dep
352bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += conf_h_dep
353307386e8SNan Zhou
35402f1cd9bSEd Tanous# Source files
3550ad63df8SNan Zhoufs = import('fs')
356af6298daSManojkiran Eda
3570ad63df8SNan Zhousrcfiles_bmcweb = files(
358724985ffSEd Tanous    'http/mutual_tls.cpp',
35902f1cd9bSEd Tanous    'redfish-core/src/error_messages.cpp',
36025991f7dSEd Tanous    'redfish-core/src/filter_expr_executor.cpp',
361f88b2170SEd Tanous    'redfish-core/src/filter_expr_printer.cpp',
362f2caadceSEd Tanous    'redfish-core/src/redfish.cpp',
363d1d411f9SSui Chen    'redfish-core/src/registries.cpp',
364d02aad39SEd Tanous    'redfish-core/src/utils/dbus_utils.cpp',
36502f1cd9bSEd Tanous    'redfish-core/src/utils/json_utils.cpp',
3663cd7072bSEd Tanous    'redfish-core/src/utils/time_utils.cpp',
367f523c324SEd Tanous    'src/boost_asio.cpp',
368f2caadceSEd Tanous    'src/boost_asio_ssl.cpp',
369f523c324SEd Tanous    'src/boost_beast.cpp',
3706384e323SNan Zhou    'src/dbus_singleton.cpp',
37161e349acSEd Tanous    'src/json_html_serializer.cpp',
3722c6ffdb0SEd Tanous    'src/ossl_random.cpp',
373724985ffSEd Tanous    'src/ssl_key_handler.cpp',
374f2caadceSEd Tanous    'src/webserver_run.cpp',
3750ad63df8SNan Zhou)
37602f1cd9bSEd Tanous
37742bbcd87SEd Tanousbmcweblib = static_library(
37842bbcd87SEd Tanous    'bmcweblib',
37942bbcd87SEd Tanous    srcfiles_bmcweb,
38042bbcd87SEd Tanous    include_directories: incdir,
38142bbcd87SEd Tanous    dependencies: bmcweb_dependencies,
38242bbcd87SEd Tanous)
38342bbcd87SEd Tanous
384bd1299b7SAushim Nagarkatti# Generate the bmcwebd daemon
38502f1cd9bSEd Tanousexecutable(
386bd1299b7SAushim Nagarkatti    'bmcwebd',
38742bbcd87SEd Tanous    'src/webserver_main.cpp',
388af6298daSManojkiran Eda    include_directories: incdir,
389ceb8ddc1SJason M. Bills    dependencies: bmcweb_dependencies,
39042bbcd87SEd Tanous    link_with: bmcweblib,
3915e34b67aSEd Tanous    link_args: '-Wl,--gc-sections',
392af6298daSManojkiran Eda    install: true,
393*92e26be5SEd Tanous    install_dir: libexec,
394bd1299b7SAushim Nagarkatti)
395bd1299b7SAushim Nagarkatti
396bd1299b7SAushim Nagarkatti# Generate the bmcweb CLI application
397bd1299b7SAushim Nagarkattiexecutable(
398bd1299b7SAushim Nagarkatti    'bmcweb',
399bd1299b7SAushim Nagarkatti    ['src/webserver_cli.cpp', 'src/boost_asio.cpp'],
400bd1299b7SAushim Nagarkatti    include_directories: incdir_cli,
401bd1299b7SAushim Nagarkatti    dependencies: bmcweb_cli_dependencies,
402bd1299b7SAushim Nagarkatti    install: true,
403*92e26be5SEd Tanous    install_dir: bindir,
40402f1cd9bSEd Tanous)
40502f1cd9bSEd Tanous
4060ad63df8SNan Zhousrcfiles_unittest = files(
407c33a039bSNan Zhou    'test/http/crow_getroutes_test.cpp',
40852dd6932SEd Tanous    'test/http/http2_connection_test.cpp',
409f2caadceSEd Tanous    'test/http/http_body_test.cpp',
4104fa45dffSEd Tanous    'test/http/http_connection_test.cpp',
4118e3f7032SAbhilash Raju    'test/http/http_response_test.cpp',
412f2caadceSEd Tanous    'test/http/mutual_tls.cpp',
413f2caadceSEd Tanous    'test/http/mutual_tls_meta.cpp',
414f2caadceSEd Tanous    'test/http/parsing_test.cpp',
415f2caadceSEd Tanous    'test/http/router_test.cpp',
416f2caadceSEd Tanous    'test/http/server_sent_event_test.cpp',
417c33a039bSNan Zhou    'test/http/utility_test.cpp',
4182c9efc3cSEd Tanous    'test/http/verb_test.cpp',
419e1452beaSEd Tanous    'test/include/async_resolve_test.cpp',
42011e8f60dSEd Tanous    'test/include/credential_pipe_test.cpp',
421f2caadceSEd Tanous    'test/include/dbus_utility_test.cpp',
422f2caadceSEd Tanous    'test/include/google/google_service_root_test.cpp',
423f2caadceSEd Tanous    'test/include/http_utility_test.cpp',
424f2caadceSEd Tanous    'test/include/human_sort_test.cpp',
425c33a039bSNan Zhou    'test/include/ibm/configfile_test.cpp',
426f2caadceSEd Tanous    'test/include/json_html_serializer.cpp',
427c33a039bSNan Zhou    'test/include/multipart_test.cpp',
428c33a039bSNan Zhou    'test/include/openbmc_dbus_rest_test.cpp',
4292c6ffdb0SEd Tanous    'test/include/ossl_random.cpp',
430099225ccSEd Tanous    'test/include/ssl_key_handler_test.cpp',
431f2caadceSEd Tanous    'test/include/str_utility_test.cpp',
43225991f7dSEd Tanous    'test/redfish-core/include/filter_expr_executor_test.cpp',
433f88b2170SEd Tanous    'test/redfish-core/include/filter_expr_parser_test.cpp',
434*92e26be5SEd Tanous    'test/redfish-core/include/privileges_test.cpp',
4357e8890c5SCarson Labrado    'test/redfish-core/include/redfish_aggregator_test.cpp',
436c33a039bSNan Zhou    'test/redfish-core/include/registries_test.cpp',
437d02aad39SEd Tanous    'test/redfish-core/include/utils/dbus_utils.cpp',
438f2caadceSEd Tanous    'test/redfish-core/include/utils/hex_utils_test.cpp',
439c33a039bSNan Zhou    'test/redfish-core/include/utils/ip_utils_test.cpp',
440c33a039bSNan Zhou    'test/redfish-core/include/utils/json_utils_test.cpp',
441c33a039bSNan Zhou    'test/redfish-core/include/utils/query_param_test.cpp',
4421516c21bSJanet Adkins    'test/redfish-core/include/utils/sensor_utils_test.cpp',
443c33a039bSNan Zhou    'test/redfish-core/include/utils/stl_utils_test.cpp',
444c33a039bSNan Zhou    'test/redfish-core/include/utils/time_utils_test.cpp',
445c33a039bSNan Zhou    'test/redfish-core/lib/chassis_test.cpp',
446c33a039bSNan Zhou    'test/redfish-core/lib/log_services_dump_test.cpp',
44775e8e218SMyung Bae    'test/redfish-core/lib/log_services_test.cpp',
448e610b316SJagpal Singh Gill    'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
449090ab8e1SEd Tanous    'test/redfish-core/lib/metadata_test.cpp',
450f2caadceSEd Tanous    'test/redfish-core/lib/power_subsystem_test.cpp',
451f2caadceSEd Tanous    'test/redfish-core/lib/service_root_test.cpp',
452f2caadceSEd Tanous    'test/redfish-core/lib/system_test.cpp',
453f2caadceSEd Tanous    'test/redfish-core/lib/thermal_subsystem_test.cpp',
454f2caadceSEd Tanous    'test/redfish-core/lib/update_service_test.cpp',
4550ad63df8SNan Zhou)
456af6298daSManojkiran Eda
457549bed29SPatrick Williamsif (get_option('tests').allowed())
45802f1cd9bSEd Tanous    # generate the test executable
4590ad63df8SNan Zhou    foreach test_src : srcfiles_unittest
4600ad63df8SNan Zhou        test_bin = executable(
4610ad63df8SNan Zhou            fs.stem(test_src),
46242bbcd87SEd Tanous            test_src,
46342bbcd87SEd Tanous            link_with: bmcweblib,
464af6298daSManojkiran Eda            include_directories: incdir,
465af6298daSManojkiran Eda            install_dir: bindir,
466*92e26be5SEd Tanous            dependencies: bmcweb_dependencies + [gtest, gmock],
46702f1cd9bSEd Tanous        )
4680ad63df8SNan Zhou        test(fs.stem(test_src), test_bin)
4690ad63df8SNan Zhou    endforeach
470af6298daSManojkiran Edaendif
471