Adaptive native targets.

This commit is contained in:
Alexander Nozik 2021-02-23 14:30:39 +03:00
parent 48bf26e26a
commit 1cc83e8803
2 changed files with 38 additions and 22 deletions

View File

@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- Adaptive support for host OS in native
### Changed ### Changed
### Deprecated ### Deprecated

View File

@ -18,10 +18,21 @@ class KScienceNativePlugin : Plugin<Project> {
} }
configure<KotlinMultiplatformExtension> { configure<KotlinMultiplatformExtension> {
//deploy mode val hostOs = System.getProperty("os.name")
linuxX64()
mingwX64() val isLinux = hostOs == "Linux"
macosX64() val isMinGw = hostOs.startsWith("Windows")
val isMacOs = hostOs == "Mac OS X"
if (isLinux || isMinGw) {
linuxX64()
}
if (isMinGw) {
mingwX64()
}
if (isMacOs) {
macosX64()
}
sourceSets { sourceSets {
val commonMain by getting val commonMain by getting
@ -35,28 +46,33 @@ class KScienceNativePlugin : Plugin<Project> {
dependsOn(commonTest) dependsOn(commonTest)
} }
val linuxX64Main by getting { if (isLinux) {
dependsOn(nativeMain) val linuxX64Main by getting {
dependsOn(nativeMain)
}
val linuxX64Test by getting {
dependsOn(nativeTest)
}
} }
val mingwX64Main by getting { if (isMinGw) {
dependsOn(nativeMain) val mingwX64Main by getting {
dependsOn(nativeMain)
}
val mingwX64Test by getting {
dependsOn(nativeTest)
}
} }
val macosX64Main by getting { if (isMacOs) {
dependsOn(nativeMain) val macosX64Main by getting {
} dependsOn(nativeMain)
}
val linuxX64Test by getting { val macosX64Test by getting {
dependsOn(nativeTest) dependsOn(nativeTest)
} }
val mingwX64Test by getting {
dependsOn(nativeTest)
}
val macosX64Test by getting {
dependsOn(nativeTest)
} }
} }
} }