Skip to content

Add kotlin language and kotlin-native compiler support #6154

@waruqi

Description

@waruqi

We can use kotlinc-native compiler to support it.

Console

Bind remote kotlin-native toolchain package

add_rules("mode.debug", "mode.release")
add_requires("kotlin-native")
target("test")
    set_kind("binary")
    add_files("src/*.kt")
    set_toolchains("@kotlin-native")
ruki-2:console ruki$ xmake
[ 66%]: linking.release test
[100%]: build ok, spent 19.752s
ruki-2:console ruki$ xmake run
hello xmake!

Set local kotlin-native toolchain

add_rules("mode.debug", "mode.release")
target("test")
    set_kind("binary")
    add_files("src/*.kt")
ruki-2:console ruki$ xmake f --sdk=~/projects/qiyi/kmp/kotlin/kotlin-native/dist/ --toolchain=kotlin-native
ruki-2:console ruki$ xmake
[ 66%]: linking.release test
ruki-2:console ruki$ xmake run
hello xmake!

Static library

add_rules("mode.debug", "mode.release")
add_requires("kotlin-native")
target("test")
    set_kind("static")
    add_files("src/*.kt")
    set_toolchains("@kotlin-native")

Shared library

add_rules("mode.debug", "mode.release")
add_requires("kotlin-native")
target("test")
    set_kind("shared")
    add_files("src/*.kt")
    set_toolchains("@kotlin-native")

#6153

Describe the solution you'd like

.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions