-
Notifications
You must be signed in to change notification settings - Fork 81
Support platform macosx/arm64 #62
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
Conversation
ManlyMarco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a glance it looks fine but it would be nicer to read without the unnecessary formatting changes, not a big deal though.
The additional logging for config should be a separate PR though.
|
Are you going to continue working on this? I'd like to see this merged as it eats so much fps if you have to play Valheim on macOS using Rosetta2 x86_64 emulation |
ManlyMarco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Harmony and HarmonyX now support ARM, this PR is a lot more relevant.
The changes look good, but linux and macos builds are failing on CI. Once builds are fixed and can be tested, this can be merged.
- Fix Linux build: conditionally compile platform-specific plthook files - Linux now only compiles plthook_elf.c - macOS now only compiles plthook_osx.c - Fix macOS build: ensure .doorstop_version files are created for all targets - Add after_build to doorstop_x86_64 target - Enhanced doorstop_arm64 after_build to create version files and properly handle universal binary creation - Ensures compatibility with GitHub Actions workflow expectations
|
This is Attempt 1 at fixing the CI build. Issues Fixed1. Linux Build ErrorProblem: Linux builds were failing because they attempted to compile Solution: Modified
2. macOS Build ErrorProblem: The macOS CI build was failing with "cp: build/macosx/universal/release/.doorstop_version: No such file or directory" Solution: Added proper
Changes Made to xmake.lua
VerificationThe build has been tested locally and successfully on MacOS only (I have access to linux/x64 systems but I'll let CI test that):
|
|
Looks good, CI builds are now available for testing at https://github.com/NeighTools/UnityDoorstop/actions/runs/17422686388?pr=62 I'll merge after a few people get a chance to test it on different platforms and confirm everything is working. |
|
I tested |
|
Joining here! I've tested and it works fine with BepInEx (manually built for arm) hello world plugin. Thanks @allquixotic Spec: M3 Pro chip |
Current version of UnityDoorstop supports only x86 CPU architecture on MacOS. This patch adds support for arm64, which was enabled by integrating the latest version of plthook upstream into
plthook_osx.cand re-adding the UnityDoorstop-specific public function,... which appears to work just fine after pulling in the changes from plthook upstream.
The build system has been updated to produce a MacOS Universal Binary, by first compiling the x86_64 and arm64 versions of the library, then smashing them together into a single file. You can distribute the Universal Binary as the only MacOS distributable for both Intel and Apple Silicon architectures, and it will automatically "do the right thing" when the user tries to use it, irrespective of their CPU architecture.
NOTE: due to MonoMod#90, game mod loaders that leverage UnityDoorstop as their entry point but use HarmonyX as their managed code patching library will still fail to work on Apple Silicon. This is an issue unrelated to UnityDoorstop, which by all accounts, appears to correctly load and hand over control to the mod loader.
Tested with BepInEx; confirmed that BepInEx's managed code starts running successfully, and it only crashes because of the MonoMod#90 issue mentioned above, which again isn't UnityDoorstop's fault.
Resolving this issue is a prerequisite to one day getting mod loaders to work with Apple Silicon on MacOS.
Resolves bug #61.