| 1 |
@ECHO OFF |
| 2 |
@setlocal |
| 3 |
REM Usage: [buildbase.bat ..\vs2013\mysolution.sln 12 [Clean]] |
| 4 |
|
| 5 |
SET solution=%1 |
| 6 |
SET version=%2 |
| 7 |
|
| 8 |
:: supports passing in Clean as third argument if "make clean" behavior is desired |
| 9 |
SET target=%3 |
| 10 |
SET ACTION=Building |
| 11 |
if NOT "%target%" == "" set target=/t:%target%&set ACTION=Cleaning |
| 12 |
|
| 13 |
SET log=build_%version%.log |
| 14 |
SET tools=Microsoft Visual Studio %version%.0\VC\vcvarsall.bat |
| 15 |
if "%version%" == "15" SET tools=Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat |
| 16 |
SET environment="%programfiles(x86)%\%tools%" |
| 17 |
IF NOT EXIST %environment% SET environment="%programfiles%\%tools%" |
| 18 |
IF NOT EXIST %environment% GOTO no_tools |
| 19 |
|
| 20 |
@ECHO %ACTION% %solution% |
| 21 |
|
| 22 |
SET __CURRENT_DIR__=%CD% |
| 23 |
CALL %environment% x86 >%SystemDrive%\nul 2>&1 |
| 24 |
ECHO Platform=x86 2> %log% |
| 25 |
CD /D %__CURRENT_DIR__% |
| 26 |
SET __CURRENT_DIR__= |
| 27 |
|
| 28 |
|
| 29 |
ECHO Configuration=DynDebug |
| 30 |
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 31 |
ECHO Configuration=DynRelease |
| 32 |
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 33 |
ECHO Configuration=LtcgDebug |
| 34 |
msbuild /m /v:n /p:Configuration=LtcgDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 35 |
ECHO Configuration=LtcgRelease |
| 36 |
msbuild /m /v:n /p:Configuration=LtcgRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 37 |
ECHO Configuration=StaticDebug |
| 38 |
msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 39 |
ECHO Configuration=StaticRelease |
| 40 |
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error |
| 41 |
|
| 42 |
SET __CURRENT_DIR__=%CD% |
| 43 |
CALL %environment% x86_amd64 >%SystemDrive%\nul 2>&1 |
| 44 |
ECHO Platform=x64 |
| 45 |
CD /D %__CURRENT_DIR__% |
| 46 |
SET __CURRENT_DIR__= |
| 47 |
|
| 48 |
|
| 49 |
ECHO Configuration=DynDebug |
| 50 |
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 51 |
ECHO Configuration=DynRelease |
| 52 |
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 53 |
ECHO Configuration=LtcgDebug |
| 54 |
msbuild /m /v:n /p:Configuration=LtcgDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 55 |
ECHO Configuration=LtcgRelease |
| 56 |
msbuild /m /v:n /p:Configuration=LtcgRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 57 |
ECHO Configuration=StaticDebug |
| 58 |
msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 59 |
ECHO Configuration=StaticRelease |
| 60 |
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error |
| 61 |
|
| 62 |
ECHO %ACTION% complete: %solution% |
| 63 |
GOTO end |
| 64 |
|
| 65 |
:error |
| 66 |
ECHO *** ERROR, build terminated early, see: %log% |
| 67 |
GOTO end |
| 68 |
|
| 69 |
:no_tools |
| 70 |
ECHO *** ERROR, build tools not found: %tools% |
| 71 |
|
| 72 |
:end |
| 73 |
@endlocal |