deepmedia / deepmedia/Knee

More native targets

Open
#7 2 comments 8 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
137
Forks
4
PR merge metrics
No merged PRs in 30d

Description

We need to add support for desktop native targets. For this to work, one must:

- cinterop `jni.h` for them
- cinterop again `jni.h` for `androidNative`, even though it's already available as a platformLib, because this way the cinterop commonizer will be able to create a common API for all native targets.

About cinterop for desktop targets:

1. Technically, headers may differ between different JDK versions, while we don't know what JDK will be used by the library consumer. In practice I don't think JNI headers differ at all, so we may stick with headers from JDK 17 for example.

2. We want to cross-compile this JNI module for all targets from macOS. But I think this means we can't use the common strategy of just pulling the headers from the local JDK installation (like [here](https://github.com/jonnyzzz/kotlin-jni-mix/blob/94ca9a01efec003d35fea96a3de87c517b88e5be/build.gradle.kts#L37-L48)). `jni.h` is always the same, but there's a machine dependent header too `jni_md.h`.

One possible solution is to use AOSP prebuilts: https://android.googlesource.com/platform/prebuilts/jdk/jdk17 contains JDK headers and binaries for all platforms. It's already added as a git submodule.

3. It is my understanding that it's fine to cinterop with just the header and don't pass link instructions (e.g. path to `libjvm.so`) since the JVM already takes care of this.

I'm not 100% sure about the 3 bullet points above though. I'd appreciate if someone with desktop native+JVM experience could confirm.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.