Hi I am thinking of wrapping filament in kmp proje...
# kotlin-native
d
Hi I am thinking of wrapping filament in kmp project and share logic between Ios and android any suggestions filament: https://github.com/google/filament I dont know how to bind this or any thing just I need guidance
a
I think it would be a big undertaking. Have you created Kotlin Native bindings before? Kotlin's cinterop tool can only generate Kotlin bindings for C, but Filament written in C++. This can be overcome by writing
extern "C"
wrappers for the C++ code, which can be very hard. I see there are already some C wrappers, for use in JNI. Maybe these could be used as a basis, or you could create some tool for automatically converting them to make them suitable for cinterop.
Another step to overcome: Kotlin Native requires a very specific gcc version that isn't widely distributed. So you'd need to compile Filament with this specific gcc. In theory it shouldn't be difficult, but I always encounter problems when compiling C/C++! I shared an example of how to create a Gradle task to compile C/C++ using Kotlin Native's gcc here: https://gist.github.com/aSemy/076591d565867839b6009f36c3b8b3ae
❤️ 1
d
I realize later that there is cocopods integration in ios and maven dependency for android jvm target maybe using expect actual will be the best approach what do you think ?