I'm thinking of building a native cli app and I'm ...
# kotlin-native
h
I'm thinking of building a native cli app and I'm following the docs that say to clone https://github.com/Kotlin/kmp-native-wizard as a starter project. This doesn't use the kmp template that I'm used to with commonMain etc and I'm wondering if I can change to a structure that does? That would also give me the ability to run the app on the jvm if I don't want to compile it down to native code for some reason.
j
You could rename the nativeMain dir to commonMain and it would work the same
In general, though, I would not recommend how that project is setup
h
yeah I guess I'm basically looking for a setup that adds a compile to native target
The docs don't really make it very clear? Or they just don't want you to do it 😬
j
h
Thanks! That makes sense
j
for jvm you just toss
jvm()
. you'll want more native targets. i only did my mac because it requires ffmpeg and i was too lazy to set that up for other targets.
👍 1
h
I think I can get away with using multiplatform deps, I just want a single (small) binary. Or smallish
Works like charm, thanks again
👍 1
j
There's a new DSL for packaging JVM apps that's nice, too: https://github.com/JakeWharton/mosaic/blob/trunk/samples/counter/build.gradle#L25-L31
💯 1