-
Notifications
You must be signed in to change notification settings - Fork 5
/
Build.bat
100 lines (90 loc) · 3.86 KB
/
Build.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
90
91
92
93
94
95
96
97
98
99
100
@echo off
REM ///////////////////////////////////////////////////////////////////////////
REM // Set Paths
REM ///////////////////////////////////////////////////////////////////////////
set "MSVC_PATH=D:\Microsoft Visual Studio 11.0\VC"
set "QTVC_PATH=D:\Qt\4.8.4"
set "UPX3_PATH=D:\UPX"
REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
REM ###############################################
REM ///////////////////////////////////////////////////////////////////////////
REM // Setup environment
REM ///////////////////////////////////////////////////////////////////////////
if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
call "%MSVC_PATH%\vcvarsall.bat" x86
REM ///////////////////////////////////////////////////////////////////////////
REM // Check environment
REM ///////////////////////////////////////////////////////////////////////////
if "%VCINSTALLDIR%"=="" (
echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
goto BuildError
)
if "%QTDIR%"=="" (
echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
goto BuildError
)
if not exist "%VCINSTALLDIR%\bin\cl.exe" (
echo C++ compiler not found. Please check your MSVC_PATH var!
goto BuildError
)
if not exist "%QTDIR%\bin\moc.exe" (
echo Qt meta compiler not found. Please check your QTVC_PATH var!
goto BuildError
)
REM ///////////////////////////////////////////////////////////////////////////
REM // Get current date and time (in ISO format)
REM ///////////////////////////////////////////////////////////////////////////
set "ISO_DATE="
set "ISO_TIME="
if not exist "%~dp0\etc\date.exe" goto BuildError
for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
if "%%a"=="ISODATE" set "ISO_DATE=%%b"
)
for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do (
if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
)
if "%ISO_DATE%"=="" goto BuildError
if "%ISO_TIME%"=="" goto BuildError
if exist "%~dp0\out\Logger.%ISO_DATE%.zip" (
echo %~dp0\out\Logger.%ISO_DATE%.zip already exists !!!
goto BuildError
)
REM ///////////////////////////////////////////////////////////////////////////
REM // Build the binaries
REM ///////////////////////////////////////////////////////////////////////////
echo ---------------------------------------------------------------------
echo BEGIN BUILD
echo ---------------------------------------------------------------------
MSBuild.exe /property:Configuration=Release_Static /target:clean "%~dp0\LoggingUtil.sln"
if not "%ERRORLEVEL%"=="0" goto BuildError
MSBuild.exe /property:Configuration=Release_Static /target:rebuild "%~dp0\LoggingUtil.sln"
if not "%ERRORLEVEL%"=="0" goto BuildError
REM ///////////////////////////////////////////////////////////////////////////
REM // Packge fiiles
REM ///////////////////////////////////////////////////////////////////////////
echo ---------------------------------------------------------------------
echo PACKAGE FILES
echo ---------------------------------------------------------------------
"%UPX3_PATH%\UPX.exe" --brute "%~dp0\Win32\Release_Static\*.exe"
echo %ISO_DATE% %ISO_TIME% > "%~dp0\Win32\Release_Static\BUILD.tag"
"%~dp0\etc\7za.exe" a -tzip "%~dp0\out\Logger.%ISO_DATE%.zip" "@%~dp0\Build.lst"
attrib +R "%~dp0\out\Logger.%ISO_DATE%.zip"
del "%~dp0\Win32\Release_Static\BUILD.tag"
REM ///////////////////////////////////////////////////////////////////////////
REM // COMPLETE
REM ///////////////////////////////////////////////////////////////////////////
echo.
echo Build completed.
echo.
pause
goto:eof
REM ///////////////////////////////////////////////////////////////////////////
REM // FAILED
REM ///////////////////////////////////////////////////////////////////////////
:BuildError
echo.
echo Build has failed !!!
echo.
pause