From 5df9315b1fc1a061895cb258c1929bac69c37e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Petter=20Ska=CC=8Alerud?= Date: Fri, 14 Mar 2025 15:03:04 +0100 Subject: [PATCH] iOS, FFmpeg: Replace arm64-simulator build with x86_64 Currently this provisioning script builds for arm64 architecture when on iOS simulator. Qt ships x86_64 binaries for iOS simulator, and we should build FFmpeg similarly. This patch introduces support for x86_64-simulator in the iOS FFmpeg provisioning script and uses it in place of arm64-simulator. Pick-to: 6.8 Task-number: QTQAINFRA-7034 Change-Id: Ie93cffba51924cd1d78651d20dec211817cb0cef Reviewed-by: Artem Dyomin (cherry picked from commit aa613ed85d48122bcb834749537284f8f8b91715) Reviewed-by: Qt Cherry-pick Bot --- .../common/unix/install-ffmpeg-ios.sh | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/coin/provisioning/common/unix/install-ffmpeg-ios.sh b/coin/provisioning/common/unix/install-ffmpeg-ios.sh index f77537d6..96ef4bf6 100755 --- a/coin/provisioning/common/unix/install-ffmpeg-ios.sh +++ b/coin/provisioning/common/unix/install-ffmpeg-ios.sh @@ -34,11 +34,17 @@ build_ffmpeg_ios() { target_sdk="iphonesimulator" target_platform="arm64" minos="-mios-simulator-version-min=16.0" - else + elif [ "$target_platform" == "x86_64-simulator" ]; then + target_sdk="iphonesimulator" + target_platform="x86_64" + minos="-mios-simulator-version-min=16.0" + elif [ "$target_platform" == "arm64-iphoneos" ]; then target_sdk="iphoneos" target_platform="arm64" minos="-miphoneos-version-min=16.0" - # TODO: consider non-arm simulator? + else + echo "Error when building FFmpeg for iOS. Unknown parameter given for target_platform: '${target_platform}'" + exit 1 fi # Note: unlike similar install-ffmpeg scripts, not $target_platform, @@ -104,6 +110,8 @@ build_info_plist() { local minimum_os_version="16.0" local supported_platforms="iPhoneOS" + # TODO: This should be filled out with the actual version of FFmpeg that we are + # deploying. info_plist=" @@ -170,29 +178,31 @@ create_xcframework() { # Create 'traditional' framework from the corresponding dylib, # also creating local framework_name="$1" + local target_platform_a="$2" + local target_platform_b="$3" - local fw1="$ffmpeg_source_dir/build_ios/arm64/installed/usr/local/ios/ffmpeg/framework/${framework_name}.framework" - local fw2="$ffmpeg_source_dir/build_ios/arm64-simulator/installed/usr/local/ios/ffmpeg/framework/${framework_name}.framework" + local fw_a="$ffmpeg_source_dir/build_ios/${target_platform_a}/installed/usr/local/ios/ffmpeg/framework/${framework_name}.framework" + local fw_b="$ffmpeg_source_dir/build_ios/${target_platform_b}/installed/usr/local/ios/ffmpeg/framework/${framework_name}.framework" sudo mkdir -p "$prefix/framework/" - sudo xcodebuild -create-xcframework -framework $fw1 -framework $fw2 -output "${prefix}/framework/${framework_name}.xcframework" + sudo xcodebuild -create-xcframework -framework $fw_a -framework $fw_b -output "${prefix}/framework/${framework_name}.xcframework" } -build_ffmpeg_ios "arm64-simulator" -build_ffmpeg_ios "arm64" +build_ffmpeg_ios "x86_64-simulator" +build_ffmpeg_ios "arm64-iphoneos" ffmpeg_libs="libavcodec libavformat libavutil libswresample libswscale" for name in $ffmpeg_libs; do - create_framework $name "arm64" - create_framework $name "arm64-simulator" + create_framework $name "arm64-iphoneos" + create_framework $name "x86_64-simulator" done # Create corresponding (xc)frameworks containing both arm64 and arm64-simulator frameworks: for name in $ffmpeg_libs; do - create_xcframework $name + create_xcframework $name "arm64-iphoneos" "x86_64-simulator" done -install_ffmpeg "$ffmpeg_source_dir/build_ios/arm64/installed" +install_ffmpeg "$ffmpeg_source_dir/build_ios/arm64-iphoneos/installed" SetEnvVar "FFMPEG_DIR_IOS" $prefix