blob: b532bd74216831eb0b8b2586f6ae2729781b23ec [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@echo off
2setlocal
3set D=%~dp0
Stefan Grönkef1502d02017-09-25 18:58:10 +02004set PCBUILD=%D%..\..\PCbuild\
Steve Dowerf0851912017-07-26 09:09:01 -07005if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD%
Zachary Ware6b6e6872017-06-10 14:58:42 -05006
7set BUILDX86=
8set BUILDX64=
Paul Monsonaa25d5d2019-04-12 09:36:38 -07009set BUILDARM32=
Zachary Ware6b6e6872017-06-10 14:58:42 -050010set REBUILD=
11set OUTPUT=
12set PACKAGES=
Paul Monsonaa25d5d2019-04-12 09:36:38 -070013set PYTHON_EXE=
Zachary Ware6b6e6872017-06-10 14:58:42 -050014
15:CheckOpts
16if "%~1" EQU "-h" goto Help
17if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
18if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
Paul Monsonaa25d5d2019-04-12 09:36:38 -070019if "%~1" EQU "-arm32" (set BUILDARM32=1) && shift && goto CheckOpts
Zachary Ware6b6e6872017-06-10 14:58:42 -050020if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
21if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
22if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
23if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
Paul Monsonaa25d5d2019-04-12 09:36:38 -070024if "%~1" EQU "--python-exe" (set PYTHON_EXE="/p:PythonExe=%~2") && shift && shift && goto CheckOpts
Zachary Ware6b6e6872017-06-10 14:58:42 -050025
Paul Monsonaa25d5d2019-04-12 09:36:38 -070026if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM32 (set BUILDX86=1) && (set BUILDX64=1) && (set BUILDARM32=1)
Zachary Ware6b6e6872017-06-10 14:58:42 -050027
28call "%D%..\msi\get_externals.bat"
Steve Dower40a23e82017-06-19 10:34:25 -070029call "%PCBUILD%find_msbuild.bat" %MSBUILD%
30if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
Zachary Ware6b6e6872017-06-10 14:58:42 -050031
32if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%"
33
34if defined BUILDX86 (
35 if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
Steve Dowerf0851912017-07-26 09:09:01 -070036 ) else if not exist "%Py_OutDir%win32\python.exe" call "%PCBUILD%build.bat" -e
Zachary Ware6b6e6872017-06-10 14:58:42 -050037 if errorlevel 1 goto :eof
38
Paul Monsonaa25d5d2019-04-12 09:36:38 -070039 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% %PYTHON_EXE%
Zachary Ware6b6e6872017-06-10 14:58:42 -050040 if errorlevel 1 goto :eof
41)
42
43if defined BUILDX64 (
44 if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
Steve Dowerf0851912017-07-26 09:09:01 -070045 ) else if not exist "%Py_OutDir%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e
Zachary Ware6b6e6872017-06-10 14:58:42 -050046 if errorlevel 1 goto :eof
47
Paul Monsonaa25d5d2019-04-12 09:36:38 -070048 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% %PYTHON_EXE%
49 if errorlevel 1 goto :eof
50)
51
52if 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%
Zachary Ware6b6e6872017-06-10 14:58:42 -050058 if errorlevel 1 goto :eof
59)
60
61exit /B 0
62
63:Help
64echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h]
65echo.
66echo -x86 Build x86 installers
67echo -x64 Build x64 installers
68echo -r Rebuild rather than incremental build
69echo --out [DIR] Override output directory
70echo -h Show usage