I found an answer for Desktop applications from Phil Dukhov suggestion,
https://github.com/JetBrains/compose-multiplatform/blob/master/tutorials/Native_distributions_and_local_execution/README.md#basic-usage
Desktop Application Output
Step 1: Add Jetbrains compose plugin
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("jvm")
id("org.jetbrains.compose") // this line
}
Step 2: Configure desktop distribution formats
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb,TargetFormat.Exe)
packageName = "com.twt.ajaja"
packageVersion = "1.0.0"
}
}
}
Step 3: Open the terminal and put your project path
cd /path/to/your/project
Step 4: Execute build generation (I am using mac, so I can take only mac build)
./gradlew packageDmg
Note: As of June 12, 2024, cross-compilation is not supported. This means you can only create the .dmg package on macOS. To create .msi, .deb, or .exe packages, you must run the corresponding tasks on Windows or Linux systems respectively.
Step 5: After a build, output binaries can be found in ${project.buildDir}/compose/binaries.
Example:
YourComposeProject/composeApp/build/compose/binaries/main/dmg/your_app.dmg
Web Application Output
Step 1: Configure the webpack config in your gradle file. If you create the project through KMP Wizard, you can skip this step
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
moduleName = "composeApp"
browser {
commonWebpackConfig {
outputFileName = "composeApp.js"
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
static = (static ?: mutableListOf()).apply {
// Serve sources to debug inside browser
add(project.projectDir.path)
}
}
}
}
binaries.executable()
}
Step 2: Open the terminal at your project path
./gradlew wasmJsBrowserDistribution
Step 3: You can find the wasm output in following path
~YourProjectPath/composeApp/build/dist/wasmJs/productionExecutable