blob: f4e15c7ed79c3e5d81ab552fa2fd69e1e4ebfbce [file] [log] [blame]
Zachary Ware5fe8ac62017-06-11 14:19:39 -05001@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
Zachary Ware986b7ff2017-09-04 16:05:33 -070024call "%PCBUILD%find_msbuild.bat" %MSBUILD%
25if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
Zachary Ware5fe8ac62017-06-11 14:19:39 -050026if not defined PYTHON set PYTHON=py -3
27
28@%PYTHON% -c "" >nul 2>nul
29@if errorlevel 1 (
30 %NUGET% install python -OutputDirectory "%D%obj" -ExcludeVersion -NonInteractive
31 set PYTHON="%D%obj\python\tools\python.exe"
32)
33
Zachary Ware5fe8ac62017-06-11 14:19:39 -050034
35if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%"
36
37if defined BUILDX86 (
38 if defined REBUILD ( call "%PCBUILD%build.bat" -e -r
39 ) else if not exist "%PCBUILD%python.exe" call "%PCBUILD%build.bat" -e
40 if errorlevel 1 goto :eof
41
Zachary Ware986b7ff2017-09-04 16:05:33 -070042 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES%
Zachary Ware5fe8ac62017-06-11 14:19:39 -050043 if errorlevel 1 goto :eof
44)
45
46if defined BUILDX64 (
47 if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r
48 ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e
49 if errorlevel 1 goto :eof
50
Zachary Ware986b7ff2017-09-04 16:05:33 -070051 %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES%
Zachary Ware5fe8ac62017-06-11 14:19:39 -050052 if errorlevel 1 goto :eof
53)
54
55exit /B 0
56
57:Help
58echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h]
59echo.
60echo -x86 Build x86 installers
61echo -x64 Build x64 installers
62echo -r Rebuild rather than incremental build
63echo --out [DIR] Override output directory
64echo -h Show usage