jakepurple13 / Full-Multiplatform-Compose-Plugin

An intellij plugin to create multiplatform compose projects, covering everything! JS, Android, IOS, and desktop!
48 stars 6 forks source link

enhancement #3

Closed wiiznokes closed 1 year ago

wiiznokes commented 1 year ago

I would be nice to be able to choose the native OS for Desktop. For example, we could choose linuxX64 and mingwX64. And if we select only these platforms, having only necessary directories e.i. commonMain, linuxX64Main and mingwX64Main (I think).

jakepurple13 commented 1 year ago

I'd imagine desktopMain would cover that since it also handles getting the correct dependencies for the current os. Plus, desktop compose has:

actual val hostOs: OS by lazy {
    val osName = System.getProperty("os.name")
    when {
        osName == "Mac OS X" -> OS.MacOS
        osName.startsWith("Win") -> OS.Windows
        "The Android Project" == System.getProperty("java.specification.vendor") -> OS.Android
        osName == "Linux" -> OS.Linux
        else -> throw Error("Unknown OS $osName")
    }
}

actual val hostArch: Arch by lazy {
    val osArch = System.getProperty("os.arch")
    when (osArch) {
        "x86_64", "amd64" -> Arch.X64
        "aarch64" -> Arch.Arm64
        else -> throw Error("Unknown arch $osArch")
    }
}

Which might be helpful. Though, for mingwX64 (which I haven't heard of before, sorry), you might run into some errors unless it points to Windows (from the quick 2 minute search I did 😅). Though, adding an an option to add additional mains might be useful...I just don't know if compose will pick those up correctly.

wiiznokes commented 1 year ago

Thanks. Finally, I found a similar option when we click on Library from new project windows example

Unfortunately for my case, multiple jvm target is not yet supported, but it still covers all basic modules. It's not perfect yet but it's already a better template to start with.