blob: 0fb01d777d7ea1ab47edf0b82b893234e70d5d14 [file] [log] [blame]
Zachary Ware4c9c8482015-04-13 11:59:54 -05001@echo off
Zachary Ware774ac372015-04-13 12:11:40 -05002rem A batch program to build or rebuild a particular configuration,
Zachary Ware4c9c8482015-04-13 11:59:54 -05003rem just for convenience.
4
Zachary Ware774ac372015-04-13 12:11:40 -05005rem Arguments:
6rem -c Set the configuration (default: Release)
7rem -p Set the platform (x64 or Win32, default: Win32)
8rem -r Target Rebuild instead of Build
9rem -t Set the target manually (Build, Rebuild, Clean, or CleanAll)
10rem -d Set the configuration to Debug
11rem -e Pull in external libraries using get_externals.bat
Zachary Ware785273c2015-06-10 00:43:20 -050012rem -m Enable parallel build (enabled by default)
Zachary Ware774ac372015-04-13 12:11:40 -050013rem -M Disable parallel build
14rem -v Increased output messages
Zachary Ware785273c2015-06-10 00:43:20 -050015rem -k Attempt to kill any running Pythons before building (usually unnecessary)
Zachary Ware774ac372015-04-13 12:11:40 -050016
Zachary Ware4c9c8482015-04-13 11:59:54 -050017setlocal
18set platf=Win32
Zachary Ware774ac372015-04-13 12:11:40 -050019set vs_platf=x86
Zachary Ware4c9c8482015-04-13 11:59:54 -050020set conf=Release
Zachary Ware774ac372015-04-13 12:11:40 -050021set target=Build
Zachary Ware4c9c8482015-04-13 11:59:54 -050022set dir=%~dp0
Zachary Ware774ac372015-04-13 12:11:40 -050023set parallel=/m
24set verbose=/nologo /v:m
Zachary Ware6250df82015-06-09 23:16:52 -050025set kill=
Zachary Ware4c9c8482015-04-13 11:59:54 -050026
27:CheckOpts
Steve Dowere1f68052015-07-20 21:34:45 -070028if "%~1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts
29if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
30if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts
31if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts
32if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
33if "%~1"=="-e" call "%dir%get_externals.bat" & shift & goto CheckOpts
34if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts
35if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts
36if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts
37if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
38if "%~1"=="-V" shift & goto Version
Zachary Ware4c9c8482015-04-13 11:59:54 -050039
Steve Dowere1f68052015-07-20 21:34:45 -070040if "%platf%"=="x64" (set vs_platf=x86_amd64)
Zachary Ware774ac372015-04-13 12:11:40 -050041
42rem Setup the environment
43call "%dir%env.bat" %vs_platf% >nul
44
Steve Dowere1f68052015-07-20 21:34:45 -070045if "%kill%"=="true" (
Zachary Ware785273c2015-06-10 00:43:20 -050046 msbuild /v:m /nologo /target:KillPython "%pcbuild%\pythoncore.vcxproj" /p:Configuration=%conf% /p:Platform=%platf% /p:KillPython=true
Zachary Ware6250df82015-06-09 23:16:52 -050047)
48
Zachary Ware774ac372015-04-13 12:11:40 -050049rem Call on MSBuild to do the work, echo the command.
50rem Passing %1-9 is not the preferred option, but argument parsing in
51rem batch is, shall we say, "lackluster"
52echo on
53msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
Steve Dower49437492015-07-08 20:18:44 -070054
55@goto :eof
56
57:Version
58rem Display the current build version information
59msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9