I’ve got an example directory with multiple Kotlin...
# kotlin-native
a
I’ve got an example directory with multiple Kotlin/Native files, each with a
fun main() {}
. Is there an easy way with Gradle to create executables for each file? So one Kotlin/Native Gradle project can produce multiple executables? I’ve tried creating a separate target for each file, but it’s really messy - with conflicting Configurations and overlapping sources…
e
it's much easier than that
Copy code
kotlin {
    linuxX64 {
        binaries {
            executable("one") {
                entryPoint("pkg.one.main")
            }
            executable("two") {
                entryPoint("pkg.two.main")
            }
            executable("...") {
Copy code
./gradlew link{One,Two,...}{Debug,Release}ExecutableLinuxX64
ls build/bin/linuxX64/{one,two,...}{Debug,Release}Executable/{one,two,...}.kexe
can be applied to native targets other than
linuxX64
too, of course
a
thanks! Here’s how I’ve done it dynamically