import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests plugins { id 'org.jetbrains.kotlin.multiplatform' version 'KOTLIN_VERSION' } group = 'me.user' version = '1.0-SNAPSHOT' repositories { mavenCentral() } kotlin { def hostOs = System.getProperty("os.name") def isMingwX64 = hostOs.startsWith("Windows") KotlinNativeTargetWithTests nativeTarget if (hostOs == "Mac OS X") nativeTarget = macosX64('native') else if (hostOs == "Linux") nativeTarget = linuxX64("native") else if (isMingwX64) nativeTarget = mingwX64("native") else throw new GradleException("Host OS is not supported in Kotlin/Native.") nativeTarget.with { binaries { executable { entryPoint = 'main' } } } sourceSets { nativeMain { } nativeTest { } } }