2 REM ///////////////////////////////////////////////////////////////////////////
4 REM ///////////////////////////////////////////////////////////////////////////
5 set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
6 set "QTVC_PATH=C:\Qt\4.8.7"
8 REM ###############################################
9 REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
10 REM ###############################################
13 REM ///////////////////////////////////////////////////////////////////////////
14 REM // Setup environment
15 REM ///////////////////////////////////////////////////////////////////////////
16 if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
17 if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
18 call "%MSVC_PATH%\vcvarsall.bat" x86
20 REM ///////////////////////////////////////////////////////////////////////////
21 REM // Check environment
22 REM ///////////////////////////////////////////////////////////////////////////
23 if "%VCINSTALLDIR%"=="" (
24 echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
28 echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
31 if not exist "%VCINSTALLDIR%\bin\cl.exe" (
32 echo C++ compiler not found. Please check your MSVC_PATH var!
35 if not exist "%QTDIR%\bin\moc.exe" (
36 echo Qt meta compiler not found. Please check your QTVC_PATH var!
40 REM ///////////////////////////////////////////////////////////////////////////
41 REM // Get current date and time (in ISO format)
42 REM ///////////////////////////////////////////////////////////////////////////
45 if not exist "%~dp0\..\Prerequisites\GnuWin32\date.exe" BuildError
46 for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Prerequisites\GnuWin32\date.exe" +ISODATE:%%Y-%%m-%%d') do (
47 if "%%a"=="ISODATE" set "ISO_DATE=%%b"
49 for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\..\Prerequisites\GnuWin32\date.exe" +ISOTIME:%%T') do (
50 if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
52 if "%ISO_DATE%"=="" goto BuildError
53 if "%ISO_TIME%"=="" goto BuildError
55 REM ///////////////////////////////////////////////////////////////////////////
56 REM // Build the binaries
57 REM ///////////////////////////////////////////////////////////////////////////
58 echo ---------------------------------------------------------------------
60 echo ---------------------------------------------------------------------
61 MSBuild.exe /property:Configuration=Release_Static /target:clean "%~dp0\DoubleFileScanner.sln"
62 if not "%ERRORLEVEL%"=="0" goto BuildError
63 MSBuild.exe /property:Configuration=Release_Static /target:rebuild "%~dp0\DoubleFileScanner.sln"
64 if not "%ERRORLEVEL%"=="0" goto BuildError
65 MSBuild.exe /property:Configuration=Release_Static /target:build "%~dp0\DoubleFileScanner.sln"
66 if not "%ERRORLEVEL%"=="0" goto BuildError
68 REM ///////////////////////////////////////////////////////////////////////////
69 REM // Copy base files
70 REM ///////////////////////////////////////////////////////////////////////////
71 echo ---------------------------------------------------------------------
73 echo ---------------------------------------------------------------------
74 set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
76 copy "%~dp0\bin\Win32\Release_Static\*.exe" "%PACK_PATH%"
77 copy "%~dp0\*.txt" "%PACK_PATH%"
78 copy "%~dp0\*.html" "%PACK_PATH%"
81 REM ///////////////////////////////////////////////////////////////////////////
83 REM ///////////////////////////////////////////////////////////////////////////
84 "%~dp0\..\Prerequisites\UPX\upx.exe" --best "%PACK_PATH%\*.exe"
86 REM ///////////////////////////////////////////////////////////////////////////
88 REM ///////////////////////////////////////////////////////////////////////////
89 attrib +R "%PACK_PATH%\*.exe"
90 attrib +R "%PACK_PATH%\*.html"
91 attrib +R "%PACK_PATH%\*.txt"
93 REM ///////////////////////////////////////////////////////////////////////////
94 REM // Generate outfile name
95 REM ///////////////////////////////////////////////////////////////////////////
97 set "OUT_NAME=DoubleFileScanner.%ISO_DATE%"
99 if exist "%~dp0\out\%OUT_NAME%.zip" (
100 set "OUT_NAME=%OUT_NAME%.new"
104 REM ///////////////////////////////////////////////////////////////////////////
105 REM // Create version tag
106 REM ///////////////////////////////////////////////////////////////////////////
107 echo Double File Scanner > "%~dp0\out\%OUT_NAME%.txt"
108 echo Copyright (C) 2017 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%~dp0\out\%OUT_NAME%.txt"
109 echo Built %ISO_DATE%, %TIME% >> "%~dp0\out\%OUT_NAME%.txt"
110 echo. >> "%~dp0\out\%OUT_NAME%.txt"
111 echo This program is free software; you can redistribute it and/or modify >> "%~dp0\out\%OUT_NAME%.txt"
112 echo it under the terms of the GNU General Public License as published by >> "%~dp0\out\%OUT_NAME%.txt"
113 echo the Free Software Foundation; either version 2 of the License, or >> "%~dp0\out\%OUT_NAME%.txt"
114 echo (at your option) any later version. >> "%~dp0\out\%OUT_NAME%.txt"
116 REM ///////////////////////////////////////////////////////////////////////////
117 REM // Build the package
118 REM ///////////////////////////////////////////////////////////////////////////
120 "%~dp0\..\Prerequisites\GnuWin32\zip.exe" -9 -r -z "%~dp0\out\%OUT_NAME%.zip" "*.*" < "%~dp0\out\%OUT_NAME%.txt"
122 rmdir /Q /S "%PACK_PATH%"
123 attrib +R "%~dp0\out\%OUT_NAME%.zip"
124 del "%~dp0\out\%OUT_NAME%.txt"
126 REM ///////////////////////////////////////////////////////////////////////////
128 REM ///////////////////////////////////////////////////////////////////////////
130 echo Build completed.
135 REM ///////////////////////////////////////////////////////////////////////////
137 REM ///////////////////////////////////////////////////////////////////////////
140 echo Build has failed !!!