blob: 3c953f727d6a901e419be56537778c340dd999d0 [file] [log] [blame]
Steve Dower2b8f0942016-06-27 09:54:03 -07001@echo off
2setlocal
3set D=%~dp0
4set PCBUILD=%D%..\..\PCBuild\
5
6set BUILDX86=
7set BUILDX64=
8set REBUILD=
9set OUTPUT=
10set PACKAGES=
11
12:CheckOpts
13if "%~1" EQU "-h" goto Help
14if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
15if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
16if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts
17if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
18if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts
19if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts
20
21if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)
22
23if not defined NUGET where nuget -q || echo Cannot find nuget.exe on PATH and NUGET is not set. && exit /B 1
24if not defined PYTHON set PYTHON=py -3
25
26@%PYTHON% -c "" >nul 2>nul
27@if errorlevel 1 (
28 %NUGET% install python -OutputDirectory "%D%obj" -ExcludeVersion -NonInteractive
29 set PYTHON="%D%obj\python\tools\python.exe"
30)
31
32call "%PCBUILD%env.bat" x86
33
34if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%"
35
36if defined BUILDX86 (
37 if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
38 ) else if not exist "%PCBUILD%python.exe" call "%PCBUILD%build.bat" -e
39 if errorlevel 1 goto :eof
40
41 msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES%
42 if errorlevel 1 goto :eof
43)
44
45if defined BUILDX64 (
46 if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
47 ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e
48 if errorlevel 1 goto :eof
49
50 msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES%
51 if errorlevel 1 goto :eof
52)
53
54exit /B 0
55
56:Help
57echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h]
58echo.
59echo -x86 Build x86 installers
60echo -x64 Build x64 installers
61echo -r Rebuild rather than incremental build
62echo --out [DIR] Override output directory
63echo -h Show usage