1@echo off 2rem A batch program to build or rebuild a particular configuration, 3rem just for convenience. 4 5rem 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, or Clean) 10rem -d Set the configuration to Debug 11rem -e Pull in external libraries using get_externals.bat 12rem -k Attempt to kill any running Pythons before building 13 14setlocal 15set platf=Win32 16set vs_platf=x86 17set conf=Release 18set target= 19set dir=%~dp0 20set kill= 21set build_tkinter= 22 23:CheckOpts 24if '%1'=='-c' (set conf=%2) & shift & shift & goto CheckOpts 25if '%1'=='-p' (set platf=%2) & shift & shift & goto CheckOpts 26if '%1'=='-r' (set target=/rebuild) & shift & goto CheckOpts 27if '%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) 33if '%1'=='-d' (set conf=Debug) & shift & goto CheckOpts 34if '%1'=='-e' call "%dir%..\..\PCbuild\get_externals.bat" & (set build_tkinter=true) & shift & goto CheckOpts 35if '%1'=='-k' (set kill=true) & shift & goto CheckOpts 36 37if '%conf%'=='Debug' (set dbg_ext=_d) else (set dbg_ext=) 38if '%platf%'=='x64' ( 39 set vs_platf=x86_amd64 40 set builddir=%dir%amd64\ 41) else ( 42 set builddir=%dir% 43) 44rem Can't use builddir until we're in a new command... 45if '%platf%'=='x64' ( 46 rem Needed for buliding OpenSSL 47 set HOST_PYTHON=%builddir%python%dbg_ext%.exe 48) 49 50rem Setup the environment 51call "%dir%env.bat" %vs_platf% 52 53if '%kill%'=='true' ( 54 vcbuild "%dir%kill_python.vcproj" "%conf%|%platf%" && "%builddir%kill_python%dbg_ext%.exe" 55) 56 57set externals_dir=%dir%..\..\externals 58if '%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) 77if '%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 104rem Call on VCBuild to do the work, echo the command. 105rem Passing %1-9 is not the preferred option, but argument parsing in 106rem batch is, shall we say, "lackluster" 107echo on 108vcbuild "%dir%pcbuild.sln" %target% "%conf%|%platf%" %1 %2 %3 %4 %5 %6 %7 %8 %9 109