Add macOS support#39
Open
antont wants to merge 1 commit into
Open
Conversation
- Fix PlatformExtensionName() to return "dylib" on macOS instead of "so" - Replace hardcoded Windows paths in the Rust loader with platform-aware logic: derive root_dir from the plugin path, use UNREAL_RUST_TARGET_DIR env var or relative fallback for the target library path - Use cfg-gated constants for platform-specific library extensions (.dll/.so/.dylib) and library names (with lib prefix on Unix) - Guard .pdb debug symbol copy with #[cfg(target_os = "windows")] - Add aarch64-apple-darwin and x86_64-apple-darwin Cargo targets Closes MaikKlein#20 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds macOS (Apple Silicon + Intel) support to the Rust plugin loader and UE C++ plugin code. Tested on macOS with UE 5.7 — the loader successfully resolves and loads the Rust plugin dylib, registers types, and the editor runs. Verified Rust gameplay code running at runtime:
UKismetSystemLibrary::print_string()called from Rusttick()displays on screen during Play.Changes:
RustPlugin.cpp: Returndylibextension onPLATFORM_MAC(was incorrectly returningso). Usereinterpret_castforGetDllExportresults (clang rejectsstatic_castfromvoid*to function pointers).unreal-rust-loader/src/lib.rs: Cross-platform rewrite — platform-gated library names/extensions,dladdr-based runtime path resolution (replaces hardcoded Windows paths), ad-hoc codesigning after hot-reload copy (macOS kills processes loading unsigned dylibs), proper error handling throughout.unreal-rust-loader/Cargo.toml: Addlibcdependency on Unix fordladdr/Dl_info..cargo/config.toml: Addaarch64-apple-darwinandx86_64-apple-darwintarget entries.Addresses #20.
Notes
reinterpret_castchange also fixes compilation on Linux (clang strict mode) — not just macOS.UNREAL_RUST_TARGET_DIRenv var →dladdr-derived path relative to the loader's own location →target/release/relative fallback.codesign --force --sign -to avoid SIGKILL from code signature validation.ue57-compat).🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com