kyonifer / koma

A scientific computing library for Kotlin. https://kyonifer.github.io/koma
Other
270 stars 23 forks source link

How to use within a kotlin multiplatform project #104

Closed rcarcasses closed 4 years ago

rcarcasses commented 4 years ago

Hi, thanks for your awesome work. I'm currently working in a kotlin multiplatform project that target linux, macos, ios and android, and I would like to use there koma features like matrix inversion. However I feel a little bit lost regarding how to include koma, do you have any suggestion about how to change build.gradle to achieve this?

kyonifer commented 4 years ago

So this project pre-dates the multiplatform plugin existing for kotlin. The original way to work cross-platform was to build the artifacts manually for each platform and then link them into each project one by one.

Around the time that the second multiplatform plugin was getting the ability to support bringing in multiplatform projects as a gradle dependency, I gave it a shot to configure a multiplatform artifact that could bring koma into a multiplatform project as a simple dependency. You can find those artifacts here, noting that those binaries were only built for native-linux, native-macos, js, and jvm (not ios or android). I got stuck at the time with a few bugs with gradle metadata support (required for kotlin/native target support): only certain gradle versions supported it and even those versions had bugs with the multiplatform plugin. The result was that I could import the above linked artifacts into a multiplatform project for js and jvm but native targets like macOS and linux64 still didn't work.

However, that last attempt was over a year ago at this point, so I assume those issues have been figured out and probably with some fiddling with the build system one could generate proper multiplatform artifacts. Due to kotlin/native's handling of frozen memory not being acceptable for the sort of projects I use kotlin for, I don't have any time to work on that myself at present.

As a workaround, one could always build the artifacts manually for the platforms needed and link them as platform-specific deps.

rcarcasses commented 4 years ago

Thank you very much for your reply. I'll take a look to your example.