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
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 21 | echo. Extension modules that depend on external libraries will not attempt
|
| 22 | echo. to build if this flag is not present
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 23 | echo. -m Enable parallel build (enabled by default)
|
| 24 | echo. -M Disable parallel build
|
| 25 | echo. -v Increased output messages
|
| 26 | echo. -k Attempt to kill any running Pythons before building (usually done
|
| 27 | echo. automatically by the pythoncore project)
|
| 28 | echo.
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 29 | echo.Available flags to avoid building certain modules.
|
| 30 | echo.These flags have no effect if '-e' is not given:
|
| 31 | echo. --no-ssl Do not attempt to build _ssl
|
| 32 | echo. --no-tkinter Do not attempt to build Tkinter
|
| 33 | echo.
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 34 | echo.Available arguments:
|
| 35 | echo. -c Release ^| Debug ^| PGInstrument ^| PGUpdate
|
| 36 | echo. Set the configuration (default: Release)
|
| 37 | echo. -p x64 ^| Win32
|
| 38 | echo. Set the platform (default: Win32)
|
| 39 | echo. -t Build ^| Rebuild ^| Clean ^| CleanAll
|
| 40 | echo. Set the target manually
|
Steve Dower | 940f6a8 | 2015-10-31 12:17:11 -0700 | [diff] [blame^] | 41 | echo. --test-marker Enable the test marker within the build.
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 42 | exit /b 127
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 43 |
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 44 | :Run
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 45 | setlocal
|
| 46 | set platf=Win32
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 47 | set vs_platf=x86
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 48 | set conf=Release
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 49 | set target=Build
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 50 | set dir=%~dp0
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 51 | set parallel=/m
|
| 52 | set verbose=/nologo /v:m
|
Zachary Ware | 6250df8 | 2015-06-09 23:16:52 -0500 | [diff] [blame] | 53 | set kill=
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 54 |
|
| 55 | :CheckOpts
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 56 | if "%~1"=="-h" goto Usage
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 57 | if "%~1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts
|
| 58 | if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts
|
| 59 | if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts
|
| 60 | if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts
|
| 61 | if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 62 | if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts
|
| 63 | if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts
|
| 64 | if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts
|
| 65 | if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
|
Steve Dower | 940f6a8 | 2015-10-31 12:17:11 -0700 | [diff] [blame^] | 66 | if "%~1"=="--test-marker" (set UseTestMarker=true) & shift & goto CheckOpts
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 67 | if "%~1"=="-V" shift & goto Version
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 68 | rem These use the actual property names used by MSBuild. We could just let
|
| 69 | rem them in through the environment, but we specify them on the command line
|
| 70 | rem anyway for visibility so set defaults after this
|
Zachary Ware | a6deff2 | 2015-09-04 01:10:23 -0500 | [diff] [blame] | 71 | if "%~1"=="-e" (set IncludeExternals=true) & shift & goto CheckOpts
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 72 | if "%~1"=="--no-ssl" (set IncludeSSL=false) & shift & goto CheckOpts
|
| 73 | if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
|
| 74 |
|
| 75 | if "%IncludeExternals%"=="" set IncludeExternals=false
|
| 76 | if "%IncludeSSL%"=="" set IncludeSSL=true
|
| 77 | if "%IncludeTkinter%"=="" set IncludeTkinter=true
|
Zachary Ware | 4c9c848 | 2015-04-13 11:59:54 -0500 | [diff] [blame] | 78 |
|
Zachary Ware | a6deff2 | 2015-09-04 01:10:23 -0500 | [diff] [blame] | 79 | if "%IncludeExternals%"=="true" call "%dir%get_externals.bat"
|
| 80 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 81 | if "%platf%"=="x64" (set vs_platf=x86_amd64)
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 82 |
|
| 83 | rem Setup the environment
|
| 84 | call "%dir%env.bat" %vs_platf% >nul
|
| 85 |
|
Steve Dower | e1f6805 | 2015-07-20 21:34:45 -0700 | [diff] [blame] | 86 | if "%kill%"=="true" (
|
Zachary Ware | 6732343 | 2015-09-02 13:21:19 -0500 | [diff] [blame] | 87 | 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] | 88 | )
|
| 89 |
|
Zachary Ware | 774ac37 | 2015-04-13 12:11:40 -0500 | [diff] [blame] | 90 | rem Call on MSBuild to do the work, echo the command.
|
| 91 | rem Passing %1-9 is not the preferred option, but argument parsing in
|
| 92 | rem batch is, shall we say, "lackluster"
|
| 93 | echo on
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 94 | msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
|
| 95 | /p:Configuration=%conf% /p:Platform=%platf%^
|
| 96 | /p:IncludeExternals=%IncludeExternals%^
|
| 97 | /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
|
Steve Dower | 940f6a8 | 2015-10-31 12:17:11 -0700 | [diff] [blame^] | 98 | /p:UseTestMarker=%UseTestMarker%^
|
Zachary Ware | b27f3c3 | 2015-09-03 23:43:54 -0500 | [diff] [blame] | 99 | %1 %2 %3 %4 %5 %6 %7 %8 %9
|
Steve Dower | 4943749 | 2015-07-08 20:18:44 -0700 | [diff] [blame] | 100 |
|
| 101 | @goto :eof
|
| 102 |
|
| 103 | :Version
|
| 104 | rem Display the current build version information
|
| 105 | msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
|