xref: /dpdk/buildtools/chkincs/meson.build (revision 90cb8ff8196f9b9c1c2bcee1c94ea583789bb63f)
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: '@BASENAME@.c',
12        arguments: ['@INPUT@', '@OUTPUT@'])
13
14cflags = machine_args
15
16sources = files('main.c')
17sources += gen_c_files.process(dpdk_chkinc_headers)
18
19# some driver SDK headers depend on these two buses, which are mandatory in build
20# so we always include them in deps list
21deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
22if dpdk_conf.has('RTE_BUS_VMBUS')
23    deps += get_variable('shared_rte_bus_vmbus')
24endif
25# add the rest of the libs to the dependencies
26foreach l:dpdk_libs_enabled
27    deps += get_variable('shared_rte_' + l)
28endforeach
29
30executable('chkincs', sources,
31        c_args: cflags,
32        include_directories: includes,
33        dependencies: deps,
34        install: false)
35
36executable('chkincs-exp', sources,
37        c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
38        include_directories: includes,
39        dependencies: deps,
40        install: false)
41
42executable('chkincs-all', sources,
43        c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'],
44        include_directories: includes,
45        dependencies: deps,
46        install: false)
47
48# run tests for c++ builds also
49if not add_languages('cpp', required: false)
50    subdir_done()
51endif
52
53gen_cpp_files = generator(gen_c_file_for_header,
54        output: '@BASENAME@.cpp',
55        arguments: ['@INPUT@', '@OUTPUT@'])
56
57cpp_sources = files('main.cpp')
58cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers)
59
60executable('chkincs-cpp', cpp_sources,
61        cpp_args: ['-include', 'rte_config.h', cflags],
62        include_directories: includes,
63        dependencies: deps,
64        install: false)
65
66executable('chkincs-cpp-exp', cpp_sources,
67        cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'],
68        include_directories: includes,
69        dependencies: deps,
70        install: false)
71
72executable('chkincs-cpp-all', cpp_sources,
73        cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API',
74                   '-DALLOW_INTERNAL_API'],
75        include_directories: includes,
76        dependencies: deps,
77        install: false)
78