Can anyone point me to some documentation or examples on how I can properly create a multiplatform library using Kotlin Multiplatform targeting multiple Native targets? I struggle a bit to make really a library which others could consume in their Kotlin/Native projects.
My planned chain looks like this:
AlphaSkia Native Libs -> AlphaSkia Kotlin/Native Lib --(maven)-> AlphaTab Kotlin/Native Shared Lib
- libalphaskia.dll - alphaSkia.klib - alphaTab.dll
- libalphaskia.lib - libalphaskia.dll - alphaTab.lib
- libalphaskia.so - libalphaskia.lib - alphaTab.so
- libalphaskia.dylib - libalphaskia.so - alphaTab.dylib
- libalphaskia.dylib - iOS CocoaPod
AlphaSkia is a cross technology, platform and CPU architecture Skia wrapper. This library I want to put now into a Kotlin/Native wrapper an publish it to Maven Central as package.
AlphaTab is my actual end-customer library which consumes AlphaSkia as rendering backend. This library I want to build then into native shared libraries and packages for devs to use in their apps. Windows/Linux I mainly want for Testing purposes while the ultimate goal is to target macOS/iOS/iPadOS in my library.
My main questions currently are:
- Can I build and bundle mutliple Kotlin/Native targets into one package or do I need to create an individual Kotlin/Native Maven package for each target? I would like to build the binaries on a Matrix in GitHub Actions and the publish all items together in one package to consume.
- AlphaSkia is a shared library. How can I embed all the files requried for linking to the package so they are available for AlphaTab?
I looked through following docs but could not find answers to my questions:
- Get started with Kotlin Multiplatform | Kotlin Documentation
- Get started with Kotlin/Native using Gradle | Kotlin Documentation
The docs somehow ignore the fact that you cannot compile all targets on the same machine but have to deal with a sequence of build and packaging steps. There also seem to be the assumption that you should only work with static libs as dependencies and shared library dependencies are not touched.
Thanks and Kind Regards