diff --git a/native/.gitignore b/native/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/native/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/native/build.gradle.kts b/native/build.gradle.kts new file mode 100644 index 000000000..4297a8307 --- /dev/null +++ b/native/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + kotlin("multiplatform") +} + +kotlin { + androidNativeArm64("native") { + binaries { + sharedLib("ehviewer-kotlin-native") + } + } +} diff --git a/native/src/nativeMain/kotlin/moe/tarsin/ehviewer/RewriteGif.kt b/native/src/nativeMain/kotlin/moe/tarsin/ehviewer/RewriteGif.kt new file mode 100644 index 000000000..dfc76278a --- /dev/null +++ b/native/src/nativeMain/kotlin/moe/tarsin/ehviewer/RewriteGif.kt @@ -0,0 +1,13 @@ +package moe.tarsin.ehviewer + +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.invoke +import kotlinx.cinterop.pointed +import platform.android.JNIEnvVar +import platform.android.jclass +import platform.android.jobject + +@CName("Java_com_hippo_Native_rewriteGif") +fun rewriteGif(env: CPointer, thiz: jclass, buffer: jobject) { + val ptr = env.pointed.pointed!!.GetDirectBufferAddress!!.invoke(env, buffer) +} diff --git a/settings.gradle b/settings.gradle index 170072ce5..1d3ce4d2a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } } dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) repositories { google() mavenCentral() @@ -18,3 +18,4 @@ dependencyResolutionManagement { enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") rootProject.name = "EhViewer" include ':app' +include ':native'