insert native lib into jar
This commit is contained in:
@@ -29,6 +29,11 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${kotlinCoroutinesVersion}")
|
||||
}
|
||||
|
||||
sourceSets.main {
|
||||
resources {
|
||||
srcDirs("src/main/resources", "build/natives")
|
||||
}
|
||||
}
|
||||
kotlin {
|
||||
jvmToolchain(24)
|
||||
}
|
||||
@@ -36,4 +41,12 @@ kotlin {
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
project.layout.buildDirectory.set(file("../../build"))
|
||||
tasks.register<Exec>("compileNativeLib") {
|
||||
val java_home = System.getProperty("java.home")
|
||||
environment("CGO_CFLAGS" to "-I$java_home/include -I$java_home/include/linux")
|
||||
workingDir("src/main/go")
|
||||
commandLine("go", "build", "-linkshared", "-buildmode=c-shared", "-o", layout.buildDirectory.get().dir("natives").file("pltbuild.so"))
|
||||
}
|
||||
tasks.processResources {
|
||||
dependsOn += "compileNativeLib"
|
||||
}
|
||||
Reference in New Issue
Block a user