File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change 1+ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
2+ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
3+ import org.jetbrains.kotlin.konan.target.HostManager
4+
15plugins {
26 kotlin(" multiplatform" ) version " 1.5.0"
37}
@@ -13,13 +17,21 @@ fun configInterop(target: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTar
1317 val sqlite3 by main.cinterops.creating {
1418 includeDirs(" $projectDir /src/include" )
1519 }
16- }
1720
18- val onWindows = org.jetbrains.kotlin.konan.target.HostManager .hostIsMingw
21+ target.compilations.forEach { kotlinNativeCompilation ->
22+ kotlinNativeCompilation.kotlinOptions.freeCompilerArgs + = when {
23+ HostManager .hostIsLinux -> listOf (
24+ " -linker-options" ,
25+ " -lsqlite3 -L/usr/lib/x86_64-linux-gnu" // just /usr/lib for arch
26+ )
27+ HostManager .hostIsMingw -> listOf (" -linker-options" , " -Lc:\\ msys64\\ mingw64\\ lib" )
28+ else -> listOf (" -linker-options" , " -lsqlite3" )
29+ }
30+ }
31+ }
1932
2033kotlin {
21- val knTargets =
22- listOf (
34+ val knTargets = listOf (
2335 macosX64(),
2436 iosX64(),
2537 iosArm64(),
@@ -43,16 +55,11 @@ kotlin {
4355 }
4456 }
4557 )
46- knTargets.forEach { configInterop(it) }
58+ }
4759
4860 knTargets
4961 .forEach { target ->
5062 configInterop(target)
51- val test by target.compilations.getting
52-
53- if (! target.name.startsWith(" mingw" ) && ! target.name.startsWith(" linux" )) {
54- test.kotlinOptions.freeCompilerArgs + = listOf (" -linker-options" , " -lsqlite3" )
55- }
5663 }
5764
5865 sourceSets {
You can’t perform that action at this time.
0 commit comments