summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-02-20 22:52:45 +0800
committerruki <[email protected]>2025-02-20 22:52:45 +0800
commit0098d8212430faf1833013d8fb447addb68a6ebb (patch)
treecf0ce0c319de7761d0bb333ecd910dc77203d9df
parent6807d5763f16e779697af79764b4ea6dd79b6fef (diff)
improve kotlin native for windows
-rw-r--r--xmake/modules/core/tools/kotlinc_native.lua17
-rw-r--r--xmake/rules/kotlin-native/xmake.lua2
2 files changed, 19 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/kotlinc_native.lua b/xmake/modules/core/tools/kotlinc_native.lua
index 1ca5cc172..d637636b2 100644
--- a/xmake/modules/core/tools/kotlinc_native.lua
+++ b/xmake/modules/core/tools/kotlinc_native.lua
@@ -49,6 +49,23 @@ function build(self, sourcefiles, targetkind, targetfile, flags)
end
end
end
+ elseif targetkind == "static" and self:is_plat("windows", "mingw") then
+ local headerfile_real = targetfile .. "_api.h"
+ local headerfile = path.join(path.directory(targetfile), "lib" .. path.basename(targetfile) .. "_api.h")
+ if os.isfile(headerfile_real) then
+ os.mv(headerfile_real, headerfile)
+ end
+
+ local targetfile_real = path.join(path.directory(targetfile), "lib" .. path.basename(targetfile) .. ".lib.a")
+ if os.isfile(targetfile_real) then
+ os.mv(targetfile_real, targetfile)
+ end
+ elseif targetkind == "shared" and self:is_plat("windows", "mingw") then
+ local headerfile_real = path.join(path.directory(targetfile), path.basename(targetfile) .. "_api.h")
+ local headerfile = path.join(path.directory(targetfile), "lib" .. path.basename(targetfile) .. "_api.h")
+ if os.isfile(headerfile_real) then
+ os.mv(headerfile_real, headerfile)
+ end
end
end
diff --git a/xmake/rules/kotlin-native/xmake.lua b/xmake/rules/kotlin-native/xmake.lua
index 69fcb6027..909bd4a9e 100644
--- a/xmake/rules/kotlin-native/xmake.lua
+++ b/xmake/rules/kotlin-native/xmake.lua
@@ -27,6 +27,8 @@ rule("kotlin-native.build")
target:add("kcflags", "-opt-in=kotlin.experimental.ExperimentalNativeApi", {force = true})
if target:is_plat("macosx") then
target:add("frameworks", "Foundation", "CoreFoundation", {interface = true})
+ elseif target:is_plat("windows", "mingw") then
+ target:add("syslinks", "pthread", {interface = true})
end
elseif target:is_shared() then
target:add("shflags", {"-produce", "dynamic"}, {force = true})