xref: /openbmc/bmcweb/meson.build (revision 8d2f868c9e553d8d7b77a3cbdbf32f7c889da8cb)
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')
4292e26be5SEd Tanous    add_project_arguments(
4392e26be5SEd Tanous        ['-fdata-sections', '-ffunction-sections'],
4492e26be5SEd Tanous        language: 'cpp',
4592e26be5SEd 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
6192e26be5SEd Tanousincdir = include_directories(
6292e26be5SEd Tanous    'include',
6392e26be5SEd Tanous    'redfish-core/include',
6492e26be5SEd Tanous    'redfish-core/lib',
65bd1299b7SAushim Nagarkatti    'http',
66bd1299b7SAushim Nagarkatti)
6792e26be5SEd 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
16292e26be5SEd Tanousif not (get_option('buildtype') == 'plain'
163f2caadceSEd Tanousor get_option('buildtype').startswith('debug')
164f2caadceSEd Tanous)
16592e26be5SEd Tanous    add_project_arguments(
16692e26be5SEd Tanous        cxx.get_supported_arguments([security_flags]),
16792e26be5SEd Tanous        language: 'cpp',
16892e26be5SEd 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(
22192e26be5SEd 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')
260058f54edSPatrick Williamslibsystemd = dependency('libsystemd')
261058f54edSPatrick Williamsadd_project_arguments('-DLIBSYSTEMD_VERSION=' + libsystemd.version(), language: 'cpp')
262055713e4SEd Tanous
263af6298daSManojkiran Edazlib = dependency('zlib')
264058f54edSPatrick Williamsbmcweb_dependencies += [libsystemd, zlib]
265af6298daSManojkiran Eda
26692e26be5SEd Tanousnlohmann_json_dep = dependency(
26792e26be5SEd Tanous    'nlohmann_json',
26892e26be5SEd Tanous    version: '>=3.11.2',
26992e26be5SEd Tanous    include_type: 'system',
27092e26be5SEd Tanous)
271dfd5547bSPatrick Williamsbmcweb_dependencies += nlohmann_json_dep
272af6298daSManojkiran Eda
2732b5b4daeSCarson Labradoboost = dependency(
2742b5b4daeSCarson Labrado    'boost',
27592e26be5SEd Tanous    modules: ['url'],
276619b8609SEd Tanous    version: '>=1.84.0',
2772b5b4daeSCarson Labrado    required: false,
278f2caadceSEd Tanous    include_type: 'system',
2792b5b4daeSCarson Labrado)
2806fd29553SEd Tanousif boost.found()
2816fd29553SEd Tanous    bmcweb_dependencies += [boost]
282bd1299b7SAushim Nagarkatti    bmcweb_cli_dependencies += [boost]
2836fd29553SEd Tanouselse
2846fd29553SEd Tanous    cmake = import('cmake')
2856fd29553SEd Tanous    opt = cmake.subproject_options()
286f80a87f2SEd Tanous    boost_libs = [
287f80a87f2SEd Tanous        'asio',
288f80a87f2SEd Tanous        'beast',
289f80a87f2SEd Tanous        'circular_buffer',
290f80a87f2SEd Tanous        'callable_traits',
291f80a87f2SEd Tanous        'headers',
292f80a87f2SEd Tanous        'process',
293f80a87f2SEd Tanous        'type_index',
294f80a87f2SEd Tanous        'url',
295f80a87f2SEd Tanous        'uuid',
296f80a87f2SEd Tanous        'spirit',
297f80a87f2SEd Tanous    ]
298f2caadceSEd Tanous    opt.add_cmake_defines(
299f2caadceSEd Tanous        {
3004ed30a8bSEd Tanous            # 1.86.0 fails this.  Hopefully fixed in 1.86.1
3014ed30a8bSEd Tanous            'CMAKE_CXX_FLAGS': '-Wno-unused-parameter',
302f80a87f2SEd Tanous            'BOOST_INCLUDE_LIBRARIES': ';'.join(boost_libs),
303144983c5SEd Tanous            'BUILD_SHARED_LIBS': 'OFF',
304f2caadceSEd Tanous        },
305f2caadceSEd Tanous    )
306144983c5SEd Tanous
3076fd29553SEd Tanous    boost = cmake.subproject('boost', required: true, options: opt)
308f80a87f2SEd Tanous    foreach boost_lib : boost_libs
309f80a87f2SEd Tanous        boost_lib_instance = boost.dependency('boost_' + boost_lib).as_system()
310f80a87f2SEd Tanous        bmcweb_dependencies += [boost_lib_instance]
311bd1299b7SAushim Nagarkatti        bmcweb_cli_dependencies += [boost_lib_instance]
312f80a87f2SEd Tanous    endforeach
313af6298daSManojkiran Edaendif
314af6298daSManojkiran Eda
315549bed29SPatrick Williamsif get_option('tests').allowed()
316f2caadceSEd Tanous    gtest = dependency(
317f2caadceSEd Tanous        'gtest',
318f2caadceSEd Tanous        main: true,
319f2caadceSEd Tanous        version: '>=1.14.0',
320f2caadceSEd Tanous        disabler: true,
321f2caadceSEd Tanous        required: false,
322f2caadceSEd Tanous    )
323af6298daSManojkiran Eda    gmock = dependency('gmock', required: false)
324549bed29SPatrick Williams    if not gtest.found() and get_option('tests').allowed()
325af6298daSManojkiran Eda        gtest_proj = subproject('gtest', required: true)
326af6298daSManojkiran Eda        gtest = gtest_proj.get_variable('gtest_main_dep')
327af6298daSManojkiran Eda        gmock = gtest_proj.get_variable('gmock_dep')
328af6298daSManojkiran Eda    endif
329b00dcc27SEd Tanous    gtest = gtest.as_system('system')
330b00dcc27SEd Tanous    gmock = gmock.as_system('system')
331af6298daSManojkiran Edaendif
332af6298daSManojkiran Eda
3334efe3e0cSPatrick Williamssystemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')
334af6298daSManojkiran Eda
335af6298daSManojkiran Edabindir = get_option('prefix') + '/' + get_option('bindir')
336bd1299b7SAushim Nagarkattilibexec = get_option('prefix') + '/' + get_option('libexecdir')
337af6298daSManojkiran Eda
338f2caadceSEd Tanoussummary(
339f2caadceSEd Tanous    {
340af6298daSManojkiran Eda        'prefix': get_option('prefix'),
341af6298daSManojkiran Eda        'bindir': bindir,
342f2caadceSEd Tanous        'systemd unit directory': systemd_system_unit_dir,
343f2caadceSEd Tanous    },
344f2caadceSEd Tanous    section: 'Directories',
345f2caadceSEd Tanous)
346af6298daSManojkiran Eda
347a529a6aaSEd Tanoussubdir('static')
348a529a6aaSEd Tanoussubdir('redfish-core')
349af6298daSManojkiran Eda
350307386e8SNan Zhou# Config subdirectory
351307386e8SNan Zhousubdir('config')
352307386e8SNan Zhoubmcweb_dependencies += conf_h_dep
353bd1299b7SAushim Nagarkattibmcweb_cli_dependencies += conf_h_dep
354307386e8SNan Zhou
35502f1cd9bSEd Tanous# Source files
3560ad63df8SNan Zhoufs = import('fs')
357af6298daSManojkiran Eda
3580ad63df8SNan Zhousrcfiles_bmcweb = files(
359724985ffSEd Tanous    'http/mutual_tls.cpp',
36002f1cd9bSEd Tanous    'redfish-core/src/error_messages.cpp',
36125991f7dSEd Tanous    'redfish-core/src/filter_expr_executor.cpp',
362f88b2170SEd Tanous    'redfish-core/src/filter_expr_printer.cpp',
363f2caadceSEd Tanous    'redfish-core/src/redfish.cpp',
364d1d411f9SSui Chen    'redfish-core/src/registries.cpp',
365d02aad39SEd Tanous    'redfish-core/src/utils/dbus_utils.cpp',
36602f1cd9bSEd Tanous    'redfish-core/src/utils/json_utils.cpp',
3673cd7072bSEd Tanous    'redfish-core/src/utils/time_utils.cpp',
368f523c324SEd Tanous    'src/boost_asio.cpp',
369f2caadceSEd Tanous    'src/boost_asio_ssl.cpp',
370f523c324SEd Tanous    'src/boost_beast.cpp',
3716384e323SNan Zhou    'src/dbus_singleton.cpp',
37261e349acSEd Tanous    'src/json_html_serializer.cpp',
3732c6ffdb0SEd Tanous    'src/ossl_random.cpp',
374724985ffSEd Tanous    'src/ssl_key_handler.cpp',
375f2caadceSEd Tanous    'src/webserver_run.cpp',
3760ad63df8SNan Zhou)
37702f1cd9bSEd Tanous
37842bbcd87SEd Tanousbmcweblib = static_library(
37942bbcd87SEd Tanous    'bmcweblib',
38042bbcd87SEd Tanous    srcfiles_bmcweb,
38142bbcd87SEd Tanous    include_directories: incdir,
38242bbcd87SEd Tanous    dependencies: bmcweb_dependencies,
38342bbcd87SEd Tanous)
38442bbcd87SEd Tanous
385bd1299b7SAushim Nagarkatti# Generate the bmcwebd daemon
38602f1cd9bSEd Tanousexecutable(
387bd1299b7SAushim Nagarkatti    'bmcwebd',
38842bbcd87SEd Tanous    'src/webserver_main.cpp',
389af6298daSManojkiran Eda    include_directories: incdir,
390ceb8ddc1SJason M. Bills    dependencies: bmcweb_dependencies,
39142bbcd87SEd Tanous    link_with: bmcweblib,
3925e34b67aSEd Tanous    link_args: '-Wl,--gc-sections',
393af6298daSManojkiran Eda    install: true,
39492e26be5SEd Tanous    install_dir: libexec,
395bd1299b7SAushim Nagarkatti)
396bd1299b7SAushim Nagarkatti
397bd1299b7SAushim Nagarkatti# Generate the bmcweb CLI application
398bd1299b7SAushim Nagarkattiexecutable(
399bd1299b7SAushim Nagarkatti    'bmcweb',
400bd1299b7SAushim Nagarkatti    ['src/webserver_cli.cpp', 'src/boost_asio.cpp'],
401bd1299b7SAushim Nagarkatti    include_directories: incdir_cli,
402bd1299b7SAushim Nagarkatti    dependencies: bmcweb_cli_dependencies,
403bd1299b7SAushim Nagarkatti    install: true,
40492e26be5SEd Tanous    install_dir: bindir,
40502f1cd9bSEd Tanous)
40602f1cd9bSEd Tanous
4070ad63df8SNan Zhousrcfiles_unittest = files(
408c33a039bSNan Zhou    'test/http/crow_getroutes_test.cpp',
40952dd6932SEd Tanous    'test/http/http2_connection_test.cpp',
410f2caadceSEd Tanous    'test/http/http_body_test.cpp',
4114fa45dffSEd Tanous    'test/http/http_connection_test.cpp',
4128e3f7032SAbhilash Raju    'test/http/http_response_test.cpp',
413f2caadceSEd Tanous    'test/http/mutual_tls.cpp',
414f2caadceSEd Tanous    'test/http/mutual_tls_meta.cpp',
415f2caadceSEd Tanous    'test/http/parsing_test.cpp',
416f2caadceSEd Tanous    'test/http/router_test.cpp',
417f2caadceSEd Tanous    'test/http/server_sent_event_test.cpp',
418c33a039bSNan Zhou    'test/http/utility_test.cpp',
4192c9efc3cSEd Tanous    'test/http/verb_test.cpp',
420e1452beaSEd Tanous    'test/include/async_resolve_test.cpp',
42111e8f60dSEd Tanous    'test/include/credential_pipe_test.cpp',
422f2caadceSEd Tanous    'test/include/dbus_utility_test.cpp',
423f2caadceSEd Tanous    'test/include/google/google_service_root_test.cpp',
424f2caadceSEd Tanous    'test/include/http_utility_test.cpp',
425f2caadceSEd Tanous    'test/include/human_sort_test.cpp',
426c33a039bSNan Zhou    'test/include/ibm/configfile_test.cpp',
427f2caadceSEd Tanous    'test/include/json_html_serializer.cpp',
428c33a039bSNan Zhou    'test/include/multipart_test.cpp',
429c33a039bSNan Zhou    'test/include/openbmc_dbus_rest_test.cpp',
4302c6ffdb0SEd Tanous    'test/include/ossl_random.cpp',
431099225ccSEd Tanous    'test/include/ssl_key_handler_test.cpp',
432f2caadceSEd Tanous    'test/include/str_utility_test.cpp',
43325991f7dSEd Tanous    'test/redfish-core/include/filter_expr_executor_test.cpp',
434f88b2170SEd Tanous    'test/redfish-core/include/filter_expr_parser_test.cpp',
43592e26be5SEd Tanous    'test/redfish-core/include/privileges_test.cpp',
4367e8890c5SCarson Labrado    'test/redfish-core/include/redfish_aggregator_test.cpp',
437c33a039bSNan Zhou    'test/redfish-core/include/registries_test.cpp',
438d02aad39SEd Tanous    'test/redfish-core/include/utils/dbus_utils.cpp',
439f2caadceSEd Tanous    'test/redfish-core/include/utils/hex_utils_test.cpp',
440c33a039bSNan Zhou    'test/redfish-core/include/utils/ip_utils_test.cpp',
441c33a039bSNan Zhou    'test/redfish-core/include/utils/json_utils_test.cpp',
442c33a039bSNan Zhou    'test/redfish-core/include/utils/query_param_test.cpp',
4431516c21bSJanet Adkins    'test/redfish-core/include/utils/sensor_utils_test.cpp',
444c33a039bSNan Zhou    'test/redfish-core/include/utils/stl_utils_test.cpp',
445c33a039bSNan Zhou    'test/redfish-core/include/utils/time_utils_test.cpp',
446c33a039bSNan Zhou    'test/redfish-core/lib/chassis_test.cpp',
447c33a039bSNan Zhou    'test/redfish-core/lib/log_services_dump_test.cpp',
448e610b316SJagpal Singh Gill    'test/redfish-core/lib/manager_diagnostic_data_test.cpp',
449*8d2f868cSEd Tanous    'test/redfish-core/lib/manager_logservices_journal_test.cpp',
450090ab8e1SEd Tanous    'test/redfish-core/lib/metadata_test.cpp',
451f2caadceSEd Tanous    'test/redfish-core/lib/power_subsystem_test.cpp',
452f2caadceSEd Tanous    'test/redfish-core/lib/service_root_test.cpp',
453f2caadceSEd Tanous    'test/redfish-core/lib/system_test.cpp',
454*8d2f868cSEd Tanous    'test/redfish-core/lib/systems_logservices_postcode.cpp',
455f2caadceSEd Tanous    'test/redfish-core/lib/thermal_subsystem_test.cpp',
456f2caadceSEd Tanous    'test/redfish-core/lib/update_service_test.cpp',
4570ad63df8SNan Zhou)
458af6298daSManojkiran Eda
459549bed29SPatrick Williamsif (get_option('tests').allowed())
46002f1cd9bSEd Tanous    # generate the test executable
4610ad63df8SNan Zhou    foreach test_src : srcfiles_unittest
4620ad63df8SNan Zhou        test_bin = executable(
4630ad63df8SNan Zhou            fs.stem(test_src),
46442bbcd87SEd Tanous            test_src,
46542bbcd87SEd Tanous            link_with: bmcweblib,
466af6298daSManojkiran Eda            include_directories: incdir,
467af6298daSManojkiran Eda            install_dir: bindir,
46892e26be5SEd Tanous            dependencies: bmcweb_dependencies + [gtest, gmock],
46902f1cd9bSEd Tanous        )
4700ad63df8SNan Zhou        test(fs.stem(test_src), test_bin)
4710ad63df8SNan Zhou    endforeach
472af6298daSManojkiran Edaendif
473