1@echo off 2 3rem change to the directory of this batch file 4ECHO -------------------------------- 5ECHO Changing to build folder [%~dp0] p1 ["%1"] p2 ["%2"] 6rem pause 7cd /d "%~dp0" 8 9ECHO Checking for windows binary runtime tools... 10if NOT EXIST .\7z.exe call cscript getTools.vbs 11if NOT EXIST .\7z.dll call cscript getTools.vbs 12if NOT EXIST .\tar.exe call cscript getTools.vbs 13if NOT EXIST .\wget.exe call cscript getTools.vbs 14 15set depfolder=windows_deps 16set depfile=%depfolder%.7z 17 18dir ..\..\source\ 19if NOT EXIST ..\..\source\%depfolder%\NUL echo folder not found [%depfolder%] 20if NOT EXIST ..\..\source\%depfolder%\NUL goto checkDepIntegrity 21goto processBuildStageA 22 23:getDepFile 24ECHO Retrieving windows dependency archive... 25call .\wget.exe -c -O ..\..\source\%depfile% http://github.com/MegaGlest/megaglest-source/releases/download/3.2.3/%depfile% 26call .\7z.exe x -r -o..\..\source\ ..\..\source\%depfile% 27goto processBuildStageA 28 29:checkDepIntegrity 30ECHO Looking for windows dependency archive... 31call .\7z.exe t ..\..\source\%depfile% >nul 32set 7ztestdep=%ERRORLEVEL% 33ECHO Result of windows dependency archive [%7ztestdep%] 34if NOT "%7ztestdep%" == "0" goto getDepFile 35goto processBuildStageA 36 37:processBuildStageA 38call CopyWindowsRuntimeDlls_2010.bat nopause 39 40rem setup the Visual Studio 2010 environment 41ECHO -------------------------------- 42ECHO Setting up Visual Studio 2010 environment vars... 43REM Ensure ultifds HP doesn't mess the build up 44SET Platform= 45if "%DevEnvDir%." == "." goto SETVCVARS 46GOTO GITSECTION 47 48:SETVCVARS 49 50IF EXIST "%VS100COMNTOOLS%..\..\" GOTO VC_Common 51IF EXIST "\Program Files\Microsoft Visual Studio 10.0\" GOTO VC_32 52IF EXIST "\Program Files (x86)\Microsoft Visual Studio 10.0\" GOTO VC_64 53goto GITSECTION 54 55:VC_Common 56call "%VS100COMNTOOLS%..\..\vc\vcvarsall.bat" 57goto GITSECTION 58 59:VC_32 60ECHO 32 bit Windows detected... 61call "\Program Files\Microsoft Visual Studio 10.0\vc\vcvarsall.bat" 62goto GITSECTION 63 64:VC_64 65ECHO 64 bit Windows detected... 66call "\Program Files (x86)\Microsoft Visual Studio 10.0\vc\vcvarsall.bat" 67goto GITSECTION 68 69 70:GITSECTION 71rem Update from GIT to latest rev 72ECHO -------------------------------- 73Echo Updating Code from GIT to latest Revision... 74cd ..\..\ 75set GIT_NORM_BRANCH=. 76for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a 77if "%GIT_NORM_BRANCH%" == "." git pull 78cd data\glest_game 79set GIT_NORM_BRANCH=. 80for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a 81if "%GIT_NORM_BRANCH%" == "." git pull 82cd ..\..\ 83git submodule update 84 85set GITVERSION_SHA1=. 86set GITVERSION_REV=. 87set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7" 88for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a 89for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a 90ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%] 91cd mk\windoze 92rem pause 93 94ECHO -------------------------------- 95Echo Touching the build date/time file so we get proper build stamp 96rem touch ..\..\source\glest_game\facilities\game_util.cpp 97copy /b ..\..\source\glest_game\facilities\game_util.cpp +,, 98 99rem Build Mega-Glest in release mode 100ECHO -------------------------------- 101Echo Building MegaGlest using Visual Studio 2010... 102 103set CL= 104del ..\..\source\glest_game\facilities\gitversion.h 105 106if not "%GITVERSION_SHA1%" == "." set CL=/DGITVERSIONHEADER 107if not "%GITVERSION_SHA1%" == "." echo building with CL [%CL%] 108if not "%GITVERSION_SHA1%" == "." echo #define GITVERSION "%GITVERSION_REV%.%GITVERSION_SHA1%" > ..\..\source\glest_game\facilities\gitversion.h 109if not "%GITVERSION_SHA1%" == "." copy /b ..\..\source\glest_game\facilities\game_util.cpp +,, 110 111del /Q /F Release\*.tlog 112 113set msBuildMaxCPU= 114SET BuildInParallel=false 115SET BuildInParallelCount= 116rem /m:%MultiprocMSBuildCount% 117if %NUMBER_OF_PROCESSORS% GTR 1 ( 118 SET NumberOfProcessesToUseForBuild=2 119 SET BuildInParallel=true 120 SET BuildInParallelCount=/m:2 121 SET msBuildMaxCPU=/maxcpucount) 122 123ECHO Found CPU Count [%NUMBER_OF_PROCESSORS%] BuildInParallel = [%BuildInParallel%] 124if "%2" == "rebuild" echo Doing a FULL REBUILD... 125rem if "%2" == "rebuild" msbuild /detailedsummary %msBuildMaxCPU% /p:BuildInParallel=%BuildInParallel% /p:Configuration=Release /t:Rebuild Glest_vc2010.sln 126if "%2" == "rebuild" msbuild %msBuildMaxCPU% %BuildInParallelCount% /p:TrackFileAccess=false;Configuration=Release /t:Rebuild Glest_vc2010.sln 127rem if not "%2" == "rebuild" msbuild /detailedsummary %msBuildMaxCPU% /p:BuildInParallel=%BuildInParallel% /p:Configuration=Release Glest_vc2010.sln 128if not "%2" == "rebuild" msbuild %msBuildMaxCPU% %BuildInParallelCount% /p:TrackFileAccess=false;Configuration=Release Glest_vc2010.sln 129 130rem pause execution so we can see the output before the batch file exits 131if not "%1" == "nopause" pause 132