File tree 2 files changed +31
-2
lines changed
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -141,5 +141,16 @@ matrix:
141
141
after_success :
142
142
- coveralls --gcov gcov-7 --gcov-options '\-lp' --exclude src
143
143
144
+ - compiler : clang
145
+ addons :
146
+ apt :
147
+ sources : ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
148
+ packages : ['clang-5.0', 'clang-tidy-5.0']
149
+ env :
150
+ - CXX=clang++-5.0
151
+ - CLANG_TIDY=clang-tidy-5.0
152
+ script :
153
+ - make -kj3 clang-tidy
154
+
144
155
script :
145
156
make -j3
Original file line number Diff line number Diff line change @@ -29,17 +29,26 @@ endif
29
29
CPPFLAGS ?= -pedantic
30
30
CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3
31
31
32
- .PHONY : all clean
32
+ CLANG_TIDY ?= clang-tidy
33
33
34
+ HEADERS := $(shell find include -name '* .hpp')
34
35
SOURCES := $(shell find src -name '* .cpp')
35
36
DEPENDS := $(SOURCES:%.cpp=build/%.d )
36
37
BINARIES := $(SOURCES:%.cpp=build/% )
37
38
38
39
UNIT_TESTS := $(filter build/src/test/% ,$(BINARIES ) )
39
40
40
- all : $(BINARIES )
41
+ .PHONY : all
42
+ all : compile check
43
+
44
+ .PHONY : compile
45
+ compile : $(BINARIES )
46
+
47
+ .PHONY : check
48
+ check : $(UNIT_TESTS )
41
49
@set -e; for T in $( UNIT_TESTS) ; do echo $$ T; $$ T > /dev/null; done
42
50
51
+ .PHONY : clean
43
52
clean :
44
53
@rm -rf build
45
54
@find . -name ' *~' -delete
@@ -51,6 +60,15 @@ build/%.d: %.cpp Makefile
51
60
build/% : % .cpp build/% .d
52
61
$(CXX ) $(CXXSTD ) -Iinclude $(CPPFLAGS ) $(CXXFLAGS ) $< -o $@
53
62
63
+ build/% .clang-tidy : %
64
+ $(CLANG_TIDY ) -extra-arg " -Iinclude" -extra-arg " -std=c++11" -checks=* ,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-misc-macro-parentheses -warnings-as-errors=* $< 2> /dev/null
65
+ @mkdir -p $(@D )
66
+ @touch $@
67
+
68
+ .PHONY : clang-tidy
69
+ clang-tidy : $(HEADERS:%=build/%.clang-tidy ) $(SOURCES:%=build/%.clang-tidy )
70
+ @echo " All $( words $( HEADERS) $( SOURCES) ) clang-tidy tests passed."
71
+
54
72
ifeq ($(findstring $(MAKECMDGOALS ) ,clean) ,)
55
73
-include $(DEPENDS )
56
74
endif
You can’t perform that action at this time.
0 commit comments