Adam Cooper
09/22/2022, 11:00 PMval nativeTarget = when (System.getProperty("os.name")) {
"Linux" -> linuxX64("native")
else -> throw GradleException("Host OS is not supported.")
}
nativeTarget.apply {
compilations.getByName("main") {
cinterops {
val openssl by creating {
defFile(project.file("src/cinterop/openssl.def"))
}
}
}
binaries {
executable {
// Use system C libraries
val sysRoot = "/"
val libgccRoot = File("/lib/gcc/x86_64-linux-gnu/").takeIf { it.exists() }
?: File("/lib/gcc/x86_64-pc-linux-gnu/")
// Use the most recent GCC available on the host
val libgccPath = file("${libgccRoot.absolutePath}/${libgccRoot.list()!!.last()}")
val overriddenProperties =
"targetSysRoot.linux_x64=$sysRoot;libGcc.linux_x64=$libgccPath"
val compilerArgs = "-Xoverride-konan-properties=$overriddenProperties"
this.freeCompilerArgs += listOf(compilerArgs)
this.entryPoint = "opstopus.deploptopus.main"
}
}