Skip to content

Commit

Permalink
Add native macosX64 target if it runs on mac (#93)
Browse files Browse the repository at this point in the history
System.getProperty("os.name") == "Mac OS X"

./gradlew :nativesample:runReleaseExecutableMacosX64
Hello Native.

 ./nativesample/build/bin/macosX64/releaseExecutable/nativesample.kexe
Hello Native.
  • Loading branch information
Jean-Michel Fayard authored and ajalt committed Oct 3, 2019
1 parent 5c8d566 commit 87862cd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
9 changes: 9 additions & 0 deletions clikt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ buildscript {
}

kotlin {
def runOnMac = System.getProperty("os.name") == "Mac OS X"
targetFromPreset(presets.jvmWithJava, 'jvm')
linuxX64('linux')
mingwX64('win')
if (runOnMac) {
macosX64()
}

sourceSets {
commonMain {
Expand Down Expand Up @@ -52,6 +56,11 @@ kotlin {
configure([linuxMain, winMain]) {
dependsOn commonMain
}
if (runOnMac) {
configure(macosX64Main) {
dependsOn linuxMain
}
}
}
}

Expand Down
17 changes: 16 additions & 1 deletion nativesample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
apply plugin: 'org.jetbrains.kotlin.multiplatform'


kotlin {
def runOnMac = System.getProperty("os.name") == "Mac OS X"
if (runOnMac) macosX64 {
binaries {
executable {
entryPoint = 'com.github.ajalt.clikt.sample.main'
}
}
}
mingwX64('winX64') {
binaries {
executable {
Expand All @@ -10,10 +19,16 @@ kotlin {
}

sourceSets {
winX64Main {
main {
dependencies {
implementation project(':clikt')
}
}
if (runOnMac) configure(macosX64Main) {
dependsOn main
}
configure(winX64Main) {
dependsOn main
}
}
}

0 comments on commit 87862cd

Please sign in to comment.