1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright(c) 2021 Intel Corporation 3 4if not get_option('check_includes') 5 build = false 6 subdir_done() 7endif 8 9gen_c_file_for_header = find_program('gen_c_file_for_header.py') 10gen_c_files = generator(gen_c_file_for_header, 11 output: '@[email protected]', 12 arguments: ['@INPUT@', '@OUTPUT@']) 13 14cflags = machine_args 15cflags += '-DALLOW_EXPERIMENTAL_API' 16cflags += '-DALLOW_INTERNAL_API' 17 18sources = files('main.c') 19sources += 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 23deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] 24# add the rest of the libs to the dependencies 25foreach l:enabled_libs 26 deps += get_variable('shared_rte_' + l) 27endforeach 28 29executable('chkincs', sources, 30 c_args: cflags, 31 include_directories: includes, 32 dependencies: deps, 33 install: false) 34 35# run tests for c++ builds also 36if not add_languages('cpp', required: false) 37 subdir_done() 38endif 39 40# check for extern C in files, since this is not detected as an error by the compiler 41grep = find_program('grep', required: false) 42if 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 48endif 49 50gen_cpp_files = generator(gen_c_file_for_header, 51 output: '@[email protected]', 52 arguments: ['@INPUT@', '@OUTPUT@']) 53 54cpp_sources = files('main.cpp') 55cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) 56 57executable('chkincs-cpp', cpp_sources, 58 cpp_args: ['-include', 'rte_config.h', cflags], 59 include_directories: includes, 60 dependencies: deps, 61 install: false) 62