[v2,7/7] buildtools/chkincs: test headers for C++ compatibility
Checks
Commit Message
Add support for checking each of our headers for issues when included in
a C++ file.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
buildtools/chkincs/main.cpp | 4 ++++
buildtools/chkincs/meson.build | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 buildtools/chkincs/main.cpp
new file mode 100644
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+int main(void) { return 0; }
@@ -28,3 +28,23 @@ executable('chkincs', sources,
dependencies: deps,
link_whole: dpdk_static_libraries + dpdk_drivers,
install: false)
+
+# run tests for c++ builds also
+if not add_languages('cpp', required: false)
+ subdir_done()
+endif
+
+gen_cpp_files = generator(gen_c_file_for_header,
+ output: '@BASENAME@.cpp',
+ arguments: ['@INPUT@', '@OUTPUT@'])
+
+cpp_sources = files('main.cpp')
+cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers)
+
+executable('chkincs-cpp', cpp_sources,
+ cpp_args: ['-include', 'rte_config.h', cflags],
+ link_args: dpdk_extra_ldflags,
+ include_directories: includes,
+ dependencies: deps,
+ link_whole: dpdk_static_libraries + dpdk_drivers,
+ install: false)