Skip to content

Commit e2e5dd7

Browse files
author
spikelin
committed
add code-check via clang-tidy and cpplint
1 parent 9876155 commit e2e5dd7

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

cmake_build.sh

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#! /bin/bash
2+
13
if [ "$#" -eq "0" ]; then
24
rm -rf output
35
rm -rf build
46
echo "Build all (SDK libs and samples)"
57
mkdir -p build
68
cd build
79
cmake ..
8-
#-DSAMPLE_ONLY=OFF ..
910
make
1011
exit
1112
elif [ "$#" -eq "1" -a $1 == "samples" ]; then
@@ -29,7 +30,25 @@ elif [ "$#" -eq "1" -a $1 == "clean" ]; then
2930
rm -rf output
3031
rm -rf build
3132
exit
33+
elif [ "$#" -eq "1" -a $1 == "code-check" ]; then
34+
echo "run code check"
35+
rm -rf build
36+
mkdir -p build
37+
cd build
38+
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
39+
echo "clang-tidy check begin"
40+
clang_extra_arg="-extra-arg=-I/usr/lib/gcc/x86_64-linux-gnu/7/include -extra-arg=-I/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed"
41+
clang_check_rules="-checks=-clang-analyzer-osx*"
42+
run-clang-tidy ${clang_extra_arg} ${clang_check_rules} >../code-check-clang-tidy.txt
43+
echo "clang-tidy check end"
44+
echo "cpplint check begin"
45+
cd ..
46+
cpplint_rules="--filter=-whitespace/line_length,-readability/casting,-build/include_subdir,-whitespace/braces,-whitespace/comments,-whitespace/blank_line,-whitespace/parens,-whitespace/semicolon,-whitespace/end_of_line,-whitespace/comma"
47+
cpplint_coverage="include/ samples/ platform/ sdk_src/"
48+
cpplint ${cpplint_rules} --recursive ${cpplint_coverage} &>./code-check-cpplint.txt
49+
echo "cpplint check end"
50+
exit
3251
else
33-
echo "Usage: "$0" <null for all/samples/clean>"
52+
echo "Usage: "$0" <null for all/samples/clean/code-check>"
3453
exit
3554
fi

0 commit comments

Comments
 (0)