72f9cdf49b
Don't publish libcurl to a local Maven repo, but consume it directly as a project dependency. Publishing appears to be fragile here, and the intention of the test does not involve checking Gradle anyway.
37 lines
1.2 KiB
Kotlin
37 lines
1.2 KiB
Kotlin
plugins {
|
|
kotlin("multiplatform")
|
|
}
|
|
|
|
val mingwPath = File(System.getenv("MINGW64_DIR") ?: "C:/msys64/mingw64")
|
|
|
|
kotlin {
|
|
|
|
// Determine host preset.
|
|
val hostOs = System.getProperty("os.name")
|
|
|
|
// Create target for the host platform.
|
|
val hostTarget = when {
|
|
hostOs == "Mac OS X" -> macosX64("libcurl")
|
|
hostOs == "Linux" -> linuxX64("libcurl")
|
|
hostOs.startsWith("Windows") -> mingwX64("libcurl")
|
|
else -> throw GradleException("Host OS '$hostOs' is not supported in Kotlin/Native $project.")
|
|
}
|
|
|
|
hostTarget.apply {
|
|
compilations["main"].cinterops {
|
|
val libcurl by creating {
|
|
when (preset) {
|
|
presets["macosX64"] -> includeDirs.headerFilterOnly("/opt/local/include", "/usr/local/include")
|
|
presets["linuxX64"] -> includeDirs.headerFilterOnly("/usr/include", "/usr/include/x86_64-linux-gnu")
|
|
presets["mingwX64"] -> includeDirs.headerFilterOnly(mingwPath.resolve("include"))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Enable experimental stdlib API used by the sample.
|
|
sourceSets.all {
|
|
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
|
|
}
|
|
}
|