diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index ee56b8f3..e8072143 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -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 diff --git a/Makefile b/Makefile index e2c9512a..83ea9028 100644 --- a/Makefile +++ b/Makefile @@ -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/ @@ -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 diff --git a/README.md b/README.md index 0ac437e1..bfbaf05d 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/SDL/Makefile b/SDL/Makefile index 1a6c50a0..efd74232 100644 --- a/SDL/Makefile +++ b/SDL/Makefile @@ -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)