| 1 |
@echo off |
| 2 |
setlocal |
| 3 |
set D=%~dp0 |
| 4 |
set PCBUILD=%D%..\..\PCbuild\ |
| 5 |
|
| 6 |
set BUILDX86= |
| 7 |
set BUILDX64= |
| 8 |
set BUILDARM64= |
| 9 |
set BUILDDOC= |
| 10 |
set BUILDTEST= |
| 11 |
set BUILDPACK= |
| 12 |
set REBUILD= |
| 13 |
|
| 14 |
:CheckOpts |
| 15 |
if "%~1" EQU "-h" goto Help |
| 16 |
if /I "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts |
| 17 |
if /I "%~1" EQU "-Win32" (set BUILDX86=1) && shift && goto CheckOpts |
| 18 |
if /I "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts |
| 19 |
if /I "%~1" EQU "-arm64" (set BUILDARM64=1) && shift && goto CheckOpts |
| 20 |
if "%~1" EQU "--doc" (set BUILDDOC=1) && shift && goto CheckOpts |
| 21 |
if "%~1" EQU "--no-test-marker" (set BUILDTEST=) && shift && goto CheckOpts |
| 22 |
if "%~1" EQU "--test-marker" (set BUILDTEST=--test-marker) && shift && goto CheckOpts |
| 23 |
if "%~1" EQU "--pack" (set BUILDPACK=1) && shift && goto CheckOpts |
| 24 |
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts |
| 25 |
rem %IncludeFreethreaded% is recognised by the MSI build, but not the regular build. |
| 26 |
rem We use it to build twice and then build the installer with its extra option |
| 27 |
if /I "%~1" EQU "--disable-gil" (set IncludeFreethreaded=true) && shift && goto CheckOpts |
| 28 |
|
| 29 |
if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM64 (set BUILDX86=1) && (set BUILDX64=1) |
| 30 |
|
| 31 |
call "%D%get_externals.bat" |
| 32 |
call "%PCBUILD%find_msbuild.bat" %MSBUILD% |
| 33 |
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) |
| 34 |
|
| 35 |
if defined BUILDX86 call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST% |
| 36 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 37 |
if defined BUILDX86 call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST% |
| 38 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 39 |
|
| 40 |
if defined BUILDX64 call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST% |
| 41 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 42 |
if defined BUILDX64 call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST% |
| 43 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 44 |
|
| 45 |
if defined BUILDARM64 call "%PCBUILD%build.bat" -p ARM64 -d -e %REBUILD% %BUILDTEST% |
| 46 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 47 |
if defined BUILDARM64 call "%PCBUILD%build.bat" -p ARM64 -e %REBUILD% %BUILDTEST% |
| 48 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 49 |
|
| 50 |
if /I "%IncludeFreethreaded%"=="true" ( |
| 51 |
rem Cannot "exit /B" inside an if block because %ERRORLEVEL% will be wrong. |
| 52 |
rem We just skip everything after the first "errorlevel 1" and then exit after |
| 53 |
if defined BUILDX86 call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST% --disable-gil |
| 54 |
if not errorlevel 1 if defined BUILDX86 call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST% --disable-gil |
| 55 |
|
| 56 |
if not errorlevel 1 if defined BUILDX64 call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST% --disable-gil |
| 57 |
if not errorlevel 1 if defined BUILDX64 call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST% --disable-gil |
| 58 |
|
| 59 |
if not errorlevel 1 if defined BUILDARM64 call "%PCBUILD%build.bat" -p ARM64 -d -e %REBUILD% %BUILDTEST% --disable-gil |
| 60 |
if not errorlevel 1 if defined BUILDARM64 call "%PCBUILD%build.bat" -p ARM64 -e %REBUILD% %BUILDTEST% --disable-gil |
| 61 |
) |
| 62 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 63 |
|
| 64 |
if defined BUILDDOC call "%PCBUILD%..\Doc\make.bat" html |
| 65 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 66 |
|
| 67 |
rem Build the launcher MSI separately |
| 68 |
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 |
| 69 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 70 |
|
| 71 |
set BUILD_CMD="%D%bundle\snapshot.wixproj" |
| 72 |
if defined BUILDTEST ( |
| 73 |
set BUILD_CMD=%BUILD_CMD% /p:UseTestMarker=true |
| 74 |
) |
| 75 |
if defined BUILDPACK ( |
| 76 |
set BUILD_CMD=%BUILD_CMD% /p:Pack=true |
| 77 |
) |
| 78 |
if defined REBUILD ( |
| 79 |
set BUILD_CMD=%BUILD_CMD% /t:Rebuild |
| 80 |
) |
| 81 |
|
| 82 |
if defined BUILDX86 %MSBUILD% /p:Platform=x86 %BUILD_CMD% |
| 83 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 84 |
|
| 85 |
if defined BUILDX64 %MSBUILD% /p:Platform=x64 %BUILD_CMD% |
| 86 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 87 |
|
| 88 |
if defined BUILDARM64 %MSBUILD% /p:Platform=ARM64 %BUILD_CMD% |
| 89 |
if errorlevel 1 exit /B %ERRORLEVEL% |
| 90 |
|
| 91 |
exit /B 0 |
| 92 |
|
| 93 |
:Help |
| 94 |
echo build.bat [-x86] [-x64] [-arm64] [--doc] [-h] [--test-marker] [--pack] [-r] |
| 95 |
echo. |
| 96 |
echo -x86 Build x86 installers |
| 97 |
echo -x64 Build x64 installers |
| 98 |
echo -ARM64 Build ARM64 installers |
| 99 |
echo --doc Build documentation |
| 100 |
echo --test-marker Build with test markers |
| 101 |
echo --no-test-marker Build without test markers (default) |
| 102 |
echo --pack Embed core MSIs into installer |
| 103 |
echo -r Rebuild rather than incremental build |