Skip to content
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

Merged
merged 6 commits into from
Jun 2, 2021
Merged

Commits on Jun 1, 2021

  1. Add separate simulator flag for iOS build, change main library to `…

    …xcframework`.
    
    Build and export iOS Mono libs as `.xcframework`s, for Apple Silicon iOS simulator support.
    bruvzg authored and neikeq committed Jun 1, 2021
    Configuration menu
    Copy the full SHA
    683f96d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7569f2d View commit details
    Browse the repository at this point in the history
  3. C#+iOS: Fix simulator builds

    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.
    neikeq committed Jun 1, 2021
    Configuration menu
    Copy the full SHA
    c9047de View commit details
    Browse the repository at this point in the history
  4. C#+iOS: Fix P/Invoke symbols being stripped by the linker

    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.
    neikeq committed Jun 1, 2021
    Configuration menu
    Copy the full SHA
    21a739e View commit details
    Browse the repository at this point in the history
  5. C#+iOS: Fixes for games exported with Use Interpreter disabled

    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.
    neikeq committed Jun 1, 2021
    Configuration menu
    Copy the full SHA
    4838e60 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a3722a7 View commit details
    Browse the repository at this point in the history