gdext
gdext copied to clipboard
iOS support
This issue is for tracking the state of iOS support.
- What are current hurdles?
- What should be next steps anyone can take?
More specifically:
- Has anyone gotten a gdext project to build & run for iOS yet?
- If not, where did you get stuck?
- If you have gotten it to run: Did you notice any higher level issues? (Certain calls not working, etc.)
Tangentially related, but still related. Spent a few hours trying to see if I can use Godot + Rust to make a simple iOS app. I got stuck at the very start of the process. After creating a basic rust library with a simple test node and test function inside that node. It turns out doing something as simple as editing that function, and doing cargo build && cp ...
into the Godot folder causes Godot 4.2 and 4.2.1 to crash. The solution is to quit Godot before you do the cargo build && cp ...
and I just can't imagine quitting and restarting Godot every time I change a line of code.
If I can get past this pain point, I will test the next steps towards getting it working on my phone.
I was able to export and run the book's Hello World project on an iPhone in 4.2.1. I had to disable the OpenXR APIs before it would work. I had no issues with the editor crashing.
@johnsonbaugh Great to hear! Apart from excluding OpenXR*
classes, was there anything special you needed to configure?
What toolchain did you use?
Using stable-aarch64-apple-darwin. Ultimately I think everything else I did was straightforward.
Added aarch64-apple-ios target:
rustup target add aarch64-apple-ios
Added .gdextension entries:
ios.debug.arm64 = "res://../rust/target/aarch64-apple-ios/debug/librust_project.dylib"
ios.release.arm64 = "res://../rust/target/aarch64-apple-ios/release/librust_project.dylib"
Built for iOS:
cargo build --target=aarch64-apple-ios
Great to hear! In gdnative we had a CI job to build iOS, based on cargo-dinghy
. Probably we can reuse that here.
For those who compiling without lazy-functions-table
is throwring:
USER ERROR: Panic msg:
Failed to load class method OpenXRAPIExtension::get_instance (hash 2455072627).
Make sure gdext and Godot are compatible: https://godot-rust.github.io/book/gdext/advanced/compatibility.html
at: <function unset> (/Users/user/.cargo/git/checkouts/gdext-76630c89719e160c/5e18af8/godot-core/src/lib.rs:107)
The issue is this because OpenXR module is not being included for iOS: https://github.com/godotengine/godot/blob/master/modules/openxr/config.py#L2
To make it work https://github.com/godot-rust/gdext/blob/master/godot-codegen/src/special_cases/special_cases.rs#L75 this line is going to be modified :D
EDIT: After https://github.com/godot-rust/gdext/pull/639 this should be fixed