gdnative-demos icon indicating copy to clipboard operation
gdnative-demos copied to clipboard

what about android/ios builds

Open Triangle345 opened this issue 7 years ago • 13 comments

Are there any examples of Android/IOS builds. I noticed those are not listed in scons?

Triangle345 avatar Jan 17 '18 12:01 Triangle345

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

BastiaanOlij avatar Feb 16 '18 23:02 BastiaanOlij

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

marcelofg55 avatar Nov 29 '18 23:11 marcelofg55

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 [email protected] 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

BastiaanOlij avatar Nov 30 '18 00:11 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.

ArdaE avatar Jul 06 '19 01:07 ArdaE

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.

follower avatar Feb 16 '20 06:02 follower

Now that the pull request above is merged, is there any way to make gdnative libaries for iOS now?

SIsilicon avatar Oct 26 '20 03:10 SIsilicon

It has always been possible (since 3.0). You'd just compile a static library instead of a dynamic one.

endragor avatar Oct 27 '20 02:10 endragor

@endragor Great! So how do you do it? It doesn't show how neither here nor in the godot cpp bindings repo.

SIsilicon avatar Oct 27 '20 03:10 SIsilicon

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 avatar Oct 27 '20 05:10 endragor

@endragor And how do you do that? The compiling part. Again, lack of documentation here.

SIsilicon avatar Oct 27 '20 05:10 SIsilicon

About build for Android, i've proposed this pull-request #30, closed without being merged.

Didifred avatar Aug 11 '21 20:08 Didifred

@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.

aaronfranke avatar Aug 11 '21 21:08 aaronfranke

I created a gdnative example that successfully compiles the ios version

gdnative_example_mac_ios

mingganglee avatar May 30 '23 02:05 mingganglee