Update provisioning script to build FFmpeg for Windows ARM64

Fixes: QTBUG-122745
Pick-to: 6.7 6.5
Change-Id: Ib03484ac89f07d7ad6433b0035769f4a9363495b
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
This commit is contained in:
Pavel Dubsky 2024-03-13 20:55:46 +01:00
parent 8fae627f8b
commit befe4a61d6
3 changed files with 31 additions and 12 deletions

View File

@ -129,7 +129,7 @@ Configurations:
Environment variables: [
'TARGET_CONFIGURE_ARGS=-debug-and-release -force-debug-info -platform win32-arm64-msvc',
'TARGET_CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_ROOT_DIR_x64_arm64}}',
'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF',
'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC_ARM64}} -DQT_DEPLOY_FFMPEG=TRUE',
'OPENSSL_CONF_x64={{.Env.OPENSSL_CONF_x64_arm64}}',
'OPENSSL_INCLUDE_x64={{.Env.OPENSSL_INCLUDE_x64_arm64}}',
'OPENSSL_LIB_x64={{.Env.OPENSSL_LIB_x64_arm64}}',
@ -157,7 +157,7 @@ Configurations:
Environment variables: [
'TARGET_CONFIGURE_ARGS=-debug-and-release -force-debug-info -platform win32-arm64-msvc',
'TARGET_CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON',
'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF',
'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC_ARM64}} -DQT_DEPLOY_FFMPEG=TRUE',
'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',
]
-

View File

@ -307,10 +307,10 @@ function GetVSPath {
}
function EnterVSDevShell {
# Add cl to path if it is not already there.
if (Get-Command cl.exe -ErrorAction SilentlyContinue) {
return $true
}
Param (
[string]$HostArch = "amd64",
[string]$Arch = "amd64"
)
$vsWere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
$vcComponent = "Microsoft.VisualStudio.Component.VC.CoreIde"
@ -318,10 +318,10 @@ function EnterVSDevShell {
# If MSVC has an ABI break this will stop working, and yet another build must be added.
$VSPath = (& $vsWere -nologo -products * -requires $vcComponent -sort -format value -property installationPath | Select-Object -Last 1)
Write-Host "Enter VisualStudio developer shell"
Write-Host "Enter VisualStudio developer shell (-host_arch=$HostArch -arch=$Arch)"
try {
Import-Module "$VSPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $VSPath -DevCmdArguments "-arch=x64 -no_logo"
Enter-VsDevShell -VsInstallPath $VSPath -DevCmdArguments "-host_arch=$HostArch -arch=$Arch -no_logo"
} catch {
Write-Host "Failed to enter VisualStudio DevShell"
return $false

View File

@ -73,12 +73,29 @@ function InstallMingwFfmpeg {
function InstallMsvcFfmpeg {
$result = EnterVSDevShell
Param (
[bool]$isArm64
)
$arch = "amd64"
$buildSystem = "msvc"
$ffmpegDirEnvVar = "FFMPEG_DIR_MSVC"
$config = Get-Content "$PSScriptRoot\..\shared\ffmpeg_config_options.txt"
if ($isArm64) {
$arch = "arm64"
$buildSystem += "-arm64"
$ffmpegDirEnvVar += "_ARM64"
$config += " --enable-cross-compile --arch=arm64 --disable-asm"
}
$result = EnterVSDevShell -Arch $arch
if (-Not $result) {
return $false
}
$result = InstallFfmpeg -buildSystem "msvc" -msystem "MSYS" -toolchain "msvc" -ffmpegDirEnvVar "FFMPEG_DIR_MSVC" -shared $true
$result = InstallFfmpeg -buildSystem $buildSystem -msystem "MSYS" -toolchain "msvc" -ffmpegDirEnvVar $ffmpegDirEnvVar -shared $true
if ($result) {
# As ffmpeg build system creates lib*.a file we have to rename them to *.lib files to be recognized by WIN32
@ -138,14 +155,16 @@ function InstallAndroidArmv7 {
}
$mingwRes = InstallMingwFfmpeg
$msvcRes = InstallMsvcFfmpeg
$llvmMingwRes = InstallLlvmMingwFfmpeg
$androidArmV7Res = InstallAndroidArmv7
$msvcRes = InstallMsvcFfmpeg -isArm64 $false
$msvcArm64Res = InstallMsvcFfmpeg -isArm64 $true
Write-Host "Ffmpeg installation results:"
Write-Host " mingw:" $(if ($mingwRes) { "OK" } else { "FAIL" })
Write-Host " msvc:" $(if ($msvcRes) { "OK" } else { "FAIL" })
Write-Host " msvc-arm64:" $(if ($msvcArm64Res) { "OK" } else { "FAIL" })
Write-Host " llvm-mingw:" $(if ($llvmMingwRes) { "OK" } else { "FAIL" })
Write-Host " android-armv7:" $(if ($androidArmV7Res) { "OK" } else { "FAIL" })
exit $(if ($mingwRes -and $msvcRes -and $llvmMingwRes -and $androidArmV7Res) { 0 } else { 1 })
exit $(if ($mingwRes -and $msvcRes -and $msvcArm64Res -and $llvmMingwRes -and $androidArmV7Res) { 0 } else { 1 })