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

what about android/ios builds #19

Open
Triangle345 opened this issue Jan 17, 2018 · 13 comments
Open

what about android/ios builds #19

Triangle345 opened this issue Jan 17, 2018 · 13 comments

Comments

@Triangle345
Copy link

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

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Feb 16, 2018

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

@marcelofg55
Copy link

marcelofg55 commented Nov 29, 2018

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

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Nov 30, 2018 via email

@ArdaE
Copy link

ArdaE commented Jul 6, 2019

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.

@follower
Copy link

follower commented Feb 16, 2020

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: godotengine/godot-headers#30

Edit: Added link to Reddit thread.

@SIsilicon
Copy link

SIsilicon commented Oct 26, 2020

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

@endragor
Copy link

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

@SIsilicon
Copy link

SIsilicon commented Oct 27, 2020

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

@endragor
Copy link

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.

@SIsilicon
Copy link

SIsilicon commented Oct 27, 2020

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

@Didifred
Copy link

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

@aaronfranke
Copy link
Member

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

@mingganglee
Copy link

mingganglee commented May 30, 2023

I created a gdnative example that successfully compiles the ios version

gdnative_example_mac_ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants