From 72bd4e4af905bd11a9ccba69fc7f18c63ee4c990 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 12:16:53 -0400 Subject: [PATCH 1/6] Drop Qt 6.2.2 --- .github/workflows/QtApng.yml | 6 ------ .github/workflows/kimageformats.yml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/.github/workflows/QtApng.yml b/.github/workflows/QtApng.yml index 0f3c725..a9d9116 100644 --- a/.github/workflows/QtApng.yml +++ b/.github/workflows/QtApng.yml @@ -20,12 +20,6 @@ jobs: vers: '5.15.2' arch: 'win32_msvc2019' buildArch: 'X86' - - os: windows-2022 - vers: '6.2.2' - arch: 'win64_msvc2019_64' - - os: macos-12 - vers: '6.2.2' - buildArch: 'Universal' - os: windows-2022 vers: '6.5.3' arch: 'win64_msvc2019_64' diff --git a/.github/workflows/kimageformats.yml b/.github/workflows/kimageformats.yml index 715ab5a..8c2dc8c 100644 --- a/.github/workflows/kimageformats.yml +++ b/.github/workflows/kimageformats.yml @@ -20,12 +20,6 @@ jobs: vers: '5.15.2' arch: 'win32_msvc2019' buildArch: 'X86' - - os: windows-2022 - vers: '6.2.2' - arch: 'win64_msvc2019_64' - - os: macos-12 - vers: '6.2.2' - buildArch: 'Universal' - os: windows-2022 vers: '6.5.3' arch: 'win64_msvc2019_64' From bbe3a6fd6f44f15ad6b2e2dfa3d18dbf485e9f9d Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 12:17:40 -0400 Subject: [PATCH 2/6] Qt 6.5.3 -> Qt 6.7.3 --- .github/workflows/QtApng.yml | 6 +++--- .github/workflows/kimageformats.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/QtApng.yml b/.github/workflows/QtApng.yml index a9d9116..ca6c33f 100644 --- a/.github/workflows/QtApng.yml +++ b/.github/workflows/QtApng.yml @@ -21,14 +21,14 @@ jobs: arch: 'win32_msvc2019' buildArch: 'X86' - os: windows-2022 - vers: '6.5.3' + vers: '6.7.3' arch: 'win64_msvc2019_64' - os: windows-2022 - vers: '6.5.3' + vers: '6.7.3' arch: 'win64_msvc2019_arm64' buildArch: 'Arm64' - os: macos-12 - vers: '6.5.3' + vers: '6.7.3' buildArch: 'Universal' steps: diff --git a/.github/workflows/kimageformats.yml b/.github/workflows/kimageformats.yml index 8c2dc8c..d4b8f49 100644 --- a/.github/workflows/kimageformats.yml +++ b/.github/workflows/kimageformats.yml @@ -21,14 +21,14 @@ jobs: arch: 'win32_msvc2019' buildArch: 'X86' - os: windows-2022 - vers: '6.5.3' + vers: '6.7.3' arch: 'win64_msvc2019_64' - os: windows-2022 - vers: '6.5.3' + vers: '6.7.3' arch: 'win64_msvc2019_arm64' buildArch: 'Arm64' - os: macos-12 - vers: '6.5.3' + vers: '6.7.3' buildArch: 'Universal' steps: From d704fd0ec5888bb0032b08b01250a5e479bffc16 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 13:39:41 -0400 Subject: [PATCH 3/6] Update Actions macOS runners --- .github/workflows/QtApng.yml | 4 ++-- .github/workflows/kimageformats.yml | 4 ++-- pwsh/buildapng.ps1 | 16 ++++++++++++---- pwsh/buildecm.ps1 | 8 +++----- pwsh/buildkarchive.ps1 | 15 ++++++++------- pwsh/buildkimageformats.ps1 | 19 +++++++++++++------ pwsh/get-vcpkg-deps.ps1 | 24 +++++++++++++++++------- 7 files changed, 57 insertions(+), 33 deletions(-) diff --git a/.github/workflows/QtApng.yml b/.github/workflows/QtApng.yml index ca6c33f..5d81090 100644 --- a/.github/workflows/QtApng.yml +++ b/.github/workflows/QtApng.yml @@ -14,7 +14,7 @@ jobs: include: - os: ubuntu-20.04 vers: '5.15.2' - - os: macos-12 + - os: macos-13 vers: '5.15.2' - os: windows-2022 vers: '5.15.2' @@ -27,7 +27,7 @@ jobs: vers: '6.7.3' arch: 'win64_msvc2019_arm64' buildArch: 'Arm64' - - os: macos-12 + - os: macos-14 vers: '6.7.3' buildArch: 'Universal' diff --git a/.github/workflows/kimageformats.yml b/.github/workflows/kimageformats.yml index d4b8f49..b1ccd54 100644 --- a/.github/workflows/kimageformats.yml +++ b/.github/workflows/kimageformats.yml @@ -14,7 +14,7 @@ jobs: include: - os: ubuntu-20.04 vers: '5.15.2' - - os: macos-12 + - os: macos-13 vers: '5.15.2' - os: windows-2022 vers: '5.15.2' @@ -27,7 +27,7 @@ jobs: vers: '6.7.3' arch: 'win64_msvc2019_arm64' buildArch: 'Arm64' - - os: macos-12 + - os: macos-14 vers: '6.7.3' buildArch: 'Universal' diff --git a/pwsh/buildapng.ps1 b/pwsh/buildapng.ps1 index 57e56b7..7754702 100755 --- a/pwsh/buildapng.ps1 +++ b/pwsh/buildapng.ps1 @@ -1,6 +1,7 @@ #!/usr/bin/env pwsh -$qtVersion = ((qmake --version -split '\n')[1] -split ' ')[3] +$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3] +Write-Host "Detected Qt Version $qtVersion" # Clone git clone https://github.com/jurplel/QtApng.git @@ -22,17 +23,24 @@ if ($IsWindows) { } elseif ($IsMacOS) { brew update brew install ninja + + if ($qtVersion -lt [version]'6.5.3') { + # Workaround for QTBUG-117484 + sudo xcode-select --switch /Applications/Xcode_14.3.1.app + } } else { sudo apt-get install ninja-build } +$argQt6 = $qtVersion.Major -ne 6 ? '-DAPNG_QT6=OFF' : $null +$argDeviceArchs = $IsMacOS -and $env:buildArch -eq 'Universal' ? '-DCMAKE_OSX_ARCHITECTURES=x86_64' : $null + # Build -$argApngQt6 = $qtVersion -like '5.*' ? "-DAPNG_QT6=OFF" : $null -cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release $argApngQt6 +cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release $argQt6 $argDeviceArchs ninja -C build if ($IsMacOS -and $env:buildArch -eq 'Universal') { - cmake -B build_arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 + cmake -B build_arm64 -G Ninja -DCMAKE_BUILD_TYPE=Release $argQt6 -DCMAKE_OSX_ARCHITECTURES=arm64 ninja -C build_arm64 } diff --git a/pwsh/buildecm.ps1 b/pwsh/buildecm.ps1 index f5e1ae6..708fdb8 100755 --- a/pwsh/buildecm.ps1 +++ b/pwsh/buildecm.ps1 @@ -10,12 +10,10 @@ if ($IsWindows) { & "$env:GITHUB_WORKSPACE/pwsh/vcvars.ps1" } +$argDeviceArchs = $IsMacOS -and $env:buildArch -eq 'Universal' ? '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64' : $null + # Build -if ($IsMacOS -and $env:buildArch -eq 'Universal') { - cmake -G Ninja . -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -} else { - cmake -G Ninja . -} +cmake -G Ninja . $argDeviceArchs if ($IsWindows) { ninja install diff --git a/pwsh/buildkarchive.ps1 b/pwsh/buildkarchive.ps1 index 89f74db..742d14f 100755 --- a/pwsh/buildkarchive.ps1 +++ b/pwsh/buildkarchive.ps1 @@ -1,5 +1,7 @@ #!/usr/bin/env pwsh +$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3] + # Clone git clone https://invent.kde.org/frameworks/karchive.git cd karchive @@ -12,18 +14,17 @@ if ($IsWindows) { & "$env:GITHUB_WORKSPACE\pwsh\vcvars.ps1" } -# don't use homebrew zlib/zstd if ($IsMacOS) { - brew uninstall --ignore-dependencies zlib + # Uninstall this because there's only one architecture installed, which + # prevents the other architecture of the universal binary from building brew uninstall --ignore-dependencies zstd } -if ((qmake --version -split '\n')[1][17] -eq '6') { - $qt6flag = "-DBUILD_WITH_QT6=ON" -} +$argQt6 = $qtVersion.Major -eq 6 ? '-DBUILD_WITH_QT6=ON' : $null +$argDeviceArchs = $IsMacOS -and $env:buildArch -eq 'Universal' ? '-DCMAKE_OSX_ARCHITECTURES=x86_64' : $null # Build -cmake -G Ninja -DCMAKE_INSTALL_PREFIX="$PWD/installed/" -DCMAKE_BUILD_TYPE=Release $qt6flag -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" . +cmake -G Ninja -DCMAKE_INSTALL_PREFIX="$PWD/installed/" -DCMAKE_BUILD_TYPE=Release $argQt6 $argDeviceArchs -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" . ninja ninja install @@ -35,7 +36,7 @@ if ($IsMacOS -and $env:buildArch -eq 'Universal') { rm -rf CMakeFiles/ rm -rf CMakeCache.txt - cmake -G Ninja -DCMAKE_INSTALL_PREFIX="$PWD/installed_arm64/" -DCMAKE_BUILD_TYPE=Release $qt6flag -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="arm64-osx" . + cmake -G Ninja -DCMAKE_INSTALL_PREFIX="$PWD/installed_arm64/" -DCMAKE_BUILD_TYPE=Release $argQt6 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="arm64-osx" . ninja ninja install diff --git a/pwsh/buildkimageformats.ps1 b/pwsh/buildkimageformats.ps1 index e301f6c..ff603fe 100755 --- a/pwsh/buildkimageformats.ps1 +++ b/pwsh/buildkimageformats.ps1 @@ -1,5 +1,8 @@ #!/usr/bin/env pwsh +$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3] +Write-Host "Detected Qt Version $qtVersion" + $kde_vers = 'v5.116.0' # Clone @@ -28,6 +31,11 @@ if ($IsWindows) { } elseif ($IsMacOS) { brew update brew install ninja + + if ($qtVersion -lt [version]'6.5.3') { + # Workaround for QTBUG-117484 + sudo xcode-select --switch /Applications/Xcode_14.3.1.app + } } else { sudo apt-get install ninja-build } @@ -37,17 +45,16 @@ if ($IsWindows) { & "$env:GITHUB_WORKSPACE/pwsh/get-vcpkg-deps.ps1" & "$env:GITHUB_WORKSPACE/pwsh/buildkarchive.ps1" $kde_vers -if ((qmake --version -split '\n')[1][17] -eq '6') { - $qt6flag = "-DBUILD_WITH_QT6=ON" -} - # Resolve pthread error on linux if (-Not $IsWindows) { $env:CXXFLAGS += ' -pthread' } +$argQt6 = $qtVersion.Major -eq 6 ? '-DBUILD_WITH_QT6=ON' : $null +$argDeviceArchs = $IsMacOS -and $env:buildArch -eq 'Universal' ? '-DCMAKE_OSX_ARCHITECTURES=x86_64' : $null + # Build kimageformats -cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/installed" -DKIMAGEFORMATS_JXL=ON -DKIMAGEFORMATS_HEIF=ON $qt6flag -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" . +cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/installed" -DKIMAGEFORMATS_JXL=ON -DKIMAGEFORMATS_HEIF=ON $argQt6 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" $argDeviceArchs . ninja ninja install @@ -67,7 +74,7 @@ if ($IsMacOS -and $env:buildArch -eq 'Universal') { $env:KF5Archive_DIR = $env:KF5Archive_DIR_ARM - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/installed_arm64" -DKIMAGEFORMATS_JXL=ON -DKIMAGEFORMATS_HEIF=ON $qt6flag -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="arm64-osx" -DCMAKE_OSX_ARCHITECTURES="arm64" . + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/installed_arm64" -DKIMAGEFORMATS_JXL=ON -DKIMAGEFORMATS_HEIF=ON $argQt6 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="arm64-osx" -DCMAKE_OSX_ARCHITECTURES="arm64" . ninja ninja install diff --git a/pwsh/get-vcpkg-deps.ps1 b/pwsh/get-vcpkg-deps.ps1 index 158671e..85e7bf3 100755 --- a/pwsh/get-vcpkg-deps.ps1 +++ b/pwsh/get-vcpkg-deps.ps1 @@ -1,5 +1,7 @@ #!/usr/bin/env pwsh +using namespace System.Runtime.InteropServices + # Install vcpkg if we don't already have it if ($env:VCPKG_ROOT -eq $null) { git clone https://github.com/microsoft/vcpkg @@ -19,28 +21,36 @@ if ($IsWindows) { choco install nasm } elseif ($IsMacOS) { brew install nasm -# Remove this package on macOS because it caues problems - brew uninstall --ignore-dependencies webp # Avoid linking to homebrew stuff later } else { # (and bonus dependencies) sudo apt-get install nasm libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev } # Set default triplet +$hostArch = [RuntimeInformation]::OSArchitecture if ($IsWindows) { - # Use environment variable to detect target platform $env:VCPKG_DEFAULT_TRIPLET = $env:buildArch -eq 'X86' ? 'x86-windows' : $env:buildArch -eq 'Arm64' ? 'arm64-windows' : - 'x64-windows' + $hostArch -eq [Architecture]::X64 ? 'x64-windows' : + $null } elseif ($IsMacOS) { - # Build x64 first; arm64 will come later for universal binaries - $env:VCPKG_DEFAULT_TRIPLET = "x64-osx" + # For universal binaries, build x64 first; arm64 will come later + $env:VCPKG_DEFAULT_TRIPLET = + $env:buildArch -eq 'Universal' ? 'x64-osx' : + $hostArch -eq [Architecture]::X64 ? 'x64-osx' : + $hostArch -eq [Architecture]::Arm64 ? 'arm64-osx' : + $null } elseif ($IsLinux) { - $env:VCPKG_DEFAULT_TRIPLET = "x64-linux" + $env:VCPKG_DEFAULT_TRIPLET = + $hostArch -eq [Architecture]::X64 ? 'x64-linux' : + $null } else { throw 'Unsupported platform.' } +if (-not $env:VCPKG_DEFAULT_TRIPLET) { + throw 'Unsupported architecture.' +} # Get our dependencies using vcpkg! if ($IsWindows) { From fcaa442e97ae592ab1472d18c8fe0fff2d2c80f1 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 12:18:37 -0400 Subject: [PATCH 4/6] Update vcpkgGitCommitId --- .github/workflows/kimageformats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kimageformats.yml b/.github/workflows/kimageformats.yml index b1ccd54..09de110 100644 --- a/.github/workflows/kimageformats.yml +++ b/.github/workflows/kimageformats.yml @@ -45,7 +45,7 @@ jobs: - name: Setup vcpkg uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: '7eb700c9688daed6d8bdcdc571ebe3eedea6a774' + vcpkgGitCommitId: '9558037875497b9db8cf38fcd7db68ec661bffe7' - name: Build KImageFormats (just one big step for now) run: pwsh pwsh/buildkimageformats.ps1 From 51367a64056093349515b8a8efeee2edf2f40006 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 12:20:44 -0400 Subject: [PATCH 5/6] Cleanup LibRaw patch --- util/kimageformats-find-libraw-vcpkg.patch | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/util/kimageformats-find-libraw-vcpkg.patch b/util/kimageformats-find-libraw-vcpkg.patch index 2f6a004..5efc51d 100644 --- a/util/kimageformats-find-libraw-vcpkg.patch +++ b/util/kimageformats-find-libraw-vcpkg.patch @@ -1,20 +1,17 @@ ---- kimageformats/CMakeLists.txt 2023-08-05 16:14:58 -+++ CMakeLists.txt 2023-08-05 16:14:49 -@@ -74,11 +74,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,11 +74,13 @@ add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images") # note: module FindLibRaw missing from https://invent.kde.org/frameworks/extra-cmake-modules -find_package(LibRaw 0.20.2) --set_package_properties(LibRaw PROPERTIES -+find_package(libraw CONFIG) -+get_property(importTargetsAfter DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS) -+set_package_properties(libraw PROPERTIES ++find_package(LibRaw 0.20.2 NAMES libraw) + set_package_properties(LibRaw PROPERTIES TYPE OPTIONAL PURPOSE "Required for the QImage plugin for RAW images" ) +# Adapt naming so the rest of the cmake infra finds this new target +add_library(LibRaw::LibRaw ALIAS libraw::raw) -+set(LibRaw_FOUND ${libraw_FOUND}) ecm_set_disabled_deprecation_versions( QT 5.15.2 From cac339e26603adfab9d69688b00a5b23546d9e7b Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 12 Oct 2024 12:23:02 -0400 Subject: [PATCH 6/6] Remove libheif arm64-windows workaround --- pwsh/get-vcpkg-deps.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pwsh/get-vcpkg-deps.ps1 b/pwsh/get-vcpkg-deps.ps1 index 85e7bf3..165f14c 100755 --- a/pwsh/get-vcpkg-deps.ps1 +++ b/pwsh/get-vcpkg-deps.ps1 @@ -90,10 +90,7 @@ function WriteOverlayTriplet() { function InstallPackages() { WriteOverlayTriplet - # libheif: Skip x265 on arm64-windows as it doesn't build (only needed for encoding) - $libheif = $env:VCPKG_DEFAULT_TRIPLET -eq 'arm64-windows' ? 'libheif[core]' : 'libheif' - - & "$env:VCPKG_ROOT/$vcpkgexec" install libjxl libavif[aom] $libheif openexr zlib libraw + & "$env:VCPKG_ROOT/$vcpkgexec" install libjxl libavif[aom] libheif openexr zlib libraw } # Build for main triplet