Open Triangle345 opened 6 years ago
iOS is a bit of a hard one because iOS doesn't allow dynamic libraries. @Endragor and @karroffel did heaps of work to allow you to statically compile a GDNative library on iOS but how this works, I don't know.
I would really like an Android example too because I need it. If someone can help out I'll update the C example to also include Android instructions
I managed to work out GDNative for Android on my project, here's a zip file with the .mk files: jni.zip
The .mk files in the zip are pretty generic so I guess they can work in demos or other projects. Though you should change the LOCAL_MODULE := libshawynative.android
line.
Note: I've only tested this using nativescript-1.0
I’ve been working on something similar thanks to Paritoshs work for the gearvr plugin but i really want to find out if there is a way to make this happen through scons. It’s confusing to maintain multiple build systems
On Fri, 30 Nov 2018 at 10:01 am, Marcelo Fernandez notifications@github.com wrote:
I managed to work out GDNative for Android on my project, here's a zip file with the .mk files: jni.zip https://github.com/GodotNativeTools/GDNative-demos/files/2631206/jni.zip The .mk files in the zip are pretty generic so I guess they can work in demos or other projects. Though you should change the LOCAL_MODULE := libshawynative.android line.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GodotNativeTools/GDNative-demos/issues/19#issuecomment-443026427, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2vabmdxJ_E15Irw30qpT6Ezfg2-heeks5u0GdXgaJpZM4RhPB0 .
-- Kindest regards,
Bastiaan Olij
https://www.facebook.com/bastiaan.olij https://twitter.com/mux213 https://www.youtube.com/BastiaanOlij https://www.youtube.com/channel/UCrbLJYzJjDf2p-vJC011lYw https://github.com/BastiaanOlij
Has there been any progress on this?
After spending a day, I got quite far in trying to build a GDNative C++ module for iOS, but now I'm stuck with unresolved symbols for the following:
- godot::Variant::operator float() const
- godot::Godot::gdnative_terminate(godot_gdnative_terminate_options*)
- godot::Node2D::set_position(godot::Vector2)
- godot::Variant::~Variant()
- _api
- godot::Godot::nativescript_init(void*)
- _nativescript_api
- godot::_RegisterState::nativescript_handle
- godot::Godot::gdnative_init(godot_gdnative_init_options*)
- _nativescript_1_1_api
- godot::Variant::Variant(godot::Variant const&)
- godot::_TagDB::register_type(unsigned long, unsigned long)
Assuming I need the C++ bindings for iOS to resolve these issues, I've tried the following, but it failed because the iOS platform is not defined in the SConstruct of godot-cpp:
scons platform=iOS generate_bindings=yes
After some digging on how to build the C++ bindings for iOS, I came across a PR that's waiting to be merged.
So I guess currently GDNative C++ for iOS (and possibly Android) is not only undocumented, but it is not even possible without the PR I've linked above.
In case it's helpful, in the process of researching this topic (for this post) I found this seemingly complete write-up for Android which looks pretty comprehensive:
Also, cross-linking to related issue: https://github.com/GodotNativeTools/godot_headers/issues/30
Edit: Added link to Reddit thread.
Now that the pull request above is merged, is there any way to make gdnative libaries for iOS now?
It has always been possible (since 3.0). You'd just compile a static library instead of a dynamic one.
@endragor Great! So how do you do it? It doesn't show how neither here nor in the godot cpp bindings repo.
Compile a static library (.a) and specify it in the .gdnlib file for iOS platform. There isn't anything specific beside using static library instead of a dynamic one.
@endragor And how do you do that? The compiling part. Again, lack of documentation here.
About build for Android, i've proposed this pull-request #30, closed without being merged.
@Didifred The repo has changed a lot since that PR was closed, we now have nice SConstructs for each project, but they are only for desktop at the moment. Improvements are welcome. If someone were to submit another PR that adds Android or iOS support to these new SConstructs, and adds instructions to the READMEs, I would review and merge it in a timely manner.
I created a gdnative example that successfully compiles the ios version
Are there any examples of Android/IOS builds. I noticed those are not listed in scons?