blob: 0c482f5eb329fcba2f141420fcfc00f46def3676 [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 )
Zachary Ware677744b2015-10-24 01:34:22 -050085 if not exist "%builddir%tcl86t%tcl_dbg_ext%.dll" (
86 xcopy "%tcltkdir%\bin\tcl86t%tcl_dbg_ext%.dll" "%builddir%"
87 )
Zachary Ware6250df82015-06-09 23:16:52 -050088
89 if not exist "%tcltkdir%\bin\tk86t%tcl_dbg_ext%.dll" (
90 pushd "%tkdir%\win"
91 nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" clean
92 nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" all
93 nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" install-binaries install-libraries
94 popd
95 )
Zachary Ware677744b2015-10-24 01:34:22 -050096 if not exist "%builddir%tk86t%tcl_dbg_ext%.dll" (
97 xcopy "%tcltkdir%\bin\tk86t%tcl_dbg_ext%.dll" "%builddir%"
98 )
Zachary Ware6250df82015-06-09 23:16:52 -050099
100 if not exist "%tcltkdir%\lib\tix8.4.3\tix84%tcl_dbg_ext%.dll" (
101 pushd "%tixdir%\win"
102 nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" clean
103 nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" all
104 nmake -f python.mak DEBUG=%debug_flag% MACHINE=%machine% TCL_DIR="%tcldir%" TK_DIR="%tkdir%" INSTALL_DIR="%tcltkdir%" install
105 popd
106 )
107)
108
109rem Call on MSBuild to do the work, echo the command.
110rem Passing %1-9 is not the preferred option, but argument parsing in
111rem batch is, shall we say, "lackluster"
112echo on
113msbuild "%dir%pcbuild.sln" /t:%target% %parallel% %verbose% /p:Configuration=%conf% /p:Platform=%platf% %1 %2 %3 %4 %5 %6 %7 %8 %9