|
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 -m Enable parallel build |
| 13 | +rem -M Disable parallel build (disabled by default) |
| 14 | +rem -v Increased output messages |
| 15 | +rem -k Attempt to kill any running Pythons before building |
| 16 | + |
5 | 17 | setlocal
|
6 | 18 | set platf=Win32
|
| 19 | +set vs_platf=x86 |
7 | 20 | set conf=Release
|
8 |
| -set target=build |
| 21 | +set target=Build |
9 | 22 | set dir=%~dp0
|
| 23 | +set parallel= |
| 24 | +set verbose=/nologo /v:m |
| 25 | +set kill= |
| 26 | +set build_tkinter= |
10 | 27 |
|
11 | 28 | :CheckOpts
|
12 |
| -if "%1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts |
13 |
| -if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts |
14 |
| -if "%1"=="-r" (set target=rebuild) & shift & goto CheckOpts |
15 |
| -if "%1"=="-d" (set conf=Debug) & shift & goto CheckOpts |
16 |
| - |
17 |
| -set cmd=msbuild /p:useenv=true %dir%pcbuild.sln /t:%target% /p:Configuration=%conf% /p:Platform=%platf% |
18 |
| -echo %cmd% |
19 |
| -%cmd% |
| 29 | +if '%1'=='-c' (set conf=%2) & shift & shift & goto CheckOpts |
| 30 | +if '%1'=='-p' (set platf=%2) & shift & shift & goto CheckOpts |
| 31 | +if '%1'=='-r' (set target=Rebuild) & shift & goto CheckOpts |
| 32 | +if '%1'=='-t' (set target=%2) & shift & shift & goto CheckOpts |
| 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'=='-m' (set parallel=/m) & shift & goto CheckOpts |
| 36 | +if '%1'=='-M' (set parallel=) & shift & goto CheckOpts |
| 37 | +if '%1'=='-v' (set verbose=/v:n) & shift & goto CheckOpts |
| 38 | +if '%1'=='-k' (set kill=true) & shift & goto CheckOpts |
| 39 | + |
| 40 | +if '%conf%'=='Debug' (set dbg_ext=_d) else (set dbg_ext=) |
| 41 | +if '%platf%'=='x64' ( |
| 42 | + set vs_platf=x86_amd64 |
| 43 | + set builddir=%dir%amd64\ |
| 44 | +) else ( |
| 45 | + set builddir=%dir% |
| 46 | +) |
| 47 | + |
| 48 | +rem Setup the environment |
| 49 | +call "%dir%env.bat" %vs_platf% |
| 50 | + |
| 51 | +if '%kill%'=='true' ( |
| 52 | + msbuild "%dir%kill_python.vcxproj" %verbose% /p:Configuration=%conf% /p:Platform=%platf% && "%builddir%kill_python%dbg_ext%.exe" |
| 53 | +) |
| 54 | + |
| 55 | +set externals_dir=%dir%..\externals |
| 56 | +if '%build_tkinter%'=='true' ( |
| 57 | + if '%platf%'=='x64' ( |
| 58 | + set tcltkdir=%externals_dir%\tcltk64 |
| 59 | + set machine=AMD64 |
| 60 | + ) else ( |
| 61 | + set tcltkdir=%externals_dir%\tcltk |
| 62 | + set machine=IX86 |
| 63 | + ) |
| 64 | + if '%conf%'=='Debug' ( |
| 65 | + set tcl_dbg_ext=g |
| 66 | + set debug_flag=1 |
| 67 | + set options=symbols |
| 68 | + ) else ( |
| 69 | + set tcl_dbg_ext= |
| 70 | + set debug_flag=0 |
| 71 | + set options= |
| 72 | + ) |
| 73 | + set tcldir=%externals_dir%\tcl-8.6.1.0 |
| 74 | + set tkdir=%externals_dir%\tk-8.6.1.0 |
| 75 | + set tixdir=%externals_dir%\tix-8.4.3.4 |
| 76 | +) |
| 77 | +if '%build_tkinter%'=='true' ( |
| 78 | + if not exist "%tcltkdir%\bin\tcl86t%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% OPTS=%options% INSTALLDIR="%tcltkdir%" clean all |
| 82 | + nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" install-binaries install-libraries |
| 83 | + popd |
| 84 | + ) |
| 85 | + |
| 86 | + if not exist "%tcltkdir%\bin\tk86t%tcl_dbg_ext%.dll" ( |
| 87 | + pushd "%tkdir%\win" |
| 88 | + nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" clean |
| 89 | + nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" all |
| 90 | + nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" install-binaries install-libraries |
| 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 MSBuild 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 | +msbuild "%dir%pcbuild.sln" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9 |
0 commit comments