1@echo off
2rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@gmail.com>
3
4@rem this stupid command needed for SetEnv.cmd to operate
5setlocal ENABLEDELAYEDEXPANSION
6
7cd /d %0\..
8call msvc-env.bat
9
10set PLATFORMS=Win32
11set CONFIGURATIONS=Release
12
13if exist "%VCHOME%\vcvarsall.bat" (
14	call "%VCHOME%\vcvarsall.bat"
15) else if exist "%VCHOME%\bin\vcvars32.bat" (
16	call "%VCHOME%\bin\vcvars32.bat"
17) else (
18	echo Cannot detect visual studio
19	goto error
20)
21
22msbuild /help > nul 2>&1
23if errorlevel 1 set DO_VCBUILD=1
24
25for %%p in (%PLATFORMS%) do (
26	for %%c in (%CONFIGURATIONS%) do (
27		rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1
28
29		if "%DO_VCBUILD%" NEQ "" (
30			vcbuild /errfile:error.log /showenv "%SOLUTION%" /rebuild /platform:%%p "%%c|%%p"
31			for %%f in (error.log) do if %%~zf GTR 0 goto error
32		) else  (
33			msbuild "%SOLUTION%" /p:Configuration="%%c" /p:Platform="%%p"
34			if errorlevel 1 goto error
35		)
36	)
37)
38
39exit /b 0
40goto end
41
42:error
43exit /b 1
44goto end
45
46:end
47
48endlocal
49