From 1331b118900f336658c8112d0a0379de08f697b2 Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Tue, 5 Apr 2022 23:40:03 +0200 Subject: [PATCH] Autobuild: Add macOS arm64 build target Fixes #2357 --- .github/autobuild/mac.sh | 4 +++- .github/workflows/autobuild.yml | 8 ++++++++ mac/deploy_mac.sh | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/autobuild/mac.sh b/.github/autobuild/mac.sh index 63f310893c..e78a9afac6 100755 --- a/.github/autobuild/mac.sh +++ b/.github/autobuild/mac.sh @@ -4,6 +4,8 @@ set -eu QT_DIR=/usr/local/opt/qt AQTINSTALL_VERSION=2.1.0 +TARGET_ARCH="${TARGET_ARCH:-}" + if [[ ! ${QT_VERSION:-} =~ [0-9]+\.[0-9]+\..* ]]; then echo "Environment variable QT_VERSION must be set to a valid Qt version" exit 1 @@ -60,7 +62,7 @@ build_app_as_dmg_installer() { if prepare_signing; then BUILD_ARGS=("-s" "${MACOS_CERTIFICATE_ID}") fi - ./mac/deploy_mac.sh "${BUILD_ARGS[@]}" + TARGET_ARCH="${TARGET_ARCH}" ./mac/deploy_mac.sh "${BUILD_ARGS[@]}" } pass_artifact_to_job() { diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index dd6f16170d..7286e59c27 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -139,6 +139,14 @@ jobs: # Latest Xcode which runs on macos-11: xcode_version: 13.4.1 + - config_name: MacOS arm64 (artifacts) + target_os: macos + building_on_os: macos-12 + base_command: QT_VERSION=6.3.1 SIGN_IF_POSSIBLE=1 TARGET_ARCH=arm64 ARTIFACT_SUFFIX=_arm64 ./.github/autobuild/mac.sh + # Disable CodeQL on mac as it interferes with signing the binaries (signing hangs, see #2563 and #2564) + run_codeql: false + xcode_version: 13.4.1 + # Reminder: If Legacy is removed, be sure to add a dedicated job for CodeQL again. - config_name: MacOS Legacy (artifacts+CodeQL) target_os: macos diff --git a/mac/deploy_mac.sh b/mac/deploy_mac.sh index 1f0effd2df..478ec0ba8b 100755 --- a/mac/deploy_mac.sh +++ b/mac/deploy_mac.sh @@ -38,7 +38,11 @@ build_app() { local client_or_server="${1}" # Build Jamulus - qmake "${project_path}" -o "${build_path}/Makefile" "CONFIG+=release" "${@:2}" + declare -a BUILD_ARGS=("_UNUSED_DUMMY=''") # old bash fails otherwise + if [[ "${TARGET_ARCH:-}" ]]; then + BUILD_ARGS=("QMAKE_APPLE_DEVICE_ARCHS=${TARGET_ARCH}" "QT_ARCH=${TARGET_ARCH}") + fi + qmake "${project_path}" -o "${build_path}/Makefile" "CONFIG+=release" "${BUILD_ARGS[@]}" "${@:2}" local target_name target_name=$(sed -nE 's/^QMAKE_TARGET *= *(.*)$/\1/p' "${build_path}/Makefile") local job_count