|
1 | 1 | @echo off |
2 | | -rem A batch program to build or rebuild a particular configuration. |
| 2 | +rem A batch program to build or rebuild a particular configuration, |
3 | 3 | rem just for convenience. |
4 | 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 | + |
5 | 14 | setlocal |
6 | 15 | set platf=Win32 |
| 16 | +set vs_platf=x86 |
7 | 17 | set conf=Release |
8 | | -set build= |
| 18 | +set target= |
| 19 | +set dir=%~dp0 |
| 20 | +set kill= |
| 21 | +set build_tkinter= |
9 | 22 |
|
10 | 23 | :CheckOpts |
11 | | -if "%1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts |
12 | | -if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts |
13 | | -if "%1"=="-r" (set build=/rebuild) & shift & goto CheckOpts |
14 | | -if "%1"=="-d" (set conf=Debug) & shift & goto CheckOpts |
15 | | - |
16 | | -set cmd=vcbuild /useenv pcbuild.sln %build% "%conf%|%platf%" |
17 | | -echo %cmd% |
18 | | -%cmd% |
| 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%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.15.0 |
| 74 | + set tkdir=%externals_dir%\tk-8.5.15.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 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 all |
| 82 | + nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" install |
| 83 | + popd |
| 84 | + ) |
| 85 | + |
| 86 | + if not exist "%tcltkdir%\bin\tk85%tcl_dbg_ext%.dll" ( |
| 87 | + pushd "%tkdir%\win" |
| 88 | + nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" clean |
| 89 | + nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" all |
| 90 | + nmake -f makefile.vc MACHINE=%machine% DEBUG=%debug_flag% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" install |
| 91 | + popd |
| 92 | + ) |
| 93 | + |
| 94 | + if not exist "%tcltkdir%\lib\tix8.4.3\tix84%tcl_dbg_ext%.dll" ( |
| 95 | + pushd "%tixdir%\win" |
| 96 | + nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" clean |
| 97 | + nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" all |
| 98 | + nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" install |
| 99 | + popd |
| 100 | + ) |
| 101 | +) |
| 102 | + |
| 103 | +rem Call on VCBuild to do the work, echo the command. |
| 104 | +rem Passing %1-9 is not the preferred option, but argument parsing in |
| 105 | +rem batch is, shall we say, "lackluster" |
| 106 | +echo on |
| 107 | +vcbuild "%dir%pcbuild.sln" %target% "%conf%|%platf%" %1 %2 %3 %4 %5 %6 %7 %8 %9 |
0 commit comments