From cec7148d7fd495c4951b55124e98142657366ce4 Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Mon, 31 Oct 2022 23:19:44 +0100 Subject: [PATCH 1/9] Build: iOS: Use Qt6 and bump build environment Crash-fix by @danryu. Co-authored-by: Dan G Fixes: #2711 Fixes: #2939 --- .github/workflows/autobuild.yml | 6 +++--- Jamulus.pro | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 2093636b95..7563e3d7ad 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -251,13 +251,13 @@ jobs: - config_name: iOS (artifacts) target_os: ios - building_on_os: macos-11 - base_command: QT_VERSION=5.15.2 ./.github/autobuild/ios.sh + building_on_os: macos-12 + base_command: QT_VERSION=6.4.3 ./.github/autobuild/ios.sh # Build failed with CodeQL enabled when last tested 03/2022 (#2490). # There are no hints that iOS is supposed to be supported by CodeQL. # Therefore, disable it: run_codeql: false - xcode_version: 12.5.1 + xcode_version: 14.2.0 - config_name: Windows (artifact+codeQL) target_os: windows diff --git a/Jamulus.pro b/Jamulus.pro index 0b2fb55cb5..2f50d1e07c 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -232,6 +232,7 @@ win32 { HEADERS += src/sound/coreaudio-ios/sound.h OBJECTIVE_SOURCES += src/sound/coreaudio-ios/sound.mm QMAKE_TARGET_BUNDLE_PREFIX = io.jamulus + QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper LIBS += -framework AVFoundation \ -framework AudioToolbox } else:android { From f097dc4525dd979d479f6774ed287a348e6f0f55 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Sat, 13 May 2023 22:29:14 +0200 Subject: [PATCH 2/9] iOS: Fix some Qt6 related UI bugs * Enforce fullscreen mode on mobile OS * Unify iOS and Android logic --- src/chatdlg.cpp | 5 +++++ src/clientsettingsdlg.cpp | 5 +++++ src/connectdlg.cpp | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/chatdlg.cpp b/src/chatdlg.cpp index 285c530d8b..8d27a7a1b9 100644 --- a/src/chatdlg.cpp +++ b/src/chatdlg.cpp @@ -72,6 +72,11 @@ CChatDlg::CChatDlg ( QWidget* parent ) : CBaseDlg ( parent, Qt::Window ) // use // Now tell the layout about the menu layout()->setMenuBar ( pMenu ); +#if defined( Q_OS_ANDROID ) || defined( ANDROID ) || defined( Q_OS_IOS ) + // for the Android/iOS version maximize the window + setWindowState ( Qt::WindowMaximized ); +#endif + // Connections ------------------------------------------------------------- QObject::connect ( edtLocalInputText, &QLineEdit::textChanged, this, &CChatDlg::OnLocalInputTextTextChanged ); diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index a14eabd888..831aa4162c 100644 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -53,6 +53,11 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet layout()->setMenuBar ( pMenu ); #endif +#if defined( Q_OS_ANDROID ) || defined( ANDROID ) || defined( Q_OS_IOS ) + // for the Android/iOS version maximize the window + setWindowState ( Qt::WindowMaximized ); +#endif + // Add help text to controls ----------------------------------------------- // local audio input fader QString strAudFader = "" + tr ( "Local Audio Input Fader" ) + ": " + diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 9df63d5623..dbd3927603 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -151,8 +151,8 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR // setup timers TimerInitialSort.setSingleShot ( true ); // only once after list request -#ifdef ANDROID - // for the android version maximize the window +#if defined( Q_OS_ANDROID ) || defined( ANDROID ) || defined( Q_OS_IOS ) + // for the Android/iOS version maximize the window setWindowState ( Qt::WindowMaximized ); #endif From 3b6d500c0041f0c1d3c545d4473402a31bdbe9e2 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 21:03:56 +0200 Subject: [PATCH 3/9] Pass qmake path by parameter and upgrade macOS --- .github/autobuild/ios.sh | 2 +- .github/workflows/autobuild.yml | 2 +- ios/deploy_ios.sh | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/autobuild/ios.sh b/.github/autobuild/ios.sh index 838f0e0543..7176f1b13b 100755 --- a/.github/autobuild/ios.sh +++ b/.github/autobuild/ios.sh @@ -42,7 +42,7 @@ setup() { build_app_as_ipa() { # Add the Qt binaries to the PATH: export PATH="${QT_DIR}/${QT_VERSION}/ios/bin:${PATH}" - ./ios/deploy_ios.sh + ./ios/deploy_ios.sh -q "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" } pass_artifact_to_job() { diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 7563e3d7ad..3d282dc9ab 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -251,7 +251,7 @@ jobs: - config_name: iOS (artifacts) target_os: ios - building_on_os: macos-12 + building_on_os: macos-13 base_command: QT_VERSION=6.4.3 ./.github/autobuild/ios.sh # Build failed with CodeQL enabled when last tested 03/2022 (#2490). # There are no hints that iOS is supposed to be supported by CodeQL. diff --git a/ios/deploy_ios.sh b/ios/deploy_ios.sh index c5c150b17d..73da6b1acd 100755 --- a/ios/deploy_ios.sh +++ b/ios/deploy_ios.sh @@ -1,10 +1,31 @@ #!/bin/bash set -eu -o pipefail + +qmake_path="" + +while getopts 'hs:' flag; do + case "${flag}" in + m) + qmake_path=$OPTARG + if [[ -z "$qmake_path" ]]; then + echo "Please add the path to the qmake binary: -m \"\"" + fi + ;; + h) + echo "Usage: -m " + exit 0 + ;; + *) + exit 1 + ;; + esac +done + ## Builds an ipa file for iOS. Should be run from the repo-root # Create Xcode file and build -qmake -spec macx-xcode Jamulus.pro +eval "${qmake_path} Jamulus.pro" /usr/bin/xcodebuild -project Jamulus.xcodeproj -scheme Jamulus -configuration Release clean archive -archivePath "build/Jamulus.xcarchive" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO CODE_SIGN_ENTITLEMENTS="" # Generate ipa by copying the .app file from the xcarchive directory From 3e96f6bdd17b27695124c258b369cb71327b7ca0 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 21:11:02 +0200 Subject: [PATCH 4/9] Fix wrong parameter --- .github/autobuild/ios.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/autobuild/ios.sh b/.github/autobuild/ios.sh index 7176f1b13b..64900ebfea 100755 --- a/.github/autobuild/ios.sh +++ b/.github/autobuild/ios.sh @@ -42,7 +42,7 @@ setup() { build_app_as_ipa() { # Add the Qt binaries to the PATH: export PATH="${QT_DIR}/${QT_VERSION}/ios/bin:${PATH}" - ./ios/deploy_ios.sh -q "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" + ./ios/deploy_ios.sh -m "${QT_DIR}/${QT_VERSION}/ios/bin/qmake" } pass_artifact_to_job() { From 78658827570552813b8e3ce122b2f36da041943e Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 21:14:26 +0200 Subject: [PATCH 5/9] Yet another fix --- ios/deploy_ios.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/deploy_ios.sh b/ios/deploy_ios.sh index 73da6b1acd..6826310f98 100755 --- a/ios/deploy_ios.sh +++ b/ios/deploy_ios.sh @@ -4,7 +4,7 @@ set -eu -o pipefail qmake_path="" -while getopts 'hs:' flag; do +while getopts 'hm:' flag; do case "${flag}" in m) qmake_path=$OPTARG From f4c02de640fc01228d49a92e9e5d5bb661f51400 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 21:25:04 +0200 Subject: [PATCH 6/9] Remove linker flags --- Jamulus.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jamulus.pro b/Jamulus.pro index 2f50d1e07c..7ddc16bfb1 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -232,7 +232,7 @@ win32 { HEADERS += src/sound/coreaudio-ios/sound.h OBJECTIVE_SOURCES += src/sound/coreaudio-ios/sound.mm QMAKE_TARGET_BUNDLE_PREFIX = io.jamulus - QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper + # QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper LIBS += -framework AVFoundation \ -framework AudioToolbox } else:android { From 6e721f5f0b882067697ea7f0de6c4d15caeea0c8 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 21:40:53 +0200 Subject: [PATCH 7/9] Use alternative fix for entrypoint bug --- src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 25214fe09a..176dd829e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,8 +56,12 @@ extern void qt_set_sequence_auto_mnemonic ( bool bEnable ); #endif // Implementation ************************************************************** - +#if defined( Q_OS_IOS ) +// iOS workaround for Qt6 builds. See https://stackoverflow.com/questions/25353686/you-are-creating-qapplication-before-calling-uiapplicationmain-error-on-ios +extern "C" int qtmn( int argc, char **argv ) +#else int main ( int argc, char** argv ) +#endif { #if defined( Q_OS_MACX ) From f211c6657de181538b4da83ed42f905a43fbb495 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 22:51:44 +0200 Subject: [PATCH 8/9] Revert "Use alternative fix for entrypoint bug" This reverts commit 6e721f5f0b882067697ea7f0de6c4d15caeea0c8. --- src/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 176dd829e2..25214fe09a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,12 +56,8 @@ extern void qt_set_sequence_auto_mnemonic ( bool bEnable ); #endif // Implementation ************************************************************** -#if defined( Q_OS_IOS ) -// iOS workaround for Qt6 builds. See https://stackoverflow.com/questions/25353686/you-are-creating-qapplication-before-calling-uiapplicationmain-error-on-ios -extern "C" int qtmn( int argc, char **argv ) -#else + int main ( int argc, char** argv ) -#endif { #if defined( Q_OS_MACX ) From 25a0bc01a8b5d7f6a03dbecc8946079efb3ca660 Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Wed, 24 May 2023 22:52:24 +0200 Subject: [PATCH 9/9] Revert "Remove linker flags" This reverts commit f4c02de640fc01228d49a92e9e5d5bb661f51400. --- Jamulus.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jamulus.pro b/Jamulus.pro index 7ddc16bfb1..2f50d1e07c 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -232,7 +232,7 @@ win32 { HEADERS += src/sound/coreaudio-ios/sound.h OBJECTIVE_SOURCES += src/sound/coreaudio-ios/sound.mm QMAKE_TARGET_BUNDLE_PREFIX = io.jamulus - # QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper + QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper LIBS += -framework AVFoundation \ -framework AudioToolbox } else:android {