Skip to content

Commit

Permalink
Merge pull request #932 from qw-ctf/update-macos-ci
Browse files Browse the repository at this point in the history
CI: Update macOS snapshots to use cmake
  • Loading branch information
dsvensson authored Sep 6, 2024
2 parents ef1e9b9 + a146a12 commit 0027f85
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 382 deletions.
71 changes: 62 additions & 9 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,83 @@ jobs:
path: .vs\${{ matrix.platform }}\${{ matrix.config }}\Output\ezQuake.exe

macos-build:
runs-on: macos-13
runs-on: macos-latest
strategy:
matrix:
ARCH: ["arm64","intel"]
ARCH: ["arm64","x64"]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: true

- name: Install dependencies
run: .github/workflows/scripts/homebrew.sh install-${{matrix.ARCH}}
- name: Install macOS build dependencies
run: brew install -q autoconf automake libtool

- name: Build
run: .github/workflows/scripts/homebrew.sh build-${{matrix.ARCH}}
- uses: lukka/get-cmake@latest

- name: Create Bundle
run: .github/workflows/scripts/homebrew.sh create-bundle ${{matrix.ARCH}}
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11

- name: Run CMake
uses: lukka/run-cmake@v10
with:
configurePreset: macos-${{matrix.ARCH}}-release-ci
buildPreset: macos-${{matrix.ARCH}}-release-ci

- name: Pre-zip to preserve executable bit
run: |
zip -r -9 ${GITHUB_WORKSPACE}/ezQuake.zip ezQuake.app
working-directory: build-macos-${{matrix.ARCH}}-release-ci/Release

- uses: actions/upload-artifact@v4
with:
name: macos-${{matrix.ARCH}}
name: ezQuake-macos-${{matrix.ARCH}}
path: ezQuake.zip

macos-universal:
needs: macos-build
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Download Intel Build
uses: actions/download-artifact@v4
with:
name: ezQuake-macos-arm64
path: artifacts/arm64

- name: Download ARM64 Build
uses: actions/download-artifact@v4
with:
name: ezQuake-macos-x64
path: artifacts/x64

- name: Create Universal Binary
run: |
(cd artifacts/x64 && unzip -qq ezQuake.zip) && (cd artifacts/arm64 && unzip -qq ezQuake.zip)
cp -r artifacts/arm64/ezQuake.app .
lipo -create -output ezQuake.app/Contents/MacOS/ezQuake \
artifacts/x64/ezQuake.app/Contents/MacOS/ezQuake \
artifacts/arm64/ezQuake.app/Contents/MacOS/ezQuake
codesign --force --sign - --entitlements misc/install/ezquake.entitlements.plist --options runtime --timestamp ezQuake.app
zip -r ezQuake.zip ezQuake.app
- name: Delete macOS arch specific builds
uses: geekyeggo/delete-artifact@v5
with:
name: |
ezQuake-macos-arm64
ezQuake-macos-x64
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ezQuake-macOS
path: ezQuake.zip
compression-level: 9

linux-build:
runs-on: ubuntu-latest
strategy:
Expand Down
119 changes: 0 additions & 119 deletions .github/workflows/scripts/homebrew.sh

This file was deleted.

10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ else()
if(HAS_MISLEADING_INDENTATION)
add_compile_options("-Wno-misleading-indentation")
endif()
# While not gnu89, it's in practice allowed by all supported compilers
check_c_compiler_flag("-Wtypedef-redefinition" HAS_TYPE_REDEFINITION)
if(HAS_TYPE_REDEFINITION)
add_compile_options("-Wno-typedef-redefinition")
endif()
# Should mostly be fixed in mvdsv, and next sync can remove this
check_c_compiler_flag("-Wshorten-64-to-32" HAS_SHORTEN_64_TO_32)
if(HAS_TYPE_REDEFINITION)
add_compile_options("-Wno-shorten-64-to-32")
endif()
endif()

find_library(MATH m)
Expand Down
34 changes: 1 addition & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,39 +179,7 @@ Copy the compiled binary to your Quake folder, on 64bit linux the binary will be

### Compiling an OS X binary

_These instructions were tested on Mac OS X 10.10._

Get [Homebrew](http://brew.sh)

Run exactly as it says on the front page:

```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Make sure you run the `brew doctor` as instructed before doing anything else.

Then run:

```
brew install sdl2 sdl2_net sdl2_image sdl2_gfx sdl2_mixer pcre2 jansson pkg-config speex speexdsp libsndfile
```

When it's done, just run `make` and it should compile without errors.


#### Creating an app bundle

Call from main ezquake-source directory, e.g. you probably do something like this:

```
make
sh misc/install/create_osx_bundle.sh
```

Current directory should have an `ezQuake.app` folder which is the app.

There will also be an `ezquake.zip` which basically just zips up the .app.
See [misc/docs/COMPILING_ON_OSX.md](misc/docs/COMPILING_ON_OSX.md)

## Nightly builds

Expand Down
30 changes: 30 additions & 0 deletions misc/docs/COMPILING_ON_OSX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# How to compile on macOS

Get Homebrew: http://brew.sh

Run exactly as it says on the front page:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Make sure you run the 'brew doctor' as instructed before doing anything else.

Then run:
```
brew install autoconf automake libtool cmake ninja
```

When it's done, initialize cmake to build the dependencies:
```
./bootstrap.sh
cmake --preset macos-arm64 (or -x64)
```

And finally building ezQuake:
```
cmake --build build-macos-arm64 --config Release
```

This will produce `build-macos-arm64/Release/ezQuake.app` which you can place anywhere. The first
launch will prompt you to select your Quake directory which will be automatically reused for
subsequent invocations. The application is sandboxed to this directory to keep your files safe.
23 changes: 0 additions & 23 deletions misc/docs/COMPILING_ON_OSX.txt

This file was deleted.

Loading

0 comments on commit 0027f85

Please sign in to comment.