-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathrun-cppcheck.bat
89 lines (78 loc) · 2.09 KB
/
run-cppcheck.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@echo off
set platform=%1
@rem doesn't use
set configuration=%2
if "%platform%" == "Win32" (
@rem OK
) else if "%platform%" == "x64" (
@rem OK
) else (
call :showhelp %0
exit /b 1
)
if "%configuration%" == "Release" (
@rem OK
) else if "%configuration%" == "Debug" (
@rem OK
) else (
call :showhelp %0
exit /b 1
)
call %~dp0tools\find-tools.bat
if not defined CMD_CPPCHECK (
echo cppcheck.exe was not found. so skip to run it.
exit /b 0
)
set CPPCHECK_OUT=cppcheck-%platform%-%configuration%.xml
set CPPCHECK_LOG=cppcheck-%platform%-%configuration%.log
set CPPCHECK_PLATFORM=
if "%PLATFORM%" == "Win32" (
set CPPCHECK_PLATFORM=win32W
) else if "%PLATFORM%" == "x64" (
set CPPCHECK_PLATFORM=win64
) else (
@echo not supported platform
exit /b 1
)
if exist "%CPPCHECK_OUT%" (
del %CPPCHECK_OUT%
)
if exist "%CPPCHECK_LOG%" (
del %CPPCHECK_LOG%
)
set CPPCHECK_PARAMS=
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% --force
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% --enable=all
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% --xml
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% --platform=%CPPCHECK_PLATFORM%
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% --output-file=%CPPCHECK_OUT%
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% -j %NUMBER_OF_PROCESSORS%
set CPPCHECK_PARAMS=%CPPCHECK_PARAMS% %~dp0sakura_core
set ERROR_RESULT=0
if exist "%CMD_CPPCHECK%" (
@echo "%CMD_CPPCHECK%" %CPPCHECK_PARAMS%
"%CMD_CPPCHECK%" %CPPCHECK_PARAMS% > %CPPCHECK_LOG% || set ERROR_RESULT=1
@echo.
@echo The log files are %CPPCHECK_LOG% and %CPPCHECK_OUT%
@echo cppcheck success
)
exit /b %ERROR_RESULT%
@rem ------------------------------------------------------------------------------
@rem show help
@rem see http://orangeclover.hatenablog.com/entry/20101004/1286120668
@rem ------------------------------------------------------------------------------
:showhelp
@echo off
@echo usage
@echo %~nx1 platform configuration
@echo.
@echo parameter
@echo platform : Win32 or x64
@echo configuration : Release or Debug
@echo.
@echo example
@echo %~nx1 Win32 Release
@echo %~nx1 Win32 Debug
@echo %~nx1 x64 Release
@echo %~nx1 x64 Debug
exit /b 0