blob: f3bc1e3b8b22f4d184a447797d90304e1b6fc3eb [file] [log] [blame]
Zachary Ware4c9c8482015-04-13 11:59:54 -05001@echo off
Zachary Ware6250df82015-06-09 23:16:52 -05002rem A batch program to build or rebuild a particular configuration,
Zachary Ware4c9c8482015-04-13 11:59:54 -05003rem just for convenience.
4
Zachary Ware6250df82015-06-09 23:16:52 -05005rem 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 -m Enable parallel build
13rem -M Disable parallel build (disabled by default)
14rem -v Increased output messages
15rem -k Attempt to kill any running Pythons before building
16
Zachary Ware4c9c8482015-04-13 11:59:54 -050017setlocal
18set platf=Win32
Zachary Ware6250df82015-06-09 23:16:52 -050019set vs_platf=x86
Zachary Ware4c9c8482015-04-13 11:59:54 -050020set conf=Release
Zachary Ware6250df82015-06-09 23:16:52 -050021set target=Build
Zachary Ware4c9c8482015-04-13 11:59:54 -050022set dir=%~dp0
Zachary Ware6250df82015-06-09 23:16:52 -050023set parallel=
24set verbose=/nologo /v:m
25set kill=
26set build_tkinter=
Zachary Ware4c9c8482015-04-13 11:59:54 -050027
28:CheckOpts
Zachary Ware6250df82015-06-09 23:16:52 -050029if '%1'=='-c' (set conf=%2) & shift & shift & goto CheckOpts
30if '%1'=='-p' (set platf=%2) & shift & shift & goto CheckOpts
31if '%1'=='-r' (set target=Rebuild) & shift & goto CheckOpts
32if '%1'=='-t' (set target=%2) & shift & shift & goto CheckOpts
33if '%1'=='-d' (set conf=Debug) & shift & goto CheckOpts
34if '%1'=='-e' call "%dir%get_externals.bat" & (set build_tkinter=true) & shift & goto CheckOpts
35if '%1'=='-m' (set parallel=/m) & shift & goto CheckOpts
36if '%1'=='-M' (set parallel=) & shift & goto CheckOpts
37if '%1'=='-v' (set verbose=/v:n) & shift & goto CheckOpts
38if '%1'=='-k' (set kill=true) & shift & goto CheckOpts
Zachary Ware4c9c8482015-04-13 11:59:54 -050039
Zachary Ware6250df82015-06-09 23:16:52 -050040if '%conf%'=='Debug' (set dbg_ext=_d) else (set dbg_ext=)
41if '%platf%'=='x64' (
42 set vs_platf=x86_amd64
43 set builddir=%dir%amd64\
44) else (
45 set builddir=%dir%
46)
47
48rem Setup the environment
49call "%dir%env.bat" %vs_platf%
50
51if '%kill%'=='true' (
52 msbuild "%dir%kill_python.vcxproj" %verbose% /p:Configuration=%conf% /p:Platform=%platf% && "%builddir%kill_python%dbg_ext%.exe"
53)
54
55set externals_dir=%dir%..\externals
56if '%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)
77if '%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
103rem Call on MSBuild to do the work, echo the command.
104rem Passing %1-9 is not the preferred option, but argument parsing in
105rem batch is, shall we say, "lackluster"
106echo on
107msbuild "%dir%pcbuild.sln" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9