1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2021 Intel Corporation
4 if not get_option('check_includes')
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@'])
15 cflags += '-DALLOW_EXPERIMENTAL_API'
16 cflags += '-DALLOW_INTERNAL_API'
18 sources = files('main.c')
19 sources += gen_c_files.process(dpdk_chkinc_headers)
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)
29 executable('chkincs', sources,
31 include_directories: includes,
35 # run tests for c++ builds also
36 if not add_languages('cpp', required: false)
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)
43 errlist = run_command([grep, '--files-without-match', '^extern "C"', dpdk_chkinc_headers],
44 check: false, capture: true).stdout().split()
46 error('Files missing C++ \'extern "C"\' guards:\n- ' + '\n- '.join(errlist))
50 gen_cpp_files = generator(gen_c_file_for_header,
51 output: '@BASENAME@.cpp',
52 arguments: ['@INPUT@', '@OUTPUT@'])
54 cpp_sources = files('main.cpp')
55 cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers)
57 executable('chkincs-cpp', cpp_sources,
58 cpp_args: ['-include', 'rte_config.h', cflags],
59 include_directories: includes,