ci: build some job with ASan
[dpdk.git] / buildtools / chkincs / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2021 Intel Corporation
3
4 if not get_option('check_includes')
5     build = false
6     subdir_done()
7 endif
8
9 gen_c_file_for_header = find_program('gen_c_file_for_header.py')
10 gen_c_files = generator(gen_c_file_for_header,
11         output: '@BASENAME@.c',
12         arguments: ['@INPUT@', '@OUTPUT@'])
13
14 cflags = machine_args
15 cflags += '-DALLOW_EXPERIMENTAL_API'
16 cflags += '-DALLOW_INTERNAL_API'
17
18 sources = files('main.c')
19 sources += gen_c_files.process(dpdk_chkinc_headers)
20
21 # some driver SDK headers depend on these two buses, which are mandatory in build
22 # so we always include them in deps list
23 deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
24 # add the rest of the libs to the dependencies
25 foreach l:enabled_libs
26     deps += get_variable('shared_rte_' + l)
27 endforeach
28
29 executable('chkincs', sources,
30         c_args: cflags,
31         include_directories: includes,
32         dependencies: deps,
33         install: false)
34
35 # run tests for c++ builds also
36 if not add_languages('cpp', required: false)
37     subdir_done()
38 endif
39
40 # check for extern C in files, since this is not detected as an error by the compiler
41 grep = find_program('grep', required: false)
42 if grep.found()
43     errlist = run_command([grep, '--files-without-match', '^extern "C"', dpdk_chkinc_headers],
44             check: false, capture: true).stdout().split()
45     if errlist != []
46         error('Files missing C++ \'extern "C"\' guards:\n- ' + '\n- '.join(errlist))
47     endif
48 endif
49
50 gen_cpp_files = generator(gen_c_file_for_header,
51         output: '@BASENAME@.cpp',
52         arguments: ['@INPUT@', '@OUTPUT@'])
53
54 cpp_sources = files('main.cpp')
55 cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers)
56
57 executable('chkincs-cpp', cpp_sources,
58         cpp_args: ['-include', 'rte_config.h', cflags],
59         include_directories: includes,
60         dependencies: deps,
61         install: false)