diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ec25cd2bef..275fc25f4cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,8 +64,18 @@ jobs: env: CCACHE_MAXSIZE: 500M macos: - name: macos - runs-on: macos-12 + strategy: + matrix: + arch: [ x86_64, arm64 ] + include: + - arch: x86_64 + os: macos-12 + xcode: 13.1 + - arch: arm64 + os: macos-14 + xcode: 14.3.1 + name: macos-${{ matrix.arch }} + runs-on: ${{ matrix.os }} env: CMAKE_OPTS: >- -DUSE_WERROR=ON @@ -74,7 +84,7 @@ jobs: CCACHE_MAXSIZE: 0 CCACHE_NOCOMPRESS: 1 MAKEFLAGS: -j3 - DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer steps: - name: Check out uses: actions/checkout@v3 @@ -115,6 +125,8 @@ jobs: -B build \ -DCMAKE_INSTALL_PREFIX="../target" \ -DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)" \ + -DCMAKE_APPLE_SILICON_PROCESSOR=${{ matrix.arch }} \ + -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \ $CMAKE_OPTS \ -DUSE_WERROR=OFF - name: Build @@ -130,7 +142,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: macos + name: macos-${{ matrix.arch }} path: build/lmms-*.dmg - name: Trim ccache and print statistics run: | diff --git a/cmake/apple/CMakeLists.txt b/cmake/apple/CMakeLists.txt index 0b66689e75d..844f29fa08a 100644 --- a/cmake/apple/CMakeLists.txt +++ b/cmake/apple/CMakeLists.txt @@ -19,8 +19,22 @@ CONFIGURE_FILE("lmms.plist.in" "${CMAKE_BINARY_DIR}/Info.plist") CONFIGURE_FILE("install_apple.sh.in" "${CMAKE_BINARY_DIR}/install_apple.sh" @ONLY) CONFIGURE_FILE("package_apple.json.in" "${CMAKE_BINARY_DIR}/package_apple.json" @ONLY) +IF(CMAKE_APPLE_SILICON_PROCESSOR) + # Target arch is provided to cmake (M-series only) + SET(DMG_ARCH "-${CMAKE_APPLE_SILICON_PROCESSOR}") +ELSEIF(CMAKE_OSX_ARCHITECTURES) + SET(DMG_ARCH "-${CMAKE_OSX_ARCHITECTURES}") +ELSEIF(IS_ARM64) + # Target arch is host arch + SET(DMG_ARCH "-arm64") +ELSE() + # Fallback to Intel + SET(DMG_ARCH "-x86_64") +ENDIF() + # DMG creation target -SET(DMG_FILE "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}-mac${APPLE_OS_VER}.dmg") +SET(DMG_FILE "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}-mac${APPLE_OS_VER}${DMG_ARCH}.dmg") + FILE(REMOVE "${DMG_FILE}") ADD_CUSTOM_TARGET(removedmg COMMAND touch "\"${DMG_FILE}\"" && rm "\"${DMG_FILE}\""