| Zachary Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 1 | @echo off |
| 2 | setlocal |
| 3 | set D=%~dp0 |
| 4 | set PCBUILD=%D%..\..\PCBuild\ |
| 5 | |
| 6 | set BUILDX86= |
| 7 | set BUILDX64= |
| 8 | set REBUILD= |
| 9 | set OUTPUT= |
| 10 | set PACKAGES= |
| 11 | |
| 12 | :CheckOpts |
| 13 | if "%~1" EQU "-h" goto Help |
| 14 | if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts |
| 15 | if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts |
| 16 | if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts |
| 17 | if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts |
| 18 | if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts |
| 19 | if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts |
| 20 | |
| 21 | if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) |
| 22 | |
| 23 | if not defined NUGET where nuget -q || echo Cannot find nuget.exe on PATH and NUGET is not set. && exit /B 1 |
| Zachary Ware | 986b7ff | 2017-09-04 16:05:33 -0700 | [diff] [blame] | 24 | call "%PCBUILD%find_msbuild.bat" %MSBUILD% |
| 25 | if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) |
| Zachary Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 26 | if 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 Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 34 | |
| 35 | if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" |
| 36 | |
| 37 | if 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 Ware | 986b7ff | 2017-09-04 16:05:33 -0700 | [diff] [blame] | 42 | %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% |
| Zachary Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 43 | if errorlevel 1 goto :eof |
| 44 | ) |
| 45 | |
| 46 | if 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 Ware | 986b7ff | 2017-09-04 16:05:33 -0700 | [diff] [blame] | 51 | %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% |
| Zachary Ware | 5fe8ac6 | 2017-06-11 14:19:39 -0500 | [diff] [blame] | 52 | if errorlevel 1 goto :eof |
| 53 | ) |
| 54 | |
| 55 | exit /B 0 |
| 56 | |
| 57 | :Help |
| 58 | echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h] |
| 59 | echo. |
| 60 | echo -x86 Build x86 installers |
| 61 | echo -x64 Build x64 installers |
| 62 | echo -r Rebuild rather than incremental build |
| 63 | echo --out [DIR] Override output directory |
| 64 | echo -h Show usage |