Skip to content

Commit

Permalink
Merge pull request #690 from jdpurcell/pr-winarm64
Browse files Browse the repository at this point in the history
Windows ARM64
  • Loading branch information
jurplel committed Jun 29, 2024
2 parents 7891cfa + b364675 commit c277a97
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 56 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,33 @@ jobs:
- runner: 'macos-12'
qtVersion: '6.5.3'
qtModules: 'qtimageformats'
buildArch: 'Universal'
- runner: 'macos-12'
qtVersion: '5.15.2'
osSuffix: '_legacy'
- runner: 'windows-2019'
- runner: 'windows-2022'
qtVersion: '6.5.3'
qtArch: 'win64_msvc2019_64'
osSuffix: '_64'
qtModules: 'qtimageformats'
- runner: 'windows-2019'
- runner: 'windows-2022'
qtVersion: '6.5.3'
qtArch: 'win64_msvc2019_arm64'
osSuffix: '_arm64'
qtModules: 'qtimageformats'
buildArch: 'Arm64'
- runner: 'windows-2022'
qtVersion: '5.15.2'
qtArch: 'win32_msvc2019'
osSuffix: '_32'
buildArch: 'X86'
runs-on: ${{ matrix.runner }}
steps:
- name: Set environment variables
shell: bash
run: |
echo "arch=${{ matrix.qtArch }}" >> $GITHUB_ENV
echo "qtArch=${{ matrix.qtArch }}" >> $GITHUB_ENV
echo "buildArch=${{ matrix.buildArch }}" >> $GITHUB_ENV
if [ "${{ inputs.isRelease }}" != "true" ]; then
buildNum=$(date '+%Y-%m-%d').$GITHUB_RUN_ATTEMPT
echo "nightlyDefines=NIGHTLY=$buildNum" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if ($IsWindows) {
dist/scripts/vcvars.ps1
}

if ((qmake --version -split '\n')[1][17] -eq '6') {
if ($env:buildArch -eq 'Universal') {
qmake QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64" $args[0] PREFIX=$Prefix DEFINES+="$env:nightlyDefines"
} else {
qmake $args[0] PREFIX=$Prefix DEFINES+="$env:nightlyDefines"
Expand Down
10 changes: 6 additions & 4 deletions dist/scripts/download-plugins.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Write-Host "Detected Qt Version $qtVersion"

# Qt version availability and runner names are assumed.
if ($IsWindows) {
$imageName = "windows-2019"
$imageName = "windows-2022"
} elseif ($IsMacOS) {
$imageName = "macos-12"
} else {
Expand All @@ -23,8 +23,8 @@ if ($pluginNames.count -eq 0) {
}

foreach ($pluginName in $pluginNames) {
$arch = If (-not $env:arch -or $env:arch -eq '') { "" } Else { "-$env:arch" }
$artifactName = "$pluginName-$imageName-$qtVersion$arch.zip"
$qtArch = $env:qtArch ? "-$env:qtArch" : ''
$artifactName = "$pluginName-$imageName-$qtVersion$qtArch.zip"
$downloadUrl = "$binaryBaseUrl/$artifactName"

Write-Host "Downloading $downloadUrl"
Expand Down Expand Up @@ -76,7 +76,9 @@ if ($pluginNames -contains 'kimageformats') {
if (Test-Path -Path kimageformats/kimageformats/output/heif.dll -PathType Leaf) {
cp kimageformats/kimageformats/output/heif.dll "$out_frm/"
cp kimageformats/kimageformats/output/libde265.dll "$out_frm/"
cp kimageformats/kimageformats/output/libx265.dll "$out_frm/"
if ($env:buildArch -ne 'Arm64') {
cp kimageformats/kimageformats/output/libx265.dll "$out_frm/"
}
cp kimageformats/kimageformats/output/aom.dll "$out_frm/"
}
# copy raw stuff
Expand Down
12 changes: 7 additions & 5 deletions dist/scripts/innomake.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Script assumes $env:arch will start with win64 or win32
$win64orwin32 = $env:arch.substring(0, 5)
New-Item -Path "dist\win\qView-$win64orwin32" -ItemType Directory -ea 0
copy -R bin\* "dist\win\qView-$win64orwin32"
iscc dist\win\qView$($env:arch.substring(3, 2)).iss
$suffix =
$env:buildArch -eq 'X86' ? '32' :
$env:buildArch -eq 'Arm64' ? 'Arm64' :
'64';
New-Item -Path "dist\win\qView-Win$suffix" -ItemType Directory -ea 0
copy -R bin\* "dist\win\qView-Win$suffix"
iscc dist\win\qView$suffix.iss
copy dist\win\Output\* bin\
26 changes: 17 additions & 9 deletions dist/scripts/vcvars.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Script assumes $env:arch will start with win64 or win32
# This should probably be an arg
$arch = $env:arch.substring(3, 2)
$path = Resolve-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\*\*\VC\Auxiliary\Build" | select -ExpandProperty Path
using namespace System.Runtime.InteropServices

cmd.exe /c "call `"$path\vcvars$arch.bat`" && set > %temp%\vcvars.txt"
if ([RuntimeInformation]::OSArchitecture -ne [Architecture]::X64) {
throw 'Unsupported host architecture.'
}

$arch =
$env:buildArch -eq 'X86' ? 'x64_x86' :
$env:buildArch -eq 'Arm64' ? 'x64_arm64' :
'x64'
$path = Resolve-Path "${env:ProgramFiles}\Microsoft Visual Studio\*\*\VC\Auxiliary\Build" | Select-Object -ExpandProperty Path

cmd.exe /c "call `"$path\vcvarsall.bat`" $arch && set > %temp%\vcvars.txt"

$exclusions = @('VCPKG_ROOT') # Workaround for https://developercommunity.visualstudio.com/t/VCPKG_ROOT-is-being-overwritten-by-the-D/10430650
Get-Content "$env:temp\vcvars.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "env:\$($matches[1])" $matches[2]
}
}
if ($_ -match "^(.*?)=(.*)$" -and $matches[1] -notin $exclusions) {
[Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
54 changes: 30 additions & 24 deletions dist/scripts/windeployqt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,41 @@ param
$qtVersion = ((qmake --version -split '\n')[1] -split ' ')[3]
Write-Host "Detected Qt Version $qtVersion"

# Download and extract openssl
if ($qtVersion -like '5.*') {
$openSslDownloadUrl = "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip"
$openSslFolderVersion = "1.1"
$openSslFilenameVersion = "1_1"
} else {
$openSslDownloadUrl = "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.2.1.zip"
$openSslFolderVersion = "3"
$openSslFilenameVersion = "3"
if ($env:buildArch -ne 'Arm64') {
# Download and extract openssl
if ($qtVersion -like '5.*') {
$openSslDownloadUrl = "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip"
$openSslFolderVersion = "1.1"
$openSslFilenameVersion = "1_1"
} else {
$openSslDownloadUrl = "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.2.1.zip"
$openSslFolderVersion = "3"
$openSslFilenameVersion = "3"
}
Write-Host "Downloading $openSslDownloadUrl"
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $openSslDownloadUrl -OutFile openssl.zip
7z x -y .\openssl.zip

# Install approprate binaries for architecture
if ($env:buildArch -eq 'X86') {
copy openssl-$openSslFolderVersion\x86\bin\libssl-$openSslFilenameVersion.dll bin\
copy openssl-$openSslFolderVersion\x86\bin\libcrypto-$openSslFilenameVersion.dll bin\
} else {
copy openssl-$openSslFolderVersion\x64\bin\libssl-$openSslFilenameVersion-x64.dll bin\
copy openssl-$openSslFolderVersion\x64\bin\libcrypto-$openSslFilenameVersion-x64.dll bin\
}
}
Write-Host "Downloading $openSslDownloadUrl"
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $openSslDownloadUrl -OutFile openssl.zip
7z x -y .\openssl.zip

# Check if "arch" environment variable is win32
# If it is, install x86 binaries, otherwise x64 binaries
if ($env:arch.substring(3, 2) -eq '32') {
copy openssl-$openSslFolderVersion\x86\bin\libssl-$openSslFilenameVersion.dll bin\
copy openssl-$openSslFolderVersion\x86\bin\libcrypto-$openSslFilenameVersion.dll bin\
if ($env:buildArch -eq 'Arm64') {
# Run windeployqt in cross-compilation mode
$qtHostPath = [System.IO.Path]::GetFullPath("$env:QT_ROOT_DIR\..\$((Split-Path -Path $env:QT_ROOT_DIR -Leaf) -replace '_arm64', '_64')")
& "$qtHostPath\bin\windeployqt" "--qmake=$env:QT_ROOT_DIR\bin\qmake.bat" --no-compiler-runtime bin\qView.exe
} else {
copy openssl-$openSslFolderVersion\x64\bin\libssl-$openSslFilenameVersion-x64.dll bin\
copy openssl-$openSslFolderVersion\x64\bin\libcrypto-$openSslFilenameVersion-x64.dll bin\
# Run windeployqt which should be in path
windeployqt --no-compiler-runtime bin/qView.exe
}

# Run windeployqt which should be in path
windeployqt bin/qView.exe --no-compiler-runtime


if ($NightlyVersion -eq '') {
# Call innomake if we are not building a nightly version (no version passed)
& "dist/scripts/innomake.ps1"
Expand Down
8 changes: 4 additions & 4 deletions dist/win/qView32.iss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MyAppName "qView"
#define MyAppName "qView"
#define MyAppPublisher "jurplel and qView contributors"
#define MyAppURL "https://interversehq.com/qview/"
#define MyAppExeName "qView.exe"
Expand All @@ -25,14 +25,14 @@ WizardImageFile=wiz.bmp
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
VersionInfoVersion={#MyAppVersion}
AppCopyright=Copyright © 2018-{#MyAppYear}, {#MyAppPublisher}
AppCopyright=Copyright © 2018-{#MyAppYear}, {#MyAppPublisher}
MinVersion=0,6.1
DisableProgramGroupPage=yes
ChangesAssociations=yes
Compression=lzma
SolidCompression=yes
PrivilegesRequiredOverridesAllowed=dialog
ArchitecturesAllowed=x86 x64
ArchitecturesAllowed=x86compatible

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -43,7 +43,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "fileassociation"; Description: "Create file associations"; GroupDescription: "Other:";

[Files]
Source: "qView-win32/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "qView-Win32/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "qView.VisualElementsManifest.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "win-tile-m.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "win-tile-s.png"; DestDir: "{app}"; Flags: ignoreversion
Expand Down
11 changes: 5 additions & 6 deletions dist/win/qView64.iss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MyAppName "qView"
#define MyAppName "qView"
#define MyAppPublisher "jurplel and qView contributors"
#define MyAppURL "https://interversehq.com/qview/"
#define MyAppExeName "qView.exe"
Expand All @@ -25,15 +25,15 @@ WizardImageFile=wiz.bmp
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
VersionInfoVersion={#MyAppVersion}
AppCopyright=Copyright © 2018-{#MyAppYear}, {#MyAppPublisher}
AppCopyright=Copyright © 2018-{#MyAppYear}, {#MyAppPublisher}
MinVersion=0,6.1
DisableProgramGroupPage=yes
ChangesAssociations=yes
Compression=lzma
SolidCompression=yes
PrivilegesRequiredOverridesAllowed=dialog
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64compatible
ArchitecturesAllowed=x64compatible

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -44,7 +44,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "fileassociation"; Description: "Create file associations"; GroupDescription: "Other:";

[Files]
Source: "qView-win64/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "qView-Win64/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "qView.VisualElementsManifest.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "win-tile-m.png"; DestDir: "{app}"; Flags: ignoreversion
Source: "win-tile-s.png"; DestDir: "{app}"; Flags: ignoreversion
Expand Down Expand Up @@ -107,7 +107,6 @@ Root: HKA; Subkey: "SOFTWARE\Classes\.sgi\OpenWithProgids"; ValueType: string; V
Root: HKA; Subkey: "SOFTWARE\Classes\.tga\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppName}.1"; ValueData: ""; Flags: uninsdeletevalue; Tasks: fileassociation
Root: HKA; Subkey: "SOFTWARE\Classes\.xcf\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppName}.1"; ValueData: ""; Flags: uninsdeletevalue; Tasks: fileassociation


; Capabilities keys for default programs/apps to work
Root: HKA; Subkey: "Software\{#MyAppName}"; Flags: uninsdeletekey; Tasks: fileassociation
Root: HKA; Subkey: "Software\{#MyAppName}\Capabilities"; ValueType: string; ValueName: "ApplicationName"; ValueData: "{#MyAppName}"; Tasks: fileassociation
Expand Down
Loading

0 comments on commit c277a97

Please sign in to comment.