Skip to content

Macos Arm build #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion .github/workflows/meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,84 @@ jobs:
path: CortexCommand.AppImage
if-no-files-found: error

build-macos:
build-macos-arm:
runs-on: macos-latest
name: MacOS Build

env:
MACOSX_DEPLOYMENT_TARGET: ${{inputs.macosx-deployment-target}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: "Install Dependencies"
run: |
brew install ccache pkg-config sdl2 sdl2_image minizip lz4 flac luajit lua libpng tbb ninja meson dylibbundler

- name: Set Version
if: ${{inputs.new_release_version}}
uses: ./.github/actions/set_version
with:
new_release_version: ${{inputs.new_release_version}}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.os }}

- name: Setup Meson
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
CC: "gcc-14"
CXX: "g++-14"
run: |
meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} -Db_lto=false build

- name: Configure for App Bundle
if: ${{inputs.upload_artefacts}}
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson configure \
-Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=Contents/Frameworks \
--bindir=Contents/MacOS \
--prefix="/" \
-Ddylibbundler_args="-ns" \
build

- name: Build
env:
LDFLAGS: "-static-libgcc -static-libstdc++"
run: |
meson compile -C build

- name: Create App Bundle
if: ${{inputs.upload_artefacts}}
run: |
meson install --destdir="/tmp/Cortex Command.app" -C build

- name: Tar files
if: ${{inputs.upload_artefacts}}
run: |
cd /tmp/
tar -cvf CortexCommand.tar "Cortex Command.app"

- name: Move artefact
if: ${{inputs.upload_artefacts}}
run: cp /tmp/CortexCommand.tar .

- name: Artifact Deploy
if: ${{inputs.upload_artefacts}}
uses: actions/upload-artifact@v4
with:
name: CortexCommand (macOS)
path: |
CortexCommand.tar
if-no-files-found: error

build-macos-x86:
runs-on: ubuntu-latest
name: MacOS Build

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ If you want to change the buildtype afterwards, you can use `meson configure --b
- `Xcode` or `Command Line Tools for Xcode` (if you need to, you can also generate an xcode project from meson using the `--backend=xcode` option on setup)

**Homebrew (macOS):**
`brew install pkg-config sdl2 minizip lz4 flac luajit lua libpng tbb gcc@13 ninja meson dylibbundler`
`brew install pkg-config sdl2 sdl2_image minizip lz4 flac luajit lua libpng tbb gcc@13 ninja meson dylibbundler`

**Arch Linux:**
`sudo pacman -S sdl2 sdl2_image tbb flac luajit lua minizip lz4 libpng meson ninja base-devel`
Expand Down
4 changes: 2 additions & 2 deletions Source/Managers/WindowMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ void WindowMan::Initialize() {

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
CreatePrimaryWindow();
InitializeOpenGL();
CreateBackBufferTexture();
Expand Down
7 changes: 4 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ if host_machine.system() in ['linux','darwin']
dependency('liblz4'),
dependency('libpng'),
dependency('tbb'),
dependency('gl')
]
if host_machine.system()=='darwin'
deps += dependency('appleframeworks', modules: ['Foundation'])
if host_machine.system() == 'linux'
deps += dependency('gl')
elif host_machine.system()=='darwin'
deps += dependency('appleframeworks', modules: ['Foundation', 'OpenGL'])
endif
bfd = compiler.find_library('bfd', required: false)
if bfd.found()
Expand Down
Loading