Skip to content

Commit

Permalink
Add macOS arm64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed May 28, 2024
1 parent 0a93e17 commit df0011d
Show file tree
Hide file tree
Showing 2 changed files with 31 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,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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down
16 changes: 15 additions & 1 deletion cmake/apple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}\""
Expand Down

0 comments on commit df0011d

Please sign in to comment.