summaryrefslogtreecommitdiffstats
path: root/Tools/msi/build.bat
blob: 755c8876cf99c5b8f09cde35e49b5972469c857f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@echo off
setlocal
set D=%~dp0
set PCBUILD=%D%..\..\PCbuild\

set BUILDX86=
set BUILDX64=
set BUILDARM64=
set BUILDDOC=
set BUILDTEST=
set BUILDPACK=
set REBUILD=

:CheckOpts
if "%~1" EQU "-h" goto Help
if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts
if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts
if "%~1" EQU "-arm64" (set BUILDARM64=1) && shift && goto CheckOpts
if "%~1" EQU "--doc" (set BUILDDOC=1) && shift && goto CheckOpts
if "%~1" EQU "--no-test-marker" (set BUILDTEST=) && shift && goto CheckOpts
if "%~1" EQU "--test-marker" (set BUILDTEST=--test-marker) && shift && goto CheckOpts
if "%~1" EQU "--pack" (set BUILDPACK=1) && shift && goto CheckOpts
if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts

if not defined BUILDX86 if not defined BUILDX64 if not defined BUILDARM64 (set BUILDX86=1) && (set BUILDX64=1)

call "%D%get_externals.bat"
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)

if defined BUILDX86 (
    call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
    call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
)
if defined BUILDX64 (
    call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
    call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
)
if defined BUILDARM64 (
    call "%PCBUILD%build.bat" -p ARM64 -d -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
    call "%PCBUILD%build.bat" -p ARM64 -e %REBUILD% %BUILDTEST%
    if errorlevel 1 goto :eof
)

if defined BUILDDOC (
    call "%PCBUILD%..\Doc\make.bat" htmlhelp
    if errorlevel 1 goto :eof
)

rem Build the launcher MSI separately
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86

set BUILD_CMD="%D%bundle\snapshot.wixproj"
if defined BUILDTEST (
    set BUILD_CMD=%BUILD_CMD% /p:UseTestMarker=true
)
if defined BUILDPACK (
    set BUILD_CMD=%BUILD_CMD% /p:Pack=true
)
if defined REBUILD (
    set BUILD_CMD=%BUILD_CMD% /t:Rebuild
)

if defined BUILDX86 (
    %MSBUILD% /p:Platform=x86 %BUILD_CMD%
    if errorlevel 1 goto :eof
)
if defined BUILDX64 (
    %MSBUILD% /p:Platform=x64 %BUILD_CMD%
    if errorlevel 1 goto :eof
)
if defined BUILDARM64 (
    %MSBUILD% /p:Platform=ARM64 %BUILD_CMD%
    if errorlevel 1 goto :eof
)

exit /B 0

:Help
echo build.bat [-x86] [-x64] [-arm64] [--doc] [-h] [--test-marker] [--pack] [-r]
echo.
echo    -x86                Build x86 installers
echo    -x64                Build x64 installers
echo    -ARM64                Build ARM64 installers
echo    --doc               Build CHM documentation
echo    --test-marker       Build with test markers
echo    --no-test-marker    Build without test markers (default)
echo    --pack              Embed core MSIs into installer
echo    -r                  Rebuild rather than incremental build