godotengine/godot-headers

Question: iOS supported?

dhombios opened this issue · 12 comments

I could not find if iOS is supported by gdnative, which will be really useful as it would allow to share c code between android and iOS devices at native speed.
On the other hand, can the compilation process for each target be automated with scons during the exportation?

Apple doesn't allow you to include dynamic libraries on iOS. The whole process is very different on iOS where you can statically link your plugin to Godot but I have no hands on experience with this. Endragor on IRC has more experience with this.

Compiling from the editor is a difficult subject because there are such wide varieties. Cross compiling for different platforms is even more difficult and not even supported by all compilers. There are people looking into this but it's a lot of work. Hopefully someone with past experience will step in some day.

Thanks, I thought in iOS was statically linked, as some sources seem to be recompiled during the exportation process

@dhombios indeed, I just don't have experience with the process and what should be altered to the samples. Endragor did a lot of work on this but I don't know if he did a write up of how it works. @karroffel do you know?

I think there's a special version of the iOS export template that's not linked yet. The code has to be compiled into a static library, then added as additional sources.

Never done it, I can't tell you how it works from a user perspective

Is it still not possible to use GDNative on iOS? If so, this should be documented.

It is possible. As karroffel mentioned, the library just needs to be statically linked to Godot and have a unique symbol_prefix.

Here's an example of a C++ project working on iOS. See the iOS build instructions in the readme and the SConstruct file: https://github.com/utopia-rise/fmod-gdnative/

So according to the pull request above, should the godot c++ bindings now be able to compile for iOS too?

iOS plugins have been working for awhile but I'm keeping this issue open as I believe we're missing documentation around this.

GDNative plugins was working even before godotengine/godot#39996 was merged, but it required static libraries to work. PR allowed to use dynamic libraries/frameworks.

I was following https://docs.godotengine.org/en/stable/tutorials/plugins/gdnative/gdnative-cpp-example.html documentation to build iOS plugin and found no issue.

Thanks, closing then.