-
Notifications
You must be signed in to change notification settings - Fork 430
Description
Running 'make format' on the project requires you to run the cmake configuration on the entire project. This is due to the fact that the VtR makefile does not actually have a format target. At some point in the top level CMakeLists.txt, 'cmake/modules/AutoClangFormat.cmake' is included which defines a custom cmake target called 'format':
'add_custom_target(format DEPENDS format-cpp-fix-comments format-cpp-fix-template-operators)'
We should ideally have a format target in the makefile that does this without doing the cmake config for the entire project. Currently the CI format checker wastes resource by installing all packages and submodules necessary.
For a C/C++ formatting (no python) we could have something like this (This is AI generated to be clear):
# Directory to format recursively
SRC_DIR := vpr
# File extensions to include
EXT := c h cpp hpp
# Build the file list using find
FILES := $(shell find $(SRC_DIR) -type f \( \
$(foreach e,$(EXT), -name '*.$(e)' -o) -false \))
.PHONY: format-cpp
format-cpp:
clang-format -i $(FILES)
@echo "Formatted: $(SRC_DIR)"