mirror of https://github.com/PCSX2/pcsx2.git
build: add a nice cppcheck option
This commit is contained in:
parent
45fb0ebcdf
commit
41081e1b40
32
build.sh
32
build.sh
|
@ -23,11 +23,13 @@ useClang=0
|
||||||
# 0 => no, 1 => yes, 2 => force yes
|
# 0 => no, 1 => yes, 2 => force yes
|
||||||
useCross=2
|
useCross=2
|
||||||
CoverityBuild=0
|
CoverityBuild=0
|
||||||
|
cppcheck=0
|
||||||
|
|
||||||
for ARG in "$@"; do
|
for ARG in "$@"; do
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
--clean ) cleanBuild=1 ;;
|
--clean ) cleanBuild=1 ;;
|
||||||
--clang ) useClang=1; ;;
|
--clang ) useClang=1 ;;
|
||||||
|
--cppcheck ) cppcheck=1 ;;
|
||||||
--dev|--devel ) flags+=(-DCMAKE_BUILD_TYPE=Devel) ;;
|
--dev|--devel ) flags+=(-DCMAKE_BUILD_TYPE=Devel) ;;
|
||||||
--dbg|--debug ) flags+=(-DCMAKE_BUILD_TYPE=Debug) ;;
|
--dbg|--debug ) flags+=(-DCMAKE_BUILD_TYPE=Debug) ;;
|
||||||
--strip ) flags+=(-DCMAKE_BUILD_STRIP=TRUE) ;;
|
--strip ) flags+=(-DCMAKE_BUILD_STRIP=TRUE) ;;
|
||||||
|
@ -69,8 +71,11 @@ for ARG in "$@"; do
|
||||||
echo "--gtk3 : replace GTK2 by GTK3"
|
echo "--gtk3 : replace GTK2 by GTK3"
|
||||||
echo "--no-cross-multilib: Build a native PCSX2"
|
echo "--no-cross-multilib: Build a native PCSX2"
|
||||||
echo "--clang : Build with Clang/llvm"
|
echo "--clang : Build with Clang/llvm"
|
||||||
|
echo
|
||||||
|
echo "** Quality & Assurance (Please install the external tool) **"
|
||||||
echo "--asan : Enable Address sanitizer"
|
echo "--asan : Enable Address sanitizer"
|
||||||
echo "--coverity : Do a build for coverity (require the tool)"
|
echo "--cppcheck : Do a cppcheck analysis. Results can be found in build directory"
|
||||||
|
echo "--coverity : Do a build for coverity"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
@ -123,7 +128,28 @@ else
|
||||||
ncpu=$(grep -w -c processor /proc/cpuinfo)
|
ncpu=$(grep -w -c processor /proc/cpuinfo)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$CoverityBuild" -eq 1 ]]; then
|
if [[ "$cppcheck" -eq 1 ]] && [[ -x `which cppcheck` ]]; then
|
||||||
|
summary=cpp_check_summary.log
|
||||||
|
rm -f $summary
|
||||||
|
touch $summary
|
||||||
|
|
||||||
|
define="-U_WINDOWS -U_M_AMD64 -U_MSC_VER -UWIN32"
|
||||||
|
#define="-D__linux__ -U_WINDOWS -U_M_AMD64 -U_MSC_VER -UWIN32"
|
||||||
|
check="--enable=warning,style,missingInclude"
|
||||||
|
for d in pcsx2 common plugins/GSdx plugins/spu2\-x plugins/onepad
|
||||||
|
do
|
||||||
|
flat_d=`echo $d | sed -e 's@/@_@'`
|
||||||
|
log=cpp_check__${flat_d}.log
|
||||||
|
rm -f $log
|
||||||
|
|
||||||
|
cppcheck $check -j $ncpu --platform=unix32 $define $root/$d |& tee $log
|
||||||
|
# Create a small summary (warning it might miss some issues)
|
||||||
|
fgrep -e "(warning)" -e "(error)" -e "(style)" -e "(performance)" -e "(portability)" $log >> $summary
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$CoverityBuild" -eq 1 ]] && [[ -x `which cov-build` ]]; then
|
||||||
cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a $log
|
cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a $log
|
||||||
# Warning: $coverity_dir must be the root directory
|
# Warning: $coverity_dir must be the root directory
|
||||||
(cd $build; tar caf $coverity_result $coverity_dir)
|
(cd $build; tar caf $coverity_result $coverity_dir)
|
||||||
|
|
Loading…
Reference in New Issue