From 86c6203b4602b92abb8cf8f6ed8d4143b6bd1f00 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 13 Feb 2025 23:28:25 +0800 Subject: add shared library for kotlin --- tests/projects/kotlin-native/shared_library/src/main.kt | 3 +++ tests/projects/kotlin-native/shared_library/xmake.lua | 7 +++++++ tests/projects/kotlin-native/static/src/main.kt | 3 --- tests/projects/kotlin-native/static/xmake.lua | 7 ------- tests/projects/kotlin-native/static_library/src/main.kt | 3 +++ tests/projects/kotlin-native/static_library/xmake.lua | 7 +++++++ xmake/rules/kotlin-native/xmake.lua | 4 +++- 7 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 tests/projects/kotlin-native/shared_library/src/main.kt create mode 100644 tests/projects/kotlin-native/shared_library/xmake.lua delete mode 100644 tests/projects/kotlin-native/static/src/main.kt delete mode 100644 tests/projects/kotlin-native/static/xmake.lua create mode 100644 tests/projects/kotlin-native/static_library/src/main.kt create mode 100644 tests/projects/kotlin-native/static_library/xmake.lua diff --git a/tests/projects/kotlin-native/shared_library/src/main.kt b/tests/projects/kotlin-native/shared_library/src/main.kt new file mode 100644 index 000000000..543f5ac8f --- /dev/null +++ b/tests/projects/kotlin-native/shared_library/src/main.kt @@ -0,0 +1,3 @@ +fun main() { + println("hello xmake!") +} diff --git a/tests/projects/kotlin-native/shared_library/xmake.lua b/tests/projects/kotlin-native/shared_library/xmake.lua new file mode 100644 index 000000000..20c401d76 --- /dev/null +++ b/tests/projects/kotlin-native/shared_library/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.debug", "mode.release") +add_requires("kotlin-native") +target("test") + set_kind("shared") + add_files("src/*.kt") + set_toolchains("@kotlin-native") + diff --git a/tests/projects/kotlin-native/static/src/main.kt b/tests/projects/kotlin-native/static/src/main.kt deleted file mode 100644 index 543f5ac8f..000000000 --- a/tests/projects/kotlin-native/static/src/main.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun main() { - println("hello xmake!") -} diff --git a/tests/projects/kotlin-native/static/xmake.lua b/tests/projects/kotlin-native/static/xmake.lua deleted file mode 100644 index 2e827ec78..000000000 --- a/tests/projects/kotlin-native/static/xmake.lua +++ /dev/null @@ -1,7 +0,0 @@ -add_rules("mode.debug", "mode.release") -add_requires("kotlin-native") -target("test") - set_kind("static") - add_files("src/*.kt") - set_toolchains("@kotlin-native") - diff --git a/tests/projects/kotlin-native/static_library/src/main.kt b/tests/projects/kotlin-native/static_library/src/main.kt new file mode 100644 index 000000000..543f5ac8f --- /dev/null +++ b/tests/projects/kotlin-native/static_library/src/main.kt @@ -0,0 +1,3 @@ +fun main() { + println("hello xmake!") +} diff --git a/tests/projects/kotlin-native/static_library/xmake.lua b/tests/projects/kotlin-native/static_library/xmake.lua new file mode 100644 index 000000000..2e827ec78 --- /dev/null +++ b/tests/projects/kotlin-native/static_library/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.debug", "mode.release") +add_requires("kotlin-native") +target("test") + set_kind("static") + add_files("src/*.kt") + set_toolchains("@kotlin-native") + diff --git a/xmake/rules/kotlin-native/xmake.lua b/xmake/rules/kotlin-native/xmake.lua index a75cc8062..7b359094a 100644 --- a/xmake/rules/kotlin-native/xmake.lua +++ b/xmake/rules/kotlin-native/xmake.lua @@ -22,7 +22,9 @@ rule("kotlin-native.build") set_sourcekinds("kc") on_load(function (target) if target:is_static() then - target:add("kcflags", {"-produce", "static"}, {force = true}) + target:add("arflags", {"-produce", "static"}, {force = true}) + elseif target:is_shared() then + target:add("shflags", {"-produce", "dynamic"}, {force = true}) end end) on_build("build.target") -- cgit v1.3.1