meson: Define our own clang-tidy target

meson's target has a few issues:
- Runs on all source files regardless if they're included in the
  build or not
- Doesn't have any dependencies on generated sources which means we
  have to do a full build first before we can run clang-tidy
- Doesn't allow us to pass any extra arguments

To work around these, let's define our own clang-tidy target instead
using llvm's run-clang-tidy script. Alongside the clang-tidy target,
let's start keeping track of all generated sources which we make the
clang-tidy target depend on. We also add a new target which will only
generate source files which is useful for setting up the source tree
for running code analysis against it.
This commit is contained in:
Daan De Meyer
2025-04-24 12:36:36 +02:00
parent 10594762c7
commit 44e86153d1
24 changed files with 99 additions and 30 deletions
+5
View File
@@ -231,6 +231,8 @@ syscall_list_h = custom_target(
'@INPUT@'],
capture : true)
generated_sources += syscall_list_h
if conf.get('HAVE_ACL') == 1
shared_sources += files('devnode-acl.c')
endif
@@ -302,6 +304,7 @@ target2 = custom_target(
capture : true)
shared_generated_gperf_headers = [target1, target2]
generated_sources += shared_generated_gperf_headers
shared_sources += shared_generated_gperf_headers
fname = 'ethtool-link-mode.h'
@@ -311,6 +314,8 @@ ethtool_link_mode_h = custom_target(
output : fname,
command : [python, '@INPUT0@', '--header', cpp, '@INPUT1@'],
capture : true)
generated_sources += ethtool_link_mode_h
shared_sources += ethtool_link_mode_h
fname = 'ethtool-link-mode.xml'