summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSineStriker <[email protected]>2025-04-20 17:24:27 +0800
committerruki <[email protected]>2025-04-23 11:30:30 +0800
commitc208820b204ad066812f87545b96703ad5cebf3a (patch)
tree913360fcd541fff92571f6e977b923780f898001
parentd57cceb19f58b99d5198cea0c32ec306ea22a9fb (diff)
Fix test error
-rw-r--r--xmake/core/tool/linker.lua19
-rw-r--r--xmake/modules/private/action/build/link_objects.lua6
2 files changed, 4 insertions, 21 deletions
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index a0ae27641..802a7c65f 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -67,21 +67,6 @@ function linker:_add_flags_from_linker(flags)
end
end
--- add implib-dir to the options
-function linker:_add_implib_to_options(opt)
- opt = opt or {}
- if not opt.implib then
- local target = self:target()
- if target:type() == "target" then
- local impblibfile = target:implibfile()
- if impblibfile then
- opt.implib = impblibfile
- end
- end
- end
- return opt
-end
-
-- load tool
function linker._load_tool(targetkind, sourcekinds, target)
@@ -244,8 +229,6 @@ function linker:link(objectfiles, targetfile, opt)
opt = table.copy(opt)
opt.target = self:target()
- opt = self:_add_implib_to_options(opt)
-
profiler:enter(self:name(), "link", targetfile)
local ok, errors = sandbox.load(self:_tool().link, self:_tool(), table.wrap(objectfiles), self:_targetkind(), targetfile, linkflags, opt)
profiler:leave(self:name(), "link", targetfile)
@@ -254,13 +237,11 @@ end
-- get the link arguments list
function linker:linkargv(objectfiles, targetfile, opt)
- opt = self:_add_implib_to_options(opt)
return self:_tool():linkargv(table.wrap(objectfiles), self:_targetkind(), targetfile, opt.linkflags or self:linkflags(opt), opt)
end
-- get the link command
function linker:linkcmd(objectfiles, targetfile, opt)
- opt = self:_add_implib_to_options(opt)
return os.args(table.join(self:linkargv(objectfiles, targetfile, opt)))
end
diff --git a/xmake/modules/private/action/build/link_objects.lua b/xmake/modules/private/action/build/link_objects.lua
index 396896d00..31e41ca6f 100644
--- a/xmake/modules/private/action/build/link_objects.lua
+++ b/xmake/modules/private/action/build/link_objects.lua
@@ -48,11 +48,13 @@ function _do_link_target(target, opt)
local verbose = option.get("verbose")
if verbose then
-- show the full link command with raw arguments, it will expand @xxx.args for msvc/link on windows
- print(linkinst:linkcmd(objectfiles, targetfile, {linkflags = linkflags, rawargs = true}))
+ print(linkinst:linkcmd(objectfiles, targetfile, {linkflags = linkflags, implib = target:implibfile(), rawargs = true}))
end
+ print("TO LINK: ", target:name(), target:implibfile(), targetfile)
+
if not dryrun then
- assert(linkinst:link(objectfiles, targetfile, {linkflags = linkflags}))
+ assert(linkinst:link(objectfiles, targetfile, {linkflags = linkflags, implib = target:implibfile()}))
end
end, {dependfile = target:dependfile(),
lastmtime = os.mtime(target:targetfile()),