Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 1 | @echo off
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame^] | 2 | goto Run
|
| 3 | :Usage
|
| 4 | echo.%~nx0 [flags and arguments] [quoted MSBuild options]
|
| 5 | echo.
|
| 6 | echo.Build CPython from the command line. Requires the appropriate
|
| 7 | echo.version(s) of Microsoft Visual Studio to be installed (see readme.txt).
|
| 8 | echo.Also requires Subversion (svn.exe) to be on PATH if the '-e' flag is
|
| 9 | echo.given.
|
| 10 | echo.
|
| 11 | echo.After the flags recognized by this script, up to 9 arguments to be passed
|
| 12 | echo.directly to MSBuild may be passed. If the argument contains an '=', the
|
| 13 | echo.entire argument must be quoted (e.g. `%~nx0 "/p:PlatformToolset=v100"`)
|
| 14 | echo.
|
| 15 | echo.Available flags:
|
| 16 | echo. -h Display this help message
|
| 17 | echo. -V Display version information for the current build
|
| 18 | echo. -r Target Rebuild instead of Build
|
| 19 | echo. -d Set the configuration to Debug
|
| 20 | echo. -e Build external libraries fetched by get_externals.bat
|
| 21 | echo. -m Enable parallel build (enabled by default)
|
| 22 | echo. -M Disable parallel build
|
| 23 | echo. -v Increased output messages
|
| 24 | echo. -k Attempt to kill any running Pythons before building (usually done
|
| 25 | echo. automatically by the pythoncore project)
|
| 26 | echo.
|
| 27 | echo.Available arguments:
|
| 28 | echo. -c Release ^| Debug ^| PGInstrument ^| PGUpdate
|
| 29 | echo. Set the configuration (default: Release)
|
| 30 | echo. -p x64 ^| Win32
|
| 31 | echo. Set the platform (default: Win32)
|
| 32 | echo. -t Build ^| Rebuild ^| Clean ^| CleanAll
|
| 33 | echo. Set the target manually
|
| 34 | exit /b 127
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 35 |
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame^] | 36 | :Run
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 37 | setlocal
|
| 38 | set platf=Win32
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 39 | set vs_platf=x86
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 40 | set conf=Release
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 41 | set target=Build
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 42 | set dir=%~dp0
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 43 | set parallel=/m
|
| 44 | set verbose=/nologo /v:m
|
Zachary Ware | 6250df8 | 2015-06-09 23:16:52 -0500 | [diff] [blame] | 45 | set kill=
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 46 |
|
| 47 | :CheckOpts
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame^] | 48 | if "%~1"=="-h" goto Usage
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 49 | if "%~1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts
|
| 50 | if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
|
| 51 | if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts
|
| 52 | if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts
|
| 53 | if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
|
| 54 | if "%~1"=="-e" call "%dir%get_externals.bat" & shift & goto CheckOpts
|
| 55 | if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts
|
| 56 | if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts
|
| 57 | if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts
|
| 58 | if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
|
| 59 | if "%~1"=="-V" shift & goto Version
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 60 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 61 | if "%platf%"=="x64" (set vs_platf=x86_amd64)
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 62 |
|
| 63 | rem Setup the environment
|
| 64 | call "%dir%env.bat" %vs_platf% >nul
|
| 65 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 66 | if "%kill%"=="true" (
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame^] | 67 | msbuild /v:m /nologo /target:KillPython "%dir%\pythoncore.vcxproj" /p:Configuration=%conf% /p:Platform=%platf% /p:KillPython=true
|
Zachary Ware | 6250df8 | 2015-06-09 23:16:52 -0500 | [diff] [blame] | 68 | )
|
| 69 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 70 | rem Call on MSBuild to do the work, echo the command.
|
| 71 | rem Passing %1-9 is not the preferred option, but argument parsing in
|
| 72 | rem batch is, shall we say, "lackluster"
|
| 73 | echo on
|
| 74 | 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] | 75 |
|
| 76 | @goto :eof
|
| 77 |
|
| 78 | :Version
|
| 79 | rem Display the current build version information
|
| 80 | msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
|