| 1 |
@echo off |
| 2 |
setlocal |
| 3 |
set D=%~dp0 |
| 4 |
set PCBUILD=%D%..\..\PCbuild\ |
| 5 |
if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD% |
| 6 |
|
| 7 |
set BUILDX86= |
| 8 |
set BUILDX64= |
| 9 |
set BUILDARM32= |
| 10 |
set REBUILD= |
| 11 |
set OUTPUT= |
| 12 |
set PACKAGES= |
| 13 |
set PYTHON_EXE= |
| 14 |
|
| 15 |
:CheckOpts |
| 16 |
if "%~1" EQU "-h" goto Help |
| 17 |
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts |
| 18 |
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts |
| 19 |
if "%~1" EQU "-arm32" (set BUILDARM32=1) && shift && goto CheckOpts |
| 20 |
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts |
| 21 |
if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts |
| 22 |
if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts |
| 23 |
if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts |
| 24 |
if "%~1" EQU "--python-exe" (set PYTHON_EXE="/p:PythonExe=%~2") && shift && shift && goto CheckOpts |
| 25 |
|
| 26 |
if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM32 (set BUILDX86=1) && (set BUILDX64=1) && (set BUILDARM32=1) |
| 27 |
|
| 28 |
call "%D%..\msi\get_externals.bat" |
| 29 |
call "%PCBUILD%find_msbuild.bat" %MSBUILD% |
| 30 |
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) |
| 31 |
|
| 32 |
if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" |
| 33 |
|
| 34 |
if defined BUILDX86 ( |
| 35 |
if defined REBUILD ( call "%PCBUILD%build.bat" -e -r |
| 36 |
) else if not exist "%Py_OutDir%win32\python.exe" call "%PCBUILD%build.bat" -e |
| 37 |
if errorlevel 1 goto :eof |
| 38 |
|
| 39 |
%MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% %PYTHON_EXE% |
| 40 |
if errorlevel 1 goto :eof |
| 41 |
) |
| 42 |
|
| 43 |
if defined BUILDX64 ( |
| 44 |
if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r |
| 45 |
) else if not exist "%Py_OutDir%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e |
| 46 |
if errorlevel 1 goto :eof |
| 47 |
|
| 48 |
%MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% %PYTHON_EXE% |
| 49 |
if errorlevel 1 goto :eof |
| 50 |
) |
| 51 |
|
| 52 |
if defined BUILDARM32 ( |
| 53 |
if defined REBUILD ( call "%PCBUILD%build.bat" -p ARM -e -r --no-tkinter |
| 54 |
) else if not exist "%Py_OutDir%arm32\python.exe" call "%PCBUILD%build.bat" -p ARM -e --no-tkinter |
| 55 |
if errorlevel 1 goto :eof |
| 56 |
|
| 57 |
%MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=ARM %OUTPUT% %PACKAGES% %PYTHON_EXE% |
| 58 |
if errorlevel 1 goto :eof |
| 59 |
) |
| 60 |
|
| 61 |
exit /B 0 |
| 62 |
|
| 63 |
:Help |
| 64 |
echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h] |
| 65 |
echo. |
| 66 |
echo -x86 Build x86 installers |
| 67 |
echo -x64 Build x64 installers |
| 68 |
echo -r Rebuild rather than incremental build |
| 69 |
echo --out [DIR] Override output directory |
| 70 |
echo -h Show usage |