@echo off REM /////////////////////////////////////////////////////////////////////////// REM // Set Paths REM /////////////////////////////////////////////////////////////////////////// set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC" set "QTVC_PATH=C:\Qt\4.8.4" set "UPX3_PATH=C:\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" 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 REM /////////////////////////////////////////////////////////////////////////// REM // Build the binaries REM /////////////////////////////////////////////////////////////////////////// echo --------------------------------------------------------------------- echo BEGIN BUILD echo --------------------------------------------------------------------- MSBuild.exe /property:Configuration=release /target:clean "%~dp0\MediaInfoXP.sln" if not "%ERRORLEVEL%"=="0" goto BuildError MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\MediaInfoXP.sln" if not "%ERRORLEVEL%"=="0" goto BuildError MSBuild.exe /property:Configuration=release /target:build "%~dp0\MediaInfoXP.sln" if not "%ERRORLEVEL%"=="0" goto BuildError REM /////////////////////////////////////////////////////////////////////////// REM // Copy base files REM /////////////////////////////////////////////////////////////////////////// echo --------------------------------------------------------------------- echo BEGIN PACKAGING echo --------------------------------------------------------------------- set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp" mkdir "%PACK_PATH%" copy "%~dp0\bin\Win32\Release\*.exe" "%PACK_PATH%" copy "%~dp0\Copying.txt" "%PACK_PATH%" copy "%~dp0\doc\*.txt" "%PACK_PATH%" copy "%~dp0\doc\*.html" "%PACK_PATH%" REM /////////////////////////////////////////////////////////////////////////// REM // Compress REM /////////////////////////////////////////////////////////////////////////// "%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.exe" REM /////////////////////////////////////////////////////////////////////////// REM // Attributes REM /////////////////////////////////////////////////////////////////////////// attrib +R "%PACK_PATH%\*.exe" attrib +R "%PACK_PATH%\*.html" attrib +R "%PACK_PATH%\*.txt" REM /////////////////////////////////////////////////////////////////////////// REM // Build the installer REM /////////////////////////////////////////////////////////////////////////// "%~dp0\etc\7za.exe" a -mm=Deflate -mfb=258 -mpass=15 -r "%~dp0\out\MediaInfo-GUI.%ISO_DATE%.zip" "%PACK_PATH%\*.*" rmdir /Q /S "%PACK_PATH%" REM /////////////////////////////////////////////////////////////////////////// REM // COMPLETE REM /////////////////////////////////////////////////////////////////////////// echo. echo Build completed. echo. pause goto:eof REM /////////////////////////////////////////////////////////////////////////// REM // FAILED REM /////////////////////////////////////////////////////////////////////////// :BuildError echo. echo Build has failed !!! echo. pause