summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-02-20 23:09:36 +0800
committerruki <[email protected]>2025-02-20 23:09:36 +0800
commitbe38e81e4304b7c1fcfad49662a8f27416627367 (patch)
tree6e14e202ac450fba2a19940ef380284f4c39e1d4
parent9bba35fe3c7e835b638a94e54163e79a4d056ed0 (diff)
generate .lib for kotlin
-rw-r--r--xmake/modules/core/tools/kotlinc_native.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/kotlinc_native.lua b/xmake/modules/core/tools/kotlinc_native.lua
index 69929f6cb..be4047d22 100644
--- a/xmake/modules/core/tools/kotlinc_native.lua
+++ b/xmake/modules/core/tools/kotlinc_native.lua
@@ -23,6 +23,8 @@ import("core.base.option")
import("core.project.config")
import("core.project.project")
import("core.language.language")
+import("core.tool.toolchain")
+import("lib.detect.find_tool")
-- init it
function init(self)
@@ -67,6 +69,18 @@ function build(self, sourcefiles, targetkind, targetfile, flags, opt)
if os.isfile(headerfile_real) then
os.mv(headerfile_real, headerfile)
end
+ local deffile = path.join(path.directory(targetfile), path.basename(targetfile) .. ".def")
+ local libfile = path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib")
+ if os.isfile(deffile) then
+ local msvc = toolchain.load("msvc", {plat = self:plat(), arch = self:arch()})
+ if msvc:check() then
+ local lib = find_tool("lib", {envs = msvc:runenvs()})
+ if lib then
+ os.runv(lib.program, {"/def:" .. deffile, "/out:" .. libfile}, {envs = msvc:runenvs()})
+ end
+ end
+ end
end
end
+