misc: Upgraded the clang-tidy runner to include knowledge on where to find libusb, libftdi etc but without causing errors if they're not available

This commit is contained in:
dragonmux
2022-10-19 15:11:30 +01:00
committed by Piotr Esden-Tempski
parent a4ce2f7356
commit 089827f6ef
2 changed files with 8 additions and 4 deletions

View File

@@ -30,8 +30,9 @@ ifndef NO_LIBOPENCM3
endif
$(Q)$(MAKE) $(MFLAGS) -C src $@
clang-tidy: SYSTEM_INCLUDE_PATHS=$(shell pkg-config --silence-errors --cflags libusb-1.0 libftdi1)
clang-tidy:
$(Q)scripts/run-clang-tidy.py -s "$(PWD)"
$(Q)scripts/run-clang-tidy.py -s "$(PWD)" $(SYSTEM_INCLUDE_PATHS)
clang-format:
$(Q)$(MAKE) $(MFLAGS) -C src $@

View File

@@ -15,6 +15,8 @@ parser.add_argument('-s', required = True, type = str, metavar = 'sourcePath',
dest = 'sourcePath', help = 'Path to the source directory to run clang-tidy in')
parser.add_argument('-p', type = str, metavar = 'buildPath',
dest = 'buildPath', help = 'Path to the build directory containing a compile_commands.json')
parser.add_argument('-I', type = str, action = 'append', metavar = 'includePaths',
dest = 'includePaths', default = [], help = 'Additional include paths to use')
args = parser.parse_args()
def globFiles():
@@ -31,9 +33,10 @@ def gatherFiles():
yield file
extraArgs = [
'-Isrc/target', '-Isrc', '-Isrc/include', '-Isrc/platforms/native',
'-Ilibopencm3/include', '-Isrc/platforms/stm32'
]
'-Isrc/target', '-Isrc', '-Isrc/include', '-Isrc/platforms/common',
'-Isrc/platforms/native', '-Ilibopencm3/include', '-Isrc/platforms/stm32'
] + args.includePaths
for i, arg in enumerate(extraArgs):
extraArgs[i] = f'--extra-arg={arg}'