buildbase.bat 2.7 KB
Newer Older
evoskuil's avatar
evoskuil committed
1
@ECHO OFF
2 3
@setlocal
REM Usage: [buildbase.bat ..\vs2013\mysolution.sln 12 [Clean]]
evoskuil's avatar
evoskuil committed
4 5 6

SET solution=%1
SET version=%2
7 8 9 10 11 12

:: supports passing in Clean as third argument if "make clean" behavior is desired
SET target=%3
SET ACTION=Building
if NOT "%target%" == "" set target=/t:%target%&set ACTION=Cleaning

evoskuil's avatar
evoskuil committed
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 17 18
SET environment="%programfiles(x86)%\%tools%"
IF NOT EXIST %environment% SET environment="%programfiles%\%tools%"
IF NOT EXIST %environment% GOTO no_tools
evoskuil's avatar
evoskuil committed
19

20
@ECHO %ACTION% %solution%
21

22
SET __CURRENT_DIR__=%CD%
23 24
CALL %environment% x86 >%SystemDrive%\nul 2>&1
ECHO Platform=x86 2> %log%
25 26 27
CD /D %__CURRENT_DIR__%
SET __CURRENT_DIR__=

evoskuil's avatar
evoskuil committed
28 29

ECHO Configuration=DynDebug
30
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
31
ECHO Configuration=DynRelease
32
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
33
ECHO Configuration=LtcgDebug
34
msbuild /m /v:n /p:Configuration=LtcgDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
35
ECHO Configuration=LtcgRelease
36
msbuild /m /v:n /p:Configuration=LtcgRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
37
ECHO Configuration=StaticDebug
38
msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
39
ECHO Configuration=StaticRelease
40
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=Win32 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
41

42
SET __CURRENT_DIR__=%CD%
43
CALL %environment% x86_amd64 >%SystemDrive%\nul 2>&1
evoskuil's avatar
evoskuil committed
44
ECHO Platform=x64
45 46 47
CD /D %__CURRENT_DIR__%
SET __CURRENT_DIR__=

evoskuil's avatar
evoskuil committed
48 49

ECHO Configuration=DynDebug
50
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
51
ECHO Configuration=DynRelease
52
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
53
ECHO Configuration=LtcgDebug
54
msbuild /m /v:n /p:Configuration=LtcgDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
55
ECHO Configuration=LtcgRelease
56
msbuild /m /v:n /p:Configuration=LtcgRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
57
ECHO Configuration=StaticDebug
58
msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
59
ECHO Configuration=StaticRelease
60
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=x64 %solution% %target%>> %log% || GOTO error
evoskuil's avatar
evoskuil committed
61

62
ECHO %ACTION% complete: %solution%
evoskuil's avatar
evoskuil committed
63 64 65
GOTO end

:error
66 67 68 69 70
ECHO *** ERROR, build terminated early, see: %log%
GOTO end

:no_tools
ECHO *** ERROR, build tools not found: %tools%
evoskuil's avatar
evoskuil committed
71 72

:end
73
@endlocal