Skip to content

Fix macOS ARM64 build (Xcode + CI)#23

Open
mateusbentes wants to merge 106 commits into
SethRobinson:masterfrom
mateusbentes:master
Open

Fix macOS ARM64 build (Xcode + CI)#23
mateusbentes wants to merge 106 commits into
SethRobinson:masterfrom
mateusbentes:master

Conversation

@mateusbentes

Copy link
Copy Markdown
Contributor

This PR fixes the macOS Xcode build for Apple Silicon (ARM64) and adds a GitHub Actions workflow that verifies it on every push. The build was previously marked as "broken/unmaintained". It now compiles and links cleanly on macOS 14 (M1/M2).
What was fixed
Xcode project (OSX/RTDink.xcodeproj)
Added /opt/homebrew/include and /usr/local/include to header search paths (SDL2 headers via Homebrew)
Added ../../proton/RTSimpleApp/source to header search paths (ParticleTestComponent.h)
Fixed ParticleTestComponent.cpp/.h file reference paths (were pointing to ../source/Component/, actually live in the Proton SDK)
Added missing source files: EmulatedPointerComponent.cpp, LogDisplayComponent.cpp, TouchDragComponent.cpp
Added PNG NEON ARM64 sources: arm_init.c, filter_neon_intrinsics.c, palette_neon_intrinsics.c (excluded for x86_64)
Added -lSDL2 to linker flags and Homebrew lib paths to library search paths
Removed libfmod.dylib from Frameworks and CopyFiles build phases
Source (source/App.cpp)
Added #include <SDL2/SDL.h> for the PLATFORM_OSX block
Added RT_NO_FMOD guard: when defined, uses a silent AudioManager stub instead of AudioManagerFMODStudio
Defined g_bIsFullScreen under #ifdef PLATFORM_OSX guard
CI workflow (.github/workflows/test-macos-arm64.yml)
Builds on macos-14 (Apple Silicon) on every push to test_mac_arm64 and on manual trigger
Installs SDL2 via Homebrew, clones Proton SDK as sibling
Passes RT_NO_FMOD=1 and excludes AudioManagerFMODStudio.cpp so no FMOD SDK is needed in CI
Uploads the .app artifact on success
Docs (README.md, INSTALL.md)
macOS section updated: ARM64-only, correct sibling directory layout, FMOD requirements clarified
Notes that CI verifies compilation without FMOD (silent audio stub)
Impact on other platforms
No other platform is affected:
Windows: The changes to App.cpp are all guarded by #ifdef PLATFORM_OSX or #ifdef APPLE. The RT_NO_FMOD guard only activates on macOS desktop. The Xcode project changes (OSX/RTDink.xcodeproj) are a separate file from the Windows solution (windows_vs2017/). Windows is unaffected.
Linux: The g_bIsFullScreen definition is guarded by #ifdef PLATFORM_OSX, so Linux continues to get it from SDL2Main.cpp as before. The SDL2 include is inside a #if defined(RTLINUX) || defined(PLATFORM_LINUX) || defined(PLATFORM_OSX) block that already existed. The Linux CMake build was verified locally after all changes — it builds cleanly with no errors.
iOS: Uses the root RTDink.xcodeproj (not OSX/RTDink.xcodeproj). The App.cpp changes are guarded by TARGET_OS_IPHONE checks that were already in place — the RT_NO_FMOD and PLATFORM_OSX guards do not activate on iOS. iOS is unaffected.
Android: Uses its own CMake build under AndroidGradle/. None of the changed files affect the Android build path. Android is unaffected.
HTML5: Uses Emscripten with its own platform defines. None of the guards (PLATFORM_OSX, RT_NO_FMOD) activate under Emscripten. HTML5 is unaffected.
Notes
FMOD: The CI build has no audio (silent stub). For a fully working game with sound, the FMOD Studio API must be installed manually — see INSTALL.md#macos.
Intel (x86_64): Not currently supported. The universal binary build was removed until x86_64 linking issues are resolved.

Updated Xcode project for Universal Binary:
- ARCHS:  - includes arm64 + x86_64
- VALID_ARCHS: arm64 x86_64 (removed deprecated i386)
- MACOSX_DEPLOYMENT_TARGET: 11.0 (required for ARM64)

Note: Requires ARM64 FMOD Studio libraries for audio
Status: Work in Progress - needs testing on Apple Silicon hardware
The Xcode project (OSX/RTDink.xcodeproj) references this file in its
Resources build phase but it was never committed to the repository,
causing the macOS ARM64 CI build to fail with:
  error: Build input file cannot be found: '.../English.lproj/MainMenu.xib'

This is a standard Cocoa macOS application main menu XIB file.
Adds a 'Generate pnglibconf.h' shell script build phase that runs
before Sources compilation. It copies pnglibconf.h.prebuilt to
pnglibconf.h if not already present, so the project builds with
a clean checkout in Xcode without any manual steps.
The project referenced 5 Boost.Signals v1 source files that don't
exist in the proton SDK (only Signals2 header-only library is present):
  - libs/signals/src/connection.cpp
  - libs/signals/src/named_slot_map.cpp
  - libs/signals/src/signal_base.cpp
  - libs/signals/src/slot.cpp
  - libs/signals/src/trackable.cpp

Removing them from the Sources build phase fixes the compilation
failures for trackable.o and slot.o.
pnggccrd.c and pngvcrd.c are old x86 MMX-specific libpng files that
don't exist in the proton SDK's libpng version. Removing them from
the Sources build phase fixes:
  error: Build input file cannot be found: '.../libpng/pngvcrd.c'
@mateusbentes

Copy link
Copy Markdown
Contributor Author

Seth, the macOS Arm64 build is ready in this PR! Can you test it on a real Mac? Intel support can come later or never comes, anyway, i don't have a Mac and tested in Github Workflow.

@SethRobinson

Copy link
Copy Markdown
Owner

Unfortunately I don't have time to test and get audio/packaging/signing working right on a mac now, but maybe later. If you can get a Mac person to test/help on your fork it might be a good way forward for the moment

@mateusbentes

mateusbentes commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

Unfortunately i don't have a Mac series M processor, macs and another Apple products are too expensive in Brazil

mateusbentes and others added 20 commits March 6, 2026 10:28
- SDL event pumping: use SDL_PumpEvents + SDL_PeepEvents (joystick range
  only) on PLATFORM_OSX instead of SDL_PollEvent; Linux keeps full poll.
- Fullscreen: call OSXToggleFullscreen() (Cocoa native, in OSXUtils.mm)
  instead of SDL window toggle which doesn't exist on Cocoa builds.
- SDL window functions (GetSDLWindow, UpdateViewport,
  OnFullscreenToggleRequestMultiplatform) restricted to Linux only.
- SDL_Init(0) added before GamepadProviderSDL2 on PLATFORM_OSX.
- Game data path: check inside bundle first, fall back to .app parent dir.
- AddTextToLog: create save dir if missing, don't crash on fopen failure.
- Include OSX/OSXUtils.h explicitly for OSXToggleFullscreen declaration.
- g_sig_SDLEvent defined in App.cpp for Cocoa builds (no SDL2Main.cpp).
…ils.h

The include path OSX/OSXUtils.h is fragile across different proton layouts
in CI. A plain forward declaration is simpler and always works.
@mateusbentes

Copy link
Copy Markdown
Contributor Author

@SethRobinson just with the PR SethRobinson/proton#42 works 20260306_152140.jpg

@SethRobinson

Copy link
Copy Markdown
Owner

Thanks for the updates - has this been played on a real ARM64 mac? Do you have a download available? I should be able to review this soon but I want to make sure as much as possible is tested and working first. :)

@mateusbentes

mateusbentes commented Mar 7, 2026

Copy link
Copy Markdown
Contributor Author

@SethRobinson No, I only tested in real Mac Intel. I only have the download of workflow https://github.com/mateusbentes/RTDink/actions/runs/22799205628/artifacts/5811234748 that is really tested in real Mac, I tested in MacInClod and the game build and open.

PS: the game wonks in bundled app data or standalone data, to be playable in Mac AppStore and Steam/GoG.

@mateusbentes

Copy link
Copy Markdown
Contributor Author

@SethRobinson do you have a real Mac ARM?

@mateusbentes

Copy link
Copy Markdown
Contributor Author

@SethRobinson gamepad still untested, the PR SethRobinson/proton#42 can now be merged.

@mateusbentes

Copy link
Copy Markdown
Contributor Author

@SethRobinson if you have time please fix LonelyLadders gamepad and merge this PR, so gamepad should work on Mac, on this time I will be working on the another project https://github.com/mateusbentes/gltron-mobile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants