Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Moved format and check targets to SDL makefile, added more complete f…
Browse files Browse the repository at this point in the history
…lags for clang-tidy
  • Loading branch information
ariostas committed Jan 8, 2024
1 parent 6604616 commit 04c281b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
source setup.sh 1> /dev/null 2> /dev/null
pip install compiledb compdb
cd SDL
make BACKEND=cpu explicit -Bnwk > build_log.txt
make BACKEND=cpu explicit_cache -Bnwk > build_log.txt
compiledb < build_log.txt
# This extra step is needed to generate compilation commands for headers
compdb list > compile_commands_new.json
Expand Down
12 changes: 1 addition & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ bin/sdl: bin/sdl.o $(OBJECTS)
%.o: %.cc
$(CXX) $(PTCUTFLAG) $(T3T3EXTENSION) $(CFLAGS) $(EXTRACFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKAINCLUDE) $(ALPAKASERIAL) $< -c -o $@


.PHONY: $(ROOUTIL) efficiency clean format check check-fix

$(ROOUTIL):
$(MAKE) -C code/rooutil/

Expand All @@ -70,11 +67,4 @@ clean:
rm -f SDL/*.o
cd efficiency/ && make clean

format:
clang-format -i SDL/*.cc SDL/*.h

check:
clang-tidy SDL/*.cc SDL/*.h -- --language=c++ -std=c++17 -I. -I$(ROOT_ROOT)/include -I$(CMSSW_BASE)/src -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include -DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED -I/cvmfs/cms.cern.ch/el8_amd64_gcc11/external/gcc/11.4.1-30ebdc301ebd200f2ae0e3d880258e65/include/c++/11.4.1 -I/cvmfs/cms.cern.ch/el8_amd64_gcc11/external/gcc/11.4.1-30ebdc301ebd200f2ae0e3d880258e65/include/c++/11.4.1/x86_64-redhat-linux-gnu/

check-fix:
clang-tidy --fix --fix-errors --fix-notes SDL/*.cc SDL/*.h -- --language=c++ -std=c++17 -I. -I$(ROOT_ROOT)/include -I$(CMSSW_BASE)/src -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include -DALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED -I/cvmfs/cms.cern.ch/el8_amd64_gcc11/external/gcc/11.4.1-30ebdc301ebd200f2ae0e3d880258e65/include/c++/11.4.1 -I/cvmfs/cms.cern.ch/el8_amd64_gcc11/external/gcc/11.4.1-30ebdc301ebd200f2ae0e3d880258e65/include/c++/11.4.1/x86_64-redhat-linux-gnu/
.PHONY: $(ROOUTIL) efficiency
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ sdl_run -f -mc -s PU200 -n -1 -t myTag

## Code formatting and checking

The makefile includes phony targets to run `clang-format` and `clang-tidy` on the code in the `SDL` directory using the formatting and checks used in CMSSW. The following are the available commands.
The makefile in the `SDL` directory includes phony targets to run `clang-format` and `clang-tidy` on the code using the formatting and checks used in CMSSW. The following are the available commands.

- `make format`
Formats the code in the `SDL` directory using `clang-format` following the rules specified in `.clang-format`.
Expand Down
16 changes: 16 additions & 0 deletions SDL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,19 @@ clean:
rm -f *.so
rm -rf cpu/
rm -rf cuda/

.PHONY: clean explicit explicit_cache explicit_cache_cutvalue format check check-fix

format:
clang-format --style=file:../.clang-format -i *.cc *.h

# Collect all the include paths from the compiler.
# The .../gcc/x86_64-redhat-linux-gnu/*/include path is excluded since .../gcc/x86_64-redhat-linux-gnu/*/include-fixed should be used instead.
TIDYINCLUDEFLAGS := $(shell g++ -E -x c++ - -v < /dev/null 2>&1 | awk '/#include <...>/,/^End of search/{if (/^ / && !/x86_64-redhat-linux-gnu\/[0-9.]+\/include$$/) print "-I"$$1}' | tr '\n' ' ')
TIDYFLAGS := --language=c++ $(CXXFLAGS_CPU) $(ALPAKAINCLUDE) $(ALPAKASERIAL) $(ROOTCFLAGS) $(PRINTFLAG) $(DUPLICATED) $(CACHEFLAG_FLAGS) $(TIDYINCLUDEFLAGS)

check:
clang-tidy --config-file=../.clang-tidy *.cc *.h -- $(TIDYFLAGS)

check-fix:
clang-tidy --config-file=../.clang-tidy --format-style=file:../.clang-format --fix --fix-errors --fix-notes *.cc *.h -- $(TIDYFLAGS)

0 comments on commit 04c281b

Please sign in to comment.