Skip to content

'make format' requires cmake configuration of the project #3345

@AmirhosseinPoolad

Description

@AmirhosseinPoolad

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)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions