Skip to content

Commit

Permalink
Add macOS arm64 builds (LMMS#7285)
Browse files Browse the repository at this point in the history
Add macOS arm64 builds
  • Loading branch information
tresf authored May 31, 2024
1 parent 6ec1ced commit a85c986
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ jobs:
env:
CCACHE_MAXSIZE: 500M
macos:
name: macos
runs-on: macos-12
strategy:
fail-fast: false
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
Expand All @@ -74,7 +85,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
Expand Down Expand Up @@ -115,6 +126,7 @@ jobs:
-B build \
-DCMAKE_INSTALL_PREFIX="../target" \
-DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)" \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
$CMAKE_OPTS \
-DUSE_WERROR=OFF
- name: Build
Expand All @@ -130,7 +142,7 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos
name: macos-${{ matrix.arch }}
path: build/lmms-*.dmg
- name: Trim ccache and print statistics
run: |
Expand Down
13 changes: 12 additions & 1 deletion cmake/apple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@ 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_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}\""
Expand Down

0 comments on commit a85c986

Please sign in to comment.