Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 1 | @echo off
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 2 | rem A batch program to build or rebuild a particular configuration,
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 3 | rem just for convenience.
|
| 4 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 5 | rem Arguments:
|
| 6 | rem -c Set the configuration (default: Release)
|
| 7 | rem -p Set the platform (x64 or Win32, default: Win32)
|
| 8 | rem -r Target Rebuild instead of Build
|
| 9 | rem -t Set the target manually (Build, Rebuild, Clean, or CleanAll)
|
| 10 | rem -d Set the configuration to Debug
|
| 11 | rem -e Pull in external libraries using get_externals.bat
|
Zachary Ware | 785273c | 2015-06-10 00:43:20 -0500 | [diff] [blame] | 12 | rem -m Enable parallel build (enabled by default)
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 13 | rem -M Disable parallel build
|
| 14 | rem -v Increased output messages
|
Zachary Ware | 785273c | 2015-06-10 00:43:20 -0500 | [diff] [blame] | 15 | rem -k Attempt to kill any running Pythons before building (usually unnecessary)
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 16 |
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 17 | setlocal
|
| 18 | set platf=Win32
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 19 | set vs_platf=x86
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 20 | set conf=Release
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 21 | set target=Build
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 22 | set dir=%~dp0
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 23 | set parallel=/m
|
| 24 | set verbose=/nologo /v:m
|
Zachary Ware | 6250df8 | 2015-06-09 23:16:52 -0500 | [diff] [blame] | 25 | set kill=
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 26 |
|
| 27 | :CheckOpts
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame^] | 28 | if "%~1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts
|
| 29 | if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
|
| 30 | if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts
|
| 31 | if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts
|
| 32 | if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
|
| 33 | if "%~1"=="-e" call "%dir%get_externals.bat" & shift & goto CheckOpts
|
| 34 | if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts
|
| 35 | if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts
|
| 36 | if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts
|
| 37 | if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
|
| 38 | if "%~1"=="-V" shift & goto Version
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 39 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame^] | 40 | if "%platf%"=="x64" (set vs_platf=x86_amd64)
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 41 |
|
| 42 | rem Setup the environment
|
| 43 | call "%dir%env.bat" %vs_platf% >nul
|
| 44 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame^] | 45 | if "%kill%"=="true" (
|
Zachary Ware | 785273c | 2015-06-10 00:43:20 -0500 | [diff] [blame] | 46 | msbuild /v:m /nologo /target:KillPython "%pcbuild%\pythoncore.vcxproj" /p:Configuration=%conf% /p:Platform=%platf% /p:KillPython=true
|
Zachary Ware | 6250df8 | 2015-06-09 23:16:52 -0500 | [diff] [blame] | 47 | )
|
| 48 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 49 | rem Call on MSBuild to do the work, echo the command.
|
| 50 | rem Passing %1-9 is not the preferred option, but argument parsing in
|
| 51 | rem batch is, shall we say, "lackluster"
|
| 52 | echo on
|
| 53 | msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 54 |
|
| 55 | @goto :eof
|
| 56 |
|
| 57 | :Version
|
| 58 | rem Display the current build version information
|
| 59 | msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
|