summaryrefslogtreecommitdiff
path: root/openvpn/msvc-build.bat
blob: 01417d1b3403cf5d5bb4690928edcab8a6ce6448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
rem Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@gmail.com>

@rem this stupid command needed for SetEnv.cmd to operate
setlocal ENABLEDELAYEDEXPANSION

call msvc-env.bat

set PLATFORMS=Win32
set CONFIGURATIONS=Release

if exist "%VCHOME%\vcvarsall.bat" (
	call "%VCHOME%\vcvarsall.bat"
) else if exist "%VCHOME%\bin\vcvars32.bat" (
	call "%VCHOME%\bin\vcvars32.bat"
) else (
	echo Cannot detect visual studio
	goto error
)

msbuild /help > nul 2>&1
if errorlevel 1 set DO_VCBUILD=1

for %%p in (%PLATFORMS%) do (
	for %%c in (%CONFIGURATIONS%) do (
		rmdir /q /s %SOURCEBASE%\%%p\%%c > nul 2>&1

		if "%DO_VCBUILD%" NEQ "" (
			vcbuild /errfile:error.log /showenv "%SOLUTION%" /rebuild /platform:%%p "%%c|%%p"
			for %%f in (error.log) do if %%~zf GTR 0 goto error
		) else  (
			msbuild "%SOLUTION%" /p:Configuration="%%c" /p:Platform="%%p"
			if errorlevel 1 goto error
		)
	)
)

exit /b 0
goto end

:error
exit /b 1
goto end

:end

endlocal