Browse Source

Add macOS builds

app-api
Nikolay Igotti 3 years ago
parent
commit
8b7d4c1704
  1. 19
      components/Kapp/demo/build.gradle.kts
  2. 11
      components/Kapp/library/build.gradle.kts
  3. 31
      components/Kapp/library/src/macosMain/kotlin/org/jetbrains/compose/kapp/KApp.macos.kt

19
components/Kapp/demo/build.gradle.kts

@ -29,6 +29,20 @@ kotlin {
}
}
/*
macosArm64 {
binaries {
executable {
entryPoint = "org.jetbrains.compose.kapp.demo.main"
freeCompilerArgs += listOf(
"-linker-option", "-framework", "-linker-option", "Metal",
"-linker-option", "-framework", "-linker-option", "CoreText",
"-linker-option", "-framework", "-linker-option", "CoreGraphics"
)
}
}
} */
iosX64("uikitX64") {
binaries {
executable {
@ -85,6 +99,11 @@ kotlin {
dependsOn(macosMain)
}
/*
val macosArm64Main by getting {
dependsOn(macosMain)
} */
val uikitMain by creating {
dependsOn(darwinMain)
}

11
components/Kapp/library/build.gradle.kts

@ -18,6 +18,8 @@ kotlin {
if (withNative) {
iosX64("uikitX64")
//iosArm64("uikitArm64")
macosX64()
// macosArm64()
}
sourceSets {
@ -45,12 +47,17 @@ kotlin {
dependsOn(darwinMain)
}
val macosX64Main by creating {
val macosX64Main by getting {
dependsOn(macosMain)
}
/*
val macosArm64Main by getting {
dependsOn(macosMain)
} */
val uikitMain by creating {
dependsOn(commonMain)
dependsOn(darwinMain)
}
val uikitX64Main by getting {

31
components/Kapp/library/src/macosMain/kotlin/org/jetbrains/compose/kapp/KApp.macos.kt

@ -0,0 +1,31 @@
package org.jetbrains.compose.kapp
import androidx.compose.runtime.*
import androidx.compose.ui.window.Window
import platform.AppKit.NSApp
import platform.AppKit.NSApplication
@Composable
actual fun KAppScope.Frame(content: @Composable () -> Unit) {
content()
}
internal class AppAppScope : KAppScope {}
internal actual fun kappImpl(name: String, title: String, content: @Composable KAppScope.() -> Unit) {
// TODO: make it multiframe.
val scope = AppAppScope()
scope.apply {
TODO()
}
}
internal actual fun simpleKappImpl(name: String, content: @Composable () -> Unit) {
NSApplication.sharedApplication()
Window(name) {
content()
}
NSApp?.run()
}
Loading…
Cancel
Save