Skip to content

Commit

Permalink
ci: refactor macOS workflows
Browse files Browse the repository at this point in the history
As of now, the github runner macos-14 is an ARM64 machine, and macos-13 is x86-64. This means we can remove the CMAKE_OSX_ARCHITECTURES workarounds and build for both architectures.
  • Loading branch information
codeflorist committed May 12, 2024
1 parent 2942c32 commit 7491dd3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/macos-arm64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,30 @@ on: [push, pull_request]

jobs:
build:
runs-on: macos-latest
runs-on: macos-14
permissions:
actions: write
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
brew install cmake dylibbundler
PACKAGES=(argtable sdl2 dumb libogg flac libpng freetype libvorbis ca-certificates openssl@3 opus opusfile physfs theora giflib jpeg-turbo xz lz4 zstd libtiff webp pcre2 gettext glib lame mpg123 libsndfile portaudio readline allegro fluid-synth mad enet)
for PACKAGE in "${PACKAGES[@]}"
do
brew uninstall --force --ignore-dependencies $PACKAGE
brew fetch --force --bottle-tag=arm64_monterey $PACKAGE
brew install $(brew --cache --bottle-tag=arm64_monterey $PACKAGE)
done
run: brew install cmake allegro fluid-synth mad enet dylibbundler

- name: Build
run: ./scripts/build-macos-arm64.sh
run: ./scripts/build-macos.sh

- name: Bundle libs
run: ./scripts/bundle-libs-macos.sh

- name: Copy OS specific files
run: cp -r ./dist-os-specific/macos/* ./dist

- name: Test executable
run: |
brew uninstall --force --ignore-dependencies argtable sdl2 dumb libogg flac libpng freetype libvorbis ca-certificates openssl@3 opus opusfile physfs theora giflib jpeg-turbo xz lz4 zstd libtiff webp pcre2 gettext glib lame mpg123 libsndfile portaudio readline allegro fluid-synth mad enet
cd dist
./dunedynasty | grep "data directory"
- name: Zip dist folder
run: |
cd dist
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,10 @@ The steps below will build the release-version. You can change value of the `DCM
./scripts/build-macos.sh
```

If you are building for ARM64 on a x86-64 machine, call this script instead:
If you are building for ARM64 on a x86-64 machine (or vice versa), you have to state the wanted architecture via the `CMAKE_OSX_ARCHITECTURES` flag in the cmake command. E.g.:

```shell
./scripts/build-macos-arm64.sh
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=arm64 .
```

4. To package all required dynlibs into the `./dist/libs` folder and patch the executable, call this script:
Expand Down
6 changes: 0 additions & 6 deletions scripts/build-macos-arm64.sh

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build-macos.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
cmake -DCMAKE_BUILD_TYPE=Debug .
cmake -DCMAKE_BUILD_TYPE=Release .
export FLUIDSYNTH_INSTALL_PATH=$(brew info fluid-synth | grep Cellar | head -n 1 | cut -f1 -d" ")
export MAD_INSTALL_PATH=$(brew info mad | grep Cellar | head -n 1 | cut -f1 -d" ")
export ENET_INSTALL_PATH=$(brew info enet | grep Cellar | head -n 1 | cut -f1 -d" ")
Expand Down

0 comments on commit 7491dd3

Please sign in to comment.