| 1 |
@echo off |
| 2 |
rem A batch program to build or rebuild a particular configuration, |
| 3 |
rem just for convenience. |
| 4 |
|
| 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, or Clean) |
| 10 |
rem -d Set the configuration to Debug |
| 11 |
rem -e Pull in external libraries using get_externals.bat |
| 12 |
rem -k Attempt to kill any running Pythons before building |
| 13 |
|
| 14 |
setlocal |
| 15 |
set platf=Win32 |
| 16 |
set vs_platf=x86 |
| 17 |
set conf=Release |
| 18 |
set target= |
| 19 |
set dir=%~dp0 |
| 20 |
set kill= |
| 21 |
set build_tkinter= |
| 22 |
|
| 23 |
:CheckOpts |
| 24 |
if '%1'=='-c' (set conf=%2) & shift & shift & goto CheckOpts |
| 25 |
if '%1'=='-p' (set platf=%2) & shift & shift & goto CheckOpts |
| 26 |
if '%1'=='-r' (set target=/rebuild) & shift & goto CheckOpts |
| 27 |
if '%1'=='-t' ( |
| 28 |
if '%2'=='Clean' (set target=/clean) & shift & shift & goto CheckOpts |
| 29 |
if '%2'=='Rebuild' (set target=/rebuild) & shift & shift & goto CheckOpts |
| 30 |
if '%2'=='Build' (set target=) & shift & shift & goto CheckOpts |
| 31 |
echo.Unknown target: %2 & goto :eof |
| 32 |
) |
| 33 |
if '%1'=='-d' (set conf=Debug) & shift & goto CheckOpts |
| 34 |
if '%1'=='-e' call "%dir%..\..\PCbuild\get_externals.bat" & (set build_tkinter=true) & shift & goto CheckOpts |
| 35 |
if '%1'=='-k' (set kill=true) & shift & goto CheckOpts |
| 36 |
|
| 37 |
if '%conf%'=='Debug' (set dbg_ext=_d) else (set dbg_ext=) |
| 38 |
if '%platf%'=='x64' ( |
| 39 |
set vs_platf=x86_amd64 |
| 40 |
set builddir=%dir%amd64\ |
| 41 |
) else ( |
| 42 |
set builddir=%dir% |
| 43 |
) |
| 44 |
rem Can't use builddir until we're in a new command... |
| 45 |
if '%platf%'=='x64' ( |
| 46 |
rem Needed for buliding OpenSSL |
| 47 |
set HOST_PYTHON=%builddir%python%dbg_ext%.exe |
| 48 |
) |
| 49 |
|
| 50 |
rem Setup the environment |
| 51 |
call "%dir%env.bat" %vs_platf% |
| 52 |
|
| 53 |
if '%kill%'=='true' ( |
| 54 |
vcbuild "%dir%kill_python.vcproj" "%conf%|%platf%" && "%builddir%kill_python%dbg_ext%.exe" |
| 55 |
) |
| 56 |
|
| 57 |
set externals_dir=%dir%..\..\externals |
| 58 |
if '%build_tkinter%'=='true' ( |
| 59 |
if '%platf%'=='x64' ( |
| 60 |
set tcltkdir=%externals_dir%\tcltk64 |
| 61 |
set machine=AMD64 |
| 62 |
) else ( |
| 63 |
set tcltkdir=%externals_dir%\tcltk |
| 64 |
set machine=IX86 |
| 65 |
) |
| 66 |
if '%conf%'=='Debug' ( |
| 67 |
set tcl_dbg_ext=g |
| 68 |
set debug_flag=1 |
| 69 |
) else ( |
| 70 |
set tcl_dbg_ext= |
| 71 |
set debug_flag=0 |
| 72 |
) |
| 73 |
set tcldir=%externals_dir%\tcl-8.5.19.0 |
| 74 |
set tkdir=%externals_dir%\tk-8.5.19.0 |
| 75 |
set tixdir=%externals_dir%\tix-8.4.3.5 |
| 76 |
) |
| 77 |
if '%build_tkinter%'=='true' ( |
| 78 |
if not exist "%tcltkdir%\bin\tcl85%tcl_dbg_ext%.dll" ( |
| 79 |
@rem clean, all and install need to be separate invocations, otherwise nmakehlp is not found on install |
| 80 |
pushd "%tcldir%\win" |
| 81 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" clean |
| 82 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" all |
| 83 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" install |
| 84 |
popd |
| 85 |
) |
| 86 |
|
| 87 |
if not exist "%tcltkdir%\bin\tk85%tcl_dbg_ext%.dll" ( |
| 88 |
pushd "%tkdir%\win" |
| 89 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" clean |
| 90 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" all |
| 91 |
nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" install |
| 92 |
popd |
| 93 |
) |
| 94 |
|
| 95 |
if not exist "%tcltkdir%\lib\tix8.4.3\tix84%tcl_dbg_ext%.dll" ( |
| 96 |
pushd "%tixdir%\win" |
| 97 |
nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" clean |
| 98 |
nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" all |
| 99 |
nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" install |
| 100 |
popd |
| 101 |
) |
| 102 |
) |
| 103 |
|
| 104 |
rem Call on VCBuild to do the work, echo the command. |
| 105 |
rem Passing %1-9 is not the preferred option, but argument parsing in |
| 106 |
rem batch is, shall we say, "lackluster" |
| 107 |
echo on |
| 108 |
vcbuild "%dir%pcbuild.sln" %target% "%conf%|%platf%" %1 %2 %3 %4 %5 %6 %7 %8 %9 |