Skip to content

Commit

Permalink
Merge pull request #4 from jdpurcell/pr-winarm64
Browse files Browse the repository at this point in the history
Windows ARM64
  • Loading branch information
jurplel authored Jun 27, 2024
2 parents 10d9220 + 7721080 commit 0412665
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 437 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/QtApng.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: Build QtApng
on:
push:
branches: [ master ]
branches: [master]
workflow_dispatch:
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
vers: ['5.15.2']
include:
- os: windows-2019
- os: ubuntu-20.04
vers: '5.15.2'
- os: macos-12
vers: '5.15.2'
- os: windows-2022
vers: '5.15.2'
forceWin32: 'true'
arch: 'win32_msvc2019'
- os: windows-2019
buildArch: 'X86'
- os: windows-2022
vers: '6.2.2'
forceWin32: 'false'
arch: 'win64_msvc2019_64'
- os: macos-12
vers: '6.2.2'
universalBinary: 'true'
- os: windows-2019
buildArch: 'Universal'
- os: windows-2022
vers: '6.5.3'
forceWin32: 'false'
arch: 'win64_msvc2019_64'
- os: windows-2022
vers: '6.5.3'
arch: 'win64_msvc2019_arm64'
buildArch: 'Arm64'
- os: macos-12
vers: '6.5.3'
universalBinary: 'true'
buildArch: 'Universal'

steps:
- uses: actions/checkout@v4
Expand All @@ -46,8 +50,7 @@ jobs:
- name: Build QtApng
run: pwsh pwsh/buildapng.ps1
env:
forceWin32: ${{ matrix.forceWin32 }}
universalBinary: ${{ matrix.universalBinary }}
buildArch: ${{ matrix.buildArch }}

- name: 'Upload Artifact'
if: github.ref != 'refs/heads/master'
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/kimageformats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ jobs:
vers: '5.15.2'
- os: macos-12
vers: '5.15.2'
- os: windows-2019
- os: windows-2022
vers: '5.15.2'
forceWin32: 'true'
arch: 'win32_msvc2019'
- os: windows-2019
buildArch: 'X86'
- os: windows-2022
vers: '6.2.2'
forceWin32: 'false'
arch: 'win64_msvc2019_64'
- os: macos-12
vers: '6.2.2'
universalBinary: 'true'
- os: windows-2019
buildArch: 'Universal'
- os: windows-2022
vers: '6.5.3'
forceWin32: 'false'
arch: 'win64_msvc2019_64'
- os: windows-2022
vers: '6.5.3'
arch: 'win64_msvc2019_arm64'
buildArch: 'Arm64'
- os: macos-12
vers: '6.5.3'
universalBinary: 'true'
buildArch: 'Universal'

steps:
- uses: actions/checkout@v4
Expand All @@ -54,8 +56,7 @@ jobs:
- name: Build KImageFormats (just one big step for now)
run: pwsh pwsh/buildkimageformats.ps1
env:
forceWin32: ${{ matrix.forceWin32 }}
universalBinary: ${{ matrix.universalBinary }}
buildArch: ${{ matrix.buildArch }}

- name: 'Upload Artifact'
if: github.ref != 'refs/heads/master'
Expand Down
8 changes: 6 additions & 2 deletions pwsh/buildapng.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ git checkout 6a83caf22111cb8054753b925c2dfbcd9b92e038

# Dependencies
if ($IsWindows) {
if ($env:buildArch -eq 'Arm64') {
# CMake needs QT_HOST_PATH when cross-compiling
$env:QT_HOST_PATH = [System.IO.Path]::GetFullPath("$env:QT_ROOT_DIR\..\$((Split-Path -Path $env:QT_ROOT_DIR -Leaf) -replace '_arm64', '_64')")
}
& "$env:GITHUB_WORKSPACE/pwsh/vcvars.ps1"
choco install ninja pkgconfiglite
} elseif ($IsMacOS) {
Expand All @@ -23,7 +27,7 @@ $argApngQt6 = $qtVersion -like '5.*' ? "-DAPNG_QT6=OFF" : $null
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release $argApngQt6
ninja -C build

if ($env:universalBinary -eq 'true') {
if ($IsMacOS -and $env:buildArch -eq 'Universal') {
cmake -B build_arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64
ninja -C build_arm64
}
Expand All @@ -33,7 +37,7 @@ $outputDir = "output"
mkdir $outputDir
$files = Get-ChildItem -Path "build/plugins/imageformats" | Where-Object { $_.Extension -in ".dylib", ".dll", ".so" }
foreach ($file in $files) {
if ($env:universalBinary -eq 'true') {
if ($IsMacOS -and $env:buildArch -eq 'Universal') {
$name = $file.Name
lipo -create "$file" "build_arm64/plugins/imageformats/$name" -output "$outputDir/$name"
lipo -info "$outputDir/$name"
Expand Down
126 changes: 0 additions & 126 deletions pwsh/buildavif.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion pwsh/buildecm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if ($IsWindows) {
}

# Build
if ($env:universalBinary) {
if ($IsMacOS -and $env:buildArch -eq 'Universal') {
cmake -G Ninja . -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
} else {
cmake -G Ninja .
Expand Down
52 changes: 0 additions & 52 deletions pwsh/buildheic.ps1

This file was deleted.

21 changes: 0 additions & 21 deletions pwsh/buildjpegxl.ps1

This file was deleted.

11 changes: 4 additions & 7 deletions pwsh/buildkarchive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ git clone https://invent.kde.org/frameworks/karchive.git
cd karchive
git checkout $args[0]

# NOTE: This script assumes VCPKG_DEFAULT_TRIPLET is already set (e.g. by get-vcpkg-deps.ps1 running prior)

if ($IsWindows) {
if ([Environment]::Is64BitOperatingSystem -and ($env:forceWin32 -ne 'true')) {
$env:VCPKG_DEFAULT_TRIPLET = "x64-windows"
} else {
$env:VCPKG_DEFAULT_TRIPLET = "x86-windows"
}
# vcvars on windows
& "$env:GITHUB_WORKSPACE\pwsh\vcvars.ps1"
}
Expand All @@ -32,7 +29,7 @@ ninja
ninja install

# Build arm64 version as well and macos and lipo them together
if ($env:universalBinary) {
if ($IsMacOS -and $env:buildArch -eq 'Universal') {
Write-Host "Building arm64 binaries"

rm -rf CMakeFiles/
Expand All @@ -52,7 +49,7 @@ try {

cd ../

if ($env:universalBinary) {
if ($IsMacOS -and $env:buildArch -eq 'Universal') {
cd installed_arm64/ -ErrorAction Stop

$env:KF5Archive_DIR_ARM = Split-Path -Path (Get-Childitem -Include KF5ArchiveConfig.cmake -Recurse -ErrorAction SilentlyContinue)[0]
Expand Down
Loading

0 comments on commit 0412665

Please sign in to comment.