hello, i have another question on kotlin native an...
# getting-started
c
hello, i have another question on kotlin native and gradle. this is my current
build.gradle.kts
Copy code
kotlin {
    linuxX64("native") {
        binaries {
            executable()
        }
    }

    mingwX64("native") {
        binaries {
            executable()
        }
    }
}
is this the correct way to define multiple targets? if so, how do i run gradle to compile for both platforms? there is an error when i run
gradle nativeBinaries
: The target 'native' already exists, but it was not created with the 'mingwX64' preset. To configure it, access it by name in
kotlin.targets
or use the preset function 'linuxX64'.
v
I have no idea about Kotlin native, but interpreting the error message, you cannot name both
native
, so pick unique names.
e
correct, multiple targets cannot have the same name. unless you have multiple targets of the same type, I would leave the name out completely; it'll use the default names, same as
linuxX64("linuxX64")
and
mingwX64("mingwX64")
.
c
thank you, so if i want to compile for linux, what gradle command should i run?
e
depends, possibly one of
Copy code
./gradlew linkDebugExecutableLinuxX64
./gradlew linkReleaseExecutableLinuxX64
or just run
Copy code
./gradlew assemble
which builds everything, just like in all Gradle projects
c
i see, thanks!
v
just like in all Gradle projects just like in most typical Gradle projects
e
that's fair. I wanted to say "like in most sane Gradle projects" but ended up taking the value judgement out which made it a bit too general
❤️ 1