-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
C#: iOS and Apple Silicon fixes #49248
Conversation
…xcframework`. Build and export iOS Mono libs as `.xcframework`s, for Apple Silicon iOS simulator support.
Replaced obsolete preprocessor check for simulator/device in C code. Architecture can no longer be used to determine this with Apple Silicon. The new code uses `TARGET_OS_SIMULATOR` from `TargetConditionals.h`. We have some mono libs which can only be used in devide builds. We were adding them as static libs. Previously it was only causing warnings because missing arch for the simulator, but now this is treated as an error. To fix this we turn them into xcframeworks with dummy static libs for the simulator and the actual ones for devices.
We use `Mono.Cecil` to search for P/Invoke methods in assemblies in order to collect symbols that we must prevent from being stripped. We could pass the symbols as `-u` linker arguments (`-Wl,-u,symbol`) for the native target (not for the project), but it was simpler to generate referencing code and avoid changes to Godot's iOS exporter.
Added `SystemConfiguration.framework` to the Xcode project to fix undefined symbols errors building without the interpreter, like: `_SCNetworkReachabilityScheduleWithRunLoop`. Added explicit static constructors to the generated `NativeCalls` class to avoid a `TypeInitializationException` at startup when Godot attempts to read the static fields (like `godot_api_hash`) from this class. This seems to be an issue with Mono's AOT compiler and classes with the `beforefieldinit` attribute. Not sure if it only happens when the fields are only accessed via reflection as was our case. Explicitly declaring the static constructor makes the C# compiler not add the `beforefieldinit` attribute to the class.
Thanks! |
@neikeq @bruvzg What changes do I need to make in official build scripts to use this? I guess godotengine/godot-build-scripts#16 and godotengine/build-containers#68 need to be finalized and merged, and I guess the new |
Yes, |
Sorry, I forgot to mention this depends on godotengine/godot-mono-builds#39 and godotengine/godot-mono-builds#40, which I just proceeded to merge. I commented on both godotengine/godot-build-scripts#16 and godotengine/build-containers#68 with the changes that should be needed.
AFAIK this is the reason #45480 was reverted. I talked about this with @akien-mga and he agreed to the cherry-pick of those changes, so this may have changed. |
I haven't tested in the last 5 months so... I guess we'll see :) |
Hello, I still encounter issues #40757 |
Please open a new issue report for this |
Supersedes #45499 (cherry-picks the commit)
Fixes #40757
Fixes #42960
Likely fixes #45421