Skip to content

Commit

Permalink
First draft of multiplatform support
Browse files Browse the repository at this point in the history
Things aren't 100% yet, but this is enough code at this point that
things are compiling.

Figuring out raw mode still needs to be supported, and a few other
"NotImplementedYet" places still need to be resolved. Also, we
probably need to add a bit more test coverage for missing locations.
  • Loading branch information
bitspittle committed Mar 8, 2023
1 parent 8eae574 commit f263d48
Show file tree
Hide file tree
Showing 81 changed files with 987 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions examples/native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
An example that shows how to generate native releases for Kotter applications.

Check out this project's `build.gradle.kts` file to see how this is set up.

For native builds, you must build them on the proper host machine -- for example, Windows binaries should get built on
Windows machines and Linux binaries should get built on Linux machines.

You can probably use something like GitHub CI to provision different host macines in order to generate artifacts for all
three platforms.
46 changes: 46 additions & 0 deletions examples/native/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
alias(libs.plugins.kotlin.multiplatform)
application
}

group = "com.varabyte.kotter"
version = "1.0-SNAPSHOT"


repositories {
mavenCentral()
}

kotlin {
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}

nativeTarget.apply {
binaries {
executable {
entryPoint = "main"
}
}
}

sourceSets {
val nativeMain by getting {
dependencies {
implementation(project(":kotter"))
implementation(libs.kotlinx.coroutines)
}
}
}
}


application {
mainClass.set("MainKt")
}

Loading

0 comments on commit f263d48

Please sign in to comment.