filament icon indicating copy to clipboard operation
filament copied to clipboard

Support for Kotlin Native

Open spencerelliott opened this issue 5 years ago • 10 comments

Describe the solution you'd like Adding support for Kotlin Native would allow developers to create a single codebase that supports iOS, Desktop, and Android. The code would be compiled to native code for each platform possibly increasing performance.

Describe alternatives you've considered It is currently possible to build macOS, PC, Android, and Linux apps using Kotlin. These platforms each require their own build to be performed, though. Apps for iOS need to be rewritten in C++.

spencerelliott avatar May 17 '19 22:05 spencerelliott

I haven't explored Kotlin Native too deeply, but I think it's an interesting idea. Not sure how much additional work it would be given we already have JNI bindings.

bejado avatar May 17 '19 23:05 bejado

What support do you need added exactly?

romainguy avatar May 20 '19 02:05 romainguy

The cinterop tool would need to be run on the Filament codebase. This would generate an interface between the native code and Kotlin Native. From there, I believe work would have to be done to build a stable API for each platform to pass in a valid surface using the expect/actual mechanism.

Additionally, it would be nice to have it available as a Multiplatform library through Maven. Kotlin Native has support for publishing artifacts. This may be a separate ticket, though.

spencerelliott avatar May 21 '19 13:05 spencerelliott

Filament is such a great piece of work; this would make it a killer lib. Any news on the issue? We are currently starting a rewrite of an AR app running on iOS to support Android and multiplatform kotlin-native is the way to go. The possibility to use filament would be fantastic

honza-vanek avatar Mar 12 '20 10:03 honza-vanek

I agree supporting Kotlin Native would be fantastic. Unfortunately it is not a priority at this point. To do this properly we first need to find a scalable and sustainable way to support all the different language bindings since this would at least require to recreate the Java APIs in Kotlin.

That said a possible workaround for you right now would be to start from our JNI binding as a base for a C API for Filament. This should be usable with Kotlin.

romainguy avatar Mar 12 '20 15:03 romainguy

FYI https://kotlinlang.org/docs/reference/native/c_interop.html

unicomp21 avatar Mar 12 '20 15:03 unicomp21

Thank you for the fast answers, sorry to hear that, will try to find some other way... Good luck with filament and thanks for all the work

honza-vanek avatar Mar 12 '20 17:03 honza-vanek

...another developer here whose cross-platform 3D dreams have been stopped dead in their tracks by the realisation that Kotlin/Native can't currently use Filament due to incompatibility with C-interop tool. Filament is a fabulous piece of work, would be a great 'force multiplier' to have these bindings available so it can be used as a Kotlin/Multiplatform library & beyond.

chris-hatton avatar Oct 05 '20 12:10 chris-hatton

Actually nope, they haven't. We have simply written a cross-platform renderer ourselves. Half a year delay but it's done :)

honza-vanek avatar Oct 05 '20 13:10 honza-vanek

@chris-hatton I understand but we just don't have resources to spare on this at the moment :(

romainguy avatar Oct 05 '20 17:10 romainguy