Add support for bundling ARM64 binaries into the installer

It is disabled by default because Qt doesn't have official ARM64 builds yet
This commit is contained in:
Cameron Gutman 2020-12-24 17:21:35 -06:00
parent c4108feb15
commit c7ddb54e67
2 changed files with 63 additions and 5 deletions

View file

@ -5,6 +5,10 @@ rem Run from Qt command prompt with working directory set to root of repo
set BUILD_CONFIG=%1
if "%INCLUDE_ARM64%" EQU "" (
set INCLUDE_ARM64=0
)
rem Convert to lower case for windeployqt
if /I "%BUILD_CONFIG%"=="debug" (
set BUILD_CONFIG=debug
@ -19,6 +23,9 @@ if /I "%BUILD_CONFIG%"=="debug" (
set SIGN=1
set MUST_DEPLOY_SYMBOLS=1
rem Release installers must have ARM64
set INCLUDE_ARM64=1
rem Fail if there are unstaged changes
git diff-index --quiet HEAD --
if !ERRORLEVEL! NEQ 0 (
@ -51,6 +58,13 @@ if not exist "%BUILD_ROOT%\build-x64-%BUILD_CONFIG%\Moonlight.msi" (
echo You must run 'build-arch.bat %BUILD_CONFIG% x64' first
exit /b 1
)
if %INCLUDE_ARM64% NEQ 0 (
if not exist "%BUILD_ROOT%\build-arm64-%BUILD_CONFIG%\Moonlight.msi" (
echo Unable to build bundle - missing binaries for %BUILD_CONFIG% arm64
echo You must run 'build-arch.bat %BUILD_CONFIG% arm64' first
exit /b 1
)
)
echo Cleaning output directories
rmdir /s /q %BUILD_FOLDER%
@ -67,7 +81,7 @@ if !ERRORLEVEL! NEQ 0 goto Error
echo Building bundle
rem Bundles are always x86 binaries
msbuild %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86
msbuild %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86 /p:DefineConstants="INCLUDE_ARM64=%INCLUDE_ARM64%"
if !ERRORLEVEL! NEQ 0 goto Error
if "%SIGN%"=="1" (

View file

@ -51,6 +51,11 @@
Value="DesktopShortcutInstallState"
Condition="HasDesktopShortcutInstallStateRegKey" />
<util:RegistrySearch Variable="NT_BUILD_STRING"
Root="HKLM"
Key="Software\Microsoft\Windows NT\CurrentVersion"
Value="BuildLabEx" />
<util:ProductSearch Id="VCREDIST_142_x86"
UpgradeCode="$(var.VCREDIST_X86_UPGRADE_CODE)"
Result="version"
@ -61,6 +66,11 @@
Result="version"
Variable="VCREDIST_142_x64" />
<util:ProductSearch Id="VCREDIST_142_ARM64"
UpgradeCode="$(var.VCREDIST_ARM64_UPGRADE_CODE)"
Result="version"
Variable="VCREDIST_142_ARM64" />
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
ShowVersion="yes"
@ -80,7 +90,7 @@
Vital="yes"
InstallCommand="/install /quiet /norestart"
DownloadUrl="https://moonlight-stream.org/downloads/vcredist/$(var.VCREDIST_VER)/vcredist_x86.exe"
InstallCondition="NOT VersionNT64"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;x86&quot;"
DetectCondition="VCREDIST_142_x86 &gt;= v$(var.VCREDIST_VER)">
<RemotePayload Description="Microsoft Visual C++ 2015-2019 Redistributable - x86"
@ -101,7 +111,7 @@
Vital="yes"
InstallCommand="/install /quiet /norestart"
DownloadUrl="https://moonlight-stream.org/downloads/vcredist/$(var.VCREDIST_VER)/vcredist_x64.exe"
InstallCondition="VersionNT64"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;amd64&quot;"
DetectCondition="VCREDIST_142_x64 &gt;= v$(var.VCREDIST_VER)">
<RemotePayload Description="Microsoft Visual C++ 2015-2019 Redistributable - x64"
@ -114,9 +124,32 @@
<ExitCode Value="1638" Behavior="success" />
</ExePackage>
<?if $(var.INCLUDE_ARM64) != 0 ?>
<ExePackage Name="Microsoft Visual C++ 2015-2019 Redistributable - ARM64"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
InstallCommand="/install /quiet /norestart"
DownloadUrl="https://moonlight-stream.org/downloads/vcredist/$(var.VCREDIST_VER)/vcredist_arm64.exe"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;arm64&quot;"
DetectCondition="VCREDIST_142_ARM64 &gt;= v$(var.VCREDIST_VER)">
<RemotePayload Description="Microsoft Visual C++ 2015-2019 Redistributable - ARM64"
ProductName="Microsoft Visual C++ 2015-2019 Redistributable - ARM64"
Size="$(var.VCREDIST_ARM64_SIZE)"
Version="$(var.VCREDIST_VER).0"
Hash="$(var.VCREDIST_ARM64_SHA1)"/>
<!-- Newer version installed is fine -->
<ExitCode Value="1638" Behavior="success" />
</ExePackage>
<?endif?>
<MsiPackage Id="Moonlight_x86"
SourceFile="$(env.BUILD_ROOT)\build-x86-$(env.BUILD_CONFIG)\Moonlight.msi"
InstallCondition="NOT VersionNT64"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;x86&quot;"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="REINSTALLMODE" Value="[REINSTALLMODE]" />
@ -125,12 +158,23 @@
<MsiPackage Id="Moonlight_x64"
SourceFile="$(env.BUILD_ROOT)\build-x64-$(env.BUILD_CONFIG)\Moonlight.msi"
InstallCondition="VersionNT64"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;amd64&quot;"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="REINSTALLMODE" Value="[REINSTALLMODE]" />
<MsiProperty Name="ADDDESKTOPSHORTCUT" Value="[AddDesktopShortcutCheckbox]" />
</MsiPackage>
<?if $(var.INCLUDE_ARM64) != 0 ?>
<MsiPackage Id="Moonlight_arm64"
SourceFile="$(env.BUILD_ROOT)\build-arm64-$(env.BUILD_CONFIG)\Moonlight.msi"
InstallCondition="NT_BUILD_STRING &gt;&lt; &quot;arm64&quot;"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="REINSTALLMODE" Value="[REINSTALLMODE]" />
<MsiProperty Name="ADDDESKTOPSHORTCUT" Value="[AddDesktopShortcutCheckbox]" />
</MsiPackage>
<?endif?>
</Chain>
</Bundle>