2 REM ///////////////////////////////////////////////////////////////////////////
4 REM ///////////////////////////////////////////////////////////////////////////
5 set "MSVC_PATH=C:\Program Files\Microsoft Visual Studio 12.0\VC"
6 set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
7 set "QTVC_PATH=C:\Qt\4.8.5"
8 set "UPX3_PATH=C:\Program Files\UPX"
10 REM ###############################################
11 REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
12 REM ###############################################
15 REM ///////////////////////////////////////////////////////////////////////////
16 REM // Setup environment
17 REM ///////////////////////////////////////////////////////////////////////////
18 if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
19 if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
20 call "%MSVC_PATH%\vcvarsall.bat" x86
22 REM ///////////////////////////////////////////////////////////////////////////
23 REM // Check environment
24 REM ///////////////////////////////////////////////////////////////////////////
25 if "%VCINSTALLDIR%"=="" (
26 echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
30 echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
33 if not exist "%VCINSTALLDIR%\bin\cl.exe" (
34 echo C++ compiler not found. Please check your MSVC_PATH var!
37 if not exist "%QTDIR%\bin\moc.exe" (
38 echo Qt meta compiler not found. Please check your QTVC_PATH var!
41 if not exist "%PDOC_PATH%\pandoc.exe" (
42 echo Pandoc binary could not be found. Please check your PDOC_PATH var!
46 REM ///////////////////////////////////////////////////////////////////////////
47 REM // Get current date and time (in ISO format)
48 REM ///////////////////////////////////////////////////////////////////////////
51 if not exist "%~dp0\etc\date.exe" BuildError
52 for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
53 if "%%a"=="ISODATE" set "ISO_DATE=%%b"
55 for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do (
56 if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
58 if "%ISO_DATE%"=="" goto BuildError
59 if "%ISO_TIME%"=="" goto BuildError
61 REM ///////////////////////////////////////////////////////////////////////////
62 REM // Build the binaries
63 REM ///////////////////////////////////////////////////////////////////////////
64 echo ---------------------------------------------------------------------
66 echo ---------------------------------------------------------------------
67 MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher_MSVC2013.sln"
68 if not "%ERRORLEVEL%"=="0" goto BuildError
69 MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher_MSVC2013.sln"
70 if not "%ERRORLEVEL%"=="0" goto BuildError
72 REM ///////////////////////////////////////////////////////////////////////////
73 REM // Detect build number
74 REM ///////////////////////////////////////////////////////////////////////////
76 for /F "tokens=2,*" %%s in (%~dp0\src\version.h) do (
77 if "%%s"=="VER_X264_BUILD" set "BUILD_NO=%%~t"
79 if "%BUILD_NO%"=="" goto BuildError
81 REM ///////////////////////////////////////////////////////////////////////////
82 REM // Copy base files
83 REM ///////////////////////////////////////////////////////////////////////////
84 echo ---------------------------------------------------------------------
86 echo ---------------------------------------------------------------------
87 set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
89 mkdir "%PACK_PATH%\imageformats"
90 mkdir "%PACK_PATH%\toolset\x86"
91 mkdir "%PACK_PATH%\toolset\x64"
92 mkdir "%PACK_PATH%\toolset\common"
93 mkdir "%PACK_PATH%\sources"
94 copy "%~dp0\bin\Release\*.exe" "%PACK_PATH%"
95 copy "%~dp0\bin\Release\toolset\x86\*.exe" "%PACK_PATH%\toolset\x86"
96 copy "%~dp0\bin\Release\toolset\x86\*.dll" "%PACK_PATH%\toolset\x86"
97 copy "%~dp0\bin\Release\toolset\x64\*.exe" "%PACK_PATH%\toolset\x64"
98 copy "%~dp0\bin\Release\toolset\x64\*.dll" "%PACK_PATH%\toolset\x64"
99 copy "%~dp0\bin\Release\toolset\common\*.exe" "%PACK_PATH%\toolset\common"
100 copy "%~dp0\bin\Release\toolset\common\*.gpg" "%PACK_PATH%\toolset\common"
101 copy "%~dp0\etc\sources\*.tar" "%PACK_PATH%\sources"
102 copy "%~dp0\LICENSE.html" "%PACK_PATH%"
103 copy "%~dp0\*.txt" "%PACK_PATH%"
105 REM ///////////////////////////////////////////////////////////////////////////
106 REM // Copy dependencies
107 REM ///////////////////////////////////////////////////////////////////////////
108 for %%i in (100, 110, 120) do (
109 if exist "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\*.dll" (
110 copy "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\msvc?%%i.dll" "%PACK_PATH%"
113 copy "%QTVC_PATH%\bin\QtCore4.dll" "%PACK_PATH%"
114 copy "%QTVC_PATH%\bin\QtGui4.dll" "%PACK_PATH%"
115 copy "%QTVC_PATH%\bin\QtSvg4.dll" "%PACK_PATH%"
116 copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
117 copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
118 copy "%QTVC_PATH%\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
119 del "%PACK_PATH%\imageformats\*d4.dll"
121 REM ///////////////////////////////////////////////////////////////////////////
123 REM ///////////////////////////////////////////////////////////////////////////
124 "%PDOC_PATH%\pandoc.exe" --from markdown_github+header_attributes --to html5 --standalone -H "%~dp0\etc\css\style.inc" "%~dp0\README.md" --output "%PACK_PATH%\README.html"
126 REM ///////////////////////////////////////////////////////////////////////////
128 REM ///////////////////////////////////////////////////////////////////////////
129 "%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
130 "%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
132 REM ///////////////////////////////////////////////////////////////////////////
134 REM ///////////////////////////////////////////////////////////////////////////
135 attrib +R "%PACK_PATH%\*.exe"
136 attrib +R "%PACK_PATH%\*.dll"
137 attrib +R "%PACK_PATH%\*.txt"
138 attrib +R "%PACK_PATH%\*.html"
140 REM ///////////////////////////////////////////////////////////////////////////
141 REM // Setup install parameters
142 REM ///////////////////////////////////////////////////////////////////////////
143 mkdir "%~dp0\out" 2> NUL
144 set "OUT_PATH=%~dp0\out\x264_launcher.%ISO_DATE%"
146 if exist "%OUT_PATH%.exe" (
147 set "OUT_PATH=%OUT_PATH%.new"
148 goto GenerateOutfileName
150 if exist "%OUT_PATH%.sfx" (
151 set "OUT_PATH=%OUT_PATH%.new"
152 goto GenerateOutfileName
154 if exist "%OUT_PATH%.zip" (
155 set "OUT_PATH=%OUT_PATH%.new"
156 goto GenerateOutfileName
159 REM ///////////////////////////////////////////////////////////////////////////
161 REM ///////////////////////////////////////////////////////////////////////////
162 echo Simple x264/x265 Launcher - graphical front-end for x264 and x265 > "%PACK_PATH%\BUILD_TAG.txt"
163 echo Copyright (C) 2004-2014 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%PACK_PATH%\BUILD_TAG.txt"
164 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
165 echo Build #%BUILD_NO%, created on %ISO_DATE% at %ISO_TIME% >> "%PACK_PATH%\BUILD_TAG.txt"
166 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
167 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
168 "%~dp0\etc\cat.exe" "%~dp0\etc\setup\build.nfo" >> "%PACK_PATH%\BUILD_TAG.txt"
170 REM ///////////////////////////////////////////////////////////////////////////
171 REM // Build the installer
172 REM ///////////////////////////////////////////////////////////////////////////
173 "%NSIS_PATH%\makensis.exe" "/DX264_UPX_PATH=%UPX3_PATH%" "/DX264_DATE=%ISO_DATE%" "/DX264_BUILD=%BUILD_NO%" "/DX264_OUTPUT_FILE=%OUT_PATH%.sfx" "/DX264_SOURCE_PATH=%PACK_PATH%" "%~dp0\etc\setup\setup.nsi"
174 if not "%ERRORLEVEL%"=="0" goto BuildError
176 "%NSIS_PATH%\makensis.exe" "/DX264_UPX_PATH=%UPX3_PATH%" "/DX264_DATE=%ISO_DATE%" "/DX264_BUILD=%BUILD_NO%" "/DX264_OUTPUT_FILE=%OUT_PATH%.exe" "/DX264_SOURCE_FILE=%OUT_PATH%.sfx" "%~dp0\etc\setup\wrapper.nsi"
177 if not "%ERRORLEVEL%"=="0" goto BuildError
179 attrib +R "%OUT_PATH%.exe"
180 attrib +R "%OUT_PATH%.sfx"
182 REM ///////////////////////////////////////////////////////////////////////////
183 REM // Build ZIP package
184 REM ///////////////////////////////////////////////////////////////////////////
186 "%~dp0\etc\zip.exe" -r -9 -z "%OUT_PATH%.zip" "*.*" < "%PACK_PATH%\BUILD_TAG.txt"
189 if not "%ERRORLEVEL%"=="0" goto BuildError
190 attrib +R "%OUT_PATH%.zip"
192 REM ///////////////////////////////////////////////////////////////////////////
194 REM ///////////////////////////////////////////////////////////////////////////
195 rmdir /Q /S "%PACK_PATH%"
197 REM ///////////////////////////////////////////////////////////////////////////
199 REM ///////////////////////////////////////////////////////////////////////////
201 echo Build completed.
206 REM ///////////////////////////////////////////////////////////////////////////
208 REM ///////////////////////////////////////////////////////////////////////////
211 echo Build has failed !!!