Skip to content

Instantly share code, notes, and snippets.

@jonnyzzz
Created December 15, 2019 16:01
Show Gist options
  • Save jonnyzzz/65a4004eaf41559fb28dd44e34dbb776 to your computer and use it in GitHub Desktop.
Save jonnyzzz/65a4004eaf41559fb28dd44e34dbb776 to your computer and use it in GitHub Desktop.
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem
fun setupNative(name: String,
configure: KotlinNativeTargetWithTests.() -> Unit): KotlinNativeTargetWithTests {
val os = getCurrentOperatingSystem()
return when {
os.isLinux -> kotlin.linuxX64(name, configure)
os.isWindows -> kotlin.mingwX64(name, configure)
os.isMacOsX -> kotlin.macosX64(name, configure)
else -> error("OS $os is not supported")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment