Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Windows ARM64 #140

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/build-ffmpeg/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ runs:
Linux)
if ! type zsh > /dev/null 2>&1; then
sudo apt update
sudo apt install zsh
sudo apt install zsh yasm
fi
;;
macOS)
Expand Down
17 changes: 16 additions & 1 deletion .github/actions/build-windows-qt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,22 @@ runs:
shell: pwsh
run: ./Build-Dependencies.ps1 -Dependencies "Qt${{ inputs.qtVersion }}" -SkipBuild -SkipUnpack -Target ${{ inputs.target }} -Configuration ${{ inputs.config }} -Shared

- name: Install Qt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use third party actions, if you need a host-version of Qt, wait for the associated x64 job to finish, then use that artifact.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us know if that is not feasible as-is - in doubt we can and should amend the current Qt build workflow to generate what this workflow needs. Also I don't think I have seen associated steps in the build scripts ensuring that a host installation of Qt is available to cross compile it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's possible in theory. I will need to dig a little bit about the CI though.

uses: jurplel/install-qt-action@v3
with:
version: '6.4.1'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
modules: 'qtimageformats qtmultimedia qtshadertools'
archives: 'qtsvg qtbase'
cache: true

- name: Build and Install Windows Qt
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' && inputs.qtVersion > '5'}}
shell: pwsh
run: ./Build-Dependencies.ps1 -Dependencies "Qt${{ inputs.qtVersion }}" -Target ${{ inputs.target }} -Configuration ${{ inputs.config }} -Shared -QtHostPath $Env:Qt6_DIR
- name: Build and Install Windows Qt
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' && inputs.qtVersion == '5'}}
shell: pwsh
run: ./Build-Dependencies.ps1 -Dependencies "Qt${{ inputs.qtVersion }}" -Target ${{ inputs.target }} -Configuration ${{ inputs.config }} -Shared
22 changes: 18 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: true
matrix:
target: [macos-arm64, macos-x86_64, linux-x86_64, windows-x64, windows-x86]
target: [macos-arm64, macos-x86_64, linux-x86_64, windows-x64, windows-x86, windows-arm64]
include:
- target: macos-arm64
os: 'macos-12'
Expand All @@ -46,6 +46,11 @@ jobs:
config: 'Release'
type: 'static'
revision: 8
- target: windows-arm64
os: 'ubuntu-20.04'
config: 'Release'
type: 'static'
revision: 8
env:
CACHE_REVISION: ${{ matrix.revision }}
defaults:
Expand Down Expand Up @@ -455,14 +460,17 @@ jobs:
strategy:
fail-fast: true
matrix:
target: [x64, x86]
target: [x64, x86, arm64]
include:
- target: x64
config: 'Release'
type: 'static'
- target: x86
config: 'Release'
type: 'static'
- target: arm64
config: 'Release'
type: 'static'
env:
CACHE_REVISION: '3'
defaults:
Expand Down Expand Up @@ -536,8 +544,11 @@ jobs:
fail-fast: true
matrix:
qtVersion: [5, 6]
target: [x64, x86]
target: [x64, x86, arm64]
config: ['RelWithDebInfo', 'Debug']
exclude:
- qtVersion: 5
target: arm64
env:
CACHE_REVISION: '02'
steps:
Expand Down Expand Up @@ -594,7 +605,10 @@ jobs:
fail-fast: true
matrix:
qtVersion: [5, 6]
target: [x64, x86]
target: [x64, x86, arm64]
exclude:
- qtVersion: 5
target: arm64
needs: [windows-qt-build]
steps:
- name: Checkout
Expand Down
71 changes: 39 additions & 32 deletions Build-Dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ param(
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
[string] $Configuration = 'Release',
[string[]] $Dependencies,
[ValidateSet('x86', 'x64')]
[ValidateSet('x86', 'x64', 'arm64')]
[string] $Target,
[switch] $Clean,
[switch] $Quiet,
[switch] $Shared,
[switch] $SkipAll,
[switch] $SkipBuild,
[switch] $SkipDeps,
[switch] $SkipUnpack
[switch] $SkipUnpack,
[string] $QtHostPath = $Env:Qt6_DIR
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -62,45 +63,47 @@ function Run-Stages {

. $Dependency

if ( ! ( $Targets.contains($Target) ) ) { continue }

if ( $Version -eq '' ) { $Version = $Versions[$Target] }
if ( $Uri -eq '' ) { $Uri = $Uris[$Target] }
if ( $Hash -eq '' ) { $Hash = $Hashes[$Target] }

if ( $Path -eq '' ) { $Path = [System.IO.Path]::GetFileNameWithoutExtension($Uri) }

Log-Output 'Initializing build'

$Stages | ForEach-Object {
$Stage = $_
$script:StageName = $Name
try {
Push-Location -Stack BuildTemp
if ( Test-Path function:$Stage ) {
. $Stage
if ( ( $Targets.contains($Target) ) ) {
if ( $Version -eq '' ) { $Version = $Versions[$Target] }
if ( $Uri -eq '' ) { $Uri = $Uris[$Target] }
if ( $Hash -eq '' ) { $Hash = $Hashes[$Target] }

if ( $Path -eq '' ) { $Path = [System.IO.Path]::GetFileNameWithoutExtension($Uri) }

Log-Output 'Initializing build'

$Stages | ForEach-Object {
$Stage = $_
$script:StageName = $Name
try {
Push-Location -Stack BuildTemp
if ( Test-Path function:$Stage ) {
. $Stage
}
} catch {
Pop-Location -Stack BuildTemp
Log-Error "Error during build step ${Stage} - $_"
} finally {
$StageName = ''
Pop-Location -Stack BuildTemp
}
} catch {
Pop-Location -Stack BuildTemp
Log-Error "Error during build step ${Stage} - $_"
} finally {
$StageName = ''
Pop-Location -Stack BuildTemp
}

if ( Test-Path "$PSScriptRoot/licenses/${Name}" ) {
Log-Information "Install license files"

$null = New-Item -ItemType Directory -Path "$($ConfigData.OutputPath)/licenses" -ErrorAction SilentlyContinue
Copy-Item -Path "$PSScriptRoot/licenses/${Name}" -Recurse -Force -Destination "$($ConfigData.OutputPath)/licenses"
}
} else {
Log-Debug "Skipping $Name"
}

$Stages | ForEach-Object {
Log-Debug "Removing function $_"
Remove-Item -ErrorAction 'SilentlyContinue' function:$_
$script:StageName = ''
}

if ( Test-Path "$PSScriptRoot/licenses/${Name}" ) {
Log-Information "Install license files"

$null = New-Item -ItemType Directory -Path "$($ConfigData.OutputPath)/licenses" -ErrorAction SilentlyContinue
Copy-Item -Path "$PSScriptRoot/licenses/${Name}" -Recurse -Force -Destination "$($ConfigData.OutputPath)/licenses"
}
}
}

Expand Down Expand Up @@ -168,6 +171,10 @@ function Build-Main {
$script:PackageName = 'qt5'
} elseif ( $Dependencies -eq 'qt6' ) {
$script:PackageName = 'qt6'

if ( $Target -eq 'arm64' ) {
$script:QtHostPath = $QtHostPath
}
}

$UtilityFunctions = Get-ChildItem -Path $PSScriptRoot/utils.pwsh/*.ps1 -Recurse
Expand Down
6 changes: 3 additions & 3 deletions deps.ffmpeg/10-zlib.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local url='https://github.com/madler/zlib.git'
local hash='04f42ceca40f73e2978b50e93806c2a18c1281fc'

## Dependency Overrides
local targets=('windows-x*')
local targets=('windows-*')

## Build Steps
setup() {
Expand All @@ -33,7 +33,7 @@ config() {
-DCMAKE_SHARED_LIBRARY_PREFIX=""
-DCMAKE_SHARED_LIBRARY_PREFIX_C=""
)
if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
args+=(
-DZ_HAVE_UNISTD_H=OFF
)
Expand Down Expand Up @@ -83,7 +83,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
log_info "Fixup (%F{3}${target}%f)"
autoload -Uz create_importlibs
create_importlibs ${target_config[output_dir]}/bin/zlib*.dll
Expand Down
4 changes: 2 additions & 2 deletions deps.ffmpeg/20-libpng.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ config() {
}

case ${target} {
macos-arm64 | macos-universal)
macos-arm64 | macos-universal | windows-arm64)
args+=(
-DCMAKE_ASM_FLAGS="-DPNG_ARM_NEON_IMPLEMENTATION=1"
-DPNG_ARM_NEON=on
Expand Down Expand Up @@ -115,7 +115,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
log_info "Fixup (%F{3}${target}%f)"
if (( shared_libs )) {
autoload -Uz create_importlibs
Expand Down
10 changes: 9 additions & 1 deletion deps.ffmpeg/20-opus.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ config() {
-DOPUS_FORTIFY_SOURCE=OFF
)
;;
windows-arm64)
args+=(
-DOPUS_STACK_PROTECTOR=OFF
-DOPUS_FORTIFY_SOURCE=OFF
-DRUNTIME_CPU_CAPABILITY_DETECTION=OFF
-DOPUS_DISABLE_INTRINSICS=ON
)
;;
}

log_info "Config (%F{3}${target}%f)"
Expand Down Expand Up @@ -103,7 +111,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
if (( shared_libs )) {
log_info "Fixup (%F{3}${target}%f)"
autoload -Uz create_importlibs
Expand Down
2 changes: 1 addition & 1 deletion deps.ffmpeg/30-libogg.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
if (( shared_libs )) {
log_info "Fixup (%F{3}${target}%f)"
autoload -Uz create_importlibs
Expand Down
2 changes: 1 addition & 1 deletion deps.ffmpeg/30-libvorbis.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
if (( shared_libs )) {
log_info "Fixup (%F{3}${target}%f)"
autoload -Uz create_importlibs
Expand Down
6 changes: 5 additions & 1 deletion deps.ffmpeg/30-libvpx.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ config() {
cross_prefix="${target_config[cross_prefix]}-w64-mingw32-"
args+=(--enable-runtime-cpu-detect --target="${target_config[gcc_target]}")
;;
windows-arm64)
cross_prefix="${target_config[cross_prefix]}-w64-mingw32-"
args+=(--disable-runtime-cpu-detect --target="${target_config[gcc_target]}")
;;
}

log_info "Config (%F{3}${target}%f)"
Expand Down Expand Up @@ -164,7 +168,7 @@ fixup() {
strip_tool=strip
strip_files=("${target_config[output_dir]}"/lib/libvpx*.dylib(:a))
;;
windows-x*)
windows-*)
autoload -Uz create_importlibs
create_importlibs "${target_config[output_dir]}"/bin/libvpx*.dll(:a)

Expand Down
4 changes: 2 additions & 2 deletions deps.ffmpeg/30-svt-av1.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local url='https://gitlab.com/AOMediaCodec/SVT-AV1.git'
local hash='91b94efb2809e83d9bf041d8575b32f234dfef27'

## Dependency Overrides
local targets=(windows-x64 'linux-*')
local targets=(windows-x64 windows-arm64 'linux-*')

## Build Steps
setup() {
Expand Down Expand Up @@ -83,7 +83,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
if (( shared_libs )) {
mv (#i)"${target_config[output_dir]}"/lib/libsvtav1*.dll "${target_config[output_dir]}"/bin/
log_info "Fixup (%F{3}${target}%f)"
Expand Down
5 changes: 3 additions & 2 deletions deps.ffmpeg/40-aom.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local -a patches=(
)

## Dependency Overrides
local targets=(windows-x64 'macos-*' 'linux-*')
local targets=(windows-x64 windows-arm64 'macos-*' 'linux-*')

## Build Steps
setup() {
Expand Down Expand Up @@ -66,6 +66,7 @@ config() {

case ${target} {
macos-arm64) args+=(-DCONFIG_RUNTIME_CPU_DETECT=0) ;;
windows-arm64) args+=(-DCMAKE_TOOLCHAIN_FILE="build/cmake/toolchains/arm64-mingw-gcc.cmake") ;;
windows-x*) args+=(-DCMAKE_TOOLCHAIN_FILE="build/cmake/toolchains/${target_config[cmake_arch]}-mingw-gcc.cmake")
}

Expand Down Expand Up @@ -112,7 +113,7 @@ install() {
fixup() {
cd "${dir}"

if [[ ${target} == "windows-x"* ]] {
if [[ ${target} == "windows-"* ]] {
if (( shared_libs )) {
log_info "Fixup (%F{3}${target}%f)"
autoload -Uz create_importlibs
Expand Down
6 changes: 3 additions & 3 deletions deps.ffmpeg/40-x264.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (( script_order < 99 )) {
local -i shared_libs=1
}
} else {
local -a targets=('windows-x*')
local -a targets=('windows-*')
local -i shared_libs=1
suffix="-shared"
}
Expand Down Expand Up @@ -75,7 +75,7 @@ config() {
;;
macos-arm64) args+=(--host="aarch64-apple-darwin${target_config[darwin_target]}") ;;
macos-x86_64) args+=(--host="x86_64-apple-darwin${target_config[darwin_target]}") ;;
windows-x*)
windows-*)
args+=(
--host="${target_config[cross_prefix]}-pc-mingw32"
--cross-prefix="${target_config[cross_prefix]}-w64-mingw32-"
Expand Down Expand Up @@ -159,7 +159,7 @@ fixup() {
strip_tool=strip
strip_files=("${target_config[output_dir]}"/lib/libx264.so.*(.))
;;
windows-x*)
windows-*)
autoload -Uz create_importlibs
create_importlibs "${target_config[output_dir]}"/bin/libx264-*.dll(.)

Expand Down
Loading