summaryrefslogtreecommitdiff
path: root/xmake/core/tool/linker.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-09 15:08:28 +0800
committerruki <[email protected]>2016-07-09 15:08:28 +0800
commit9feb387e4e4e6694b2c9ac3de4d517fb4c4ae44a (patch)
tree9581332e5365025b5663c3c48f223a9dfd6f415c /xmake/core/tool/linker.lua
parent460030d64886772601749b874f06fe536f1d3fd5 (diff)
fix install directory and modify compiler and linker interfaces
Diffstat (limited to 'xmake/core/tool/linker.lua')
-rw-r--r--xmake/core/tool/linker.lua29
1 files changed, 21 insertions, 8 deletions
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index e0959702c..41ce9bfd3 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -195,7 +195,7 @@ function linker:_addflags_from_target(flags, target)
-- add the links flags
for _, link in ipairs(table.wrap(target:get("links"))) do
- table.join2(flags, self:link(link))
+ table.join2(flags, self:linklib(link))
end
-- for target options?
@@ -214,7 +214,7 @@ function linker:_addflags_from_target(flags, target)
-- add the links flags from the option
for _, link in ipairs(table.wrap(opt:get("links"))) do
- table.join2(flags, self:link(link))
+ table.join2(flags, self:linklib(link))
end
end
end
@@ -238,7 +238,7 @@ function linker:_addflags_from_platform(flags)
-- add the links flags
for _, link in ipairs(table.wrap(platform.get("links"))) do
- table.join2(flags, self:link(link))
+ table.join2(flags, self:linklib(link))
end
end
@@ -332,8 +332,21 @@ function linker:get(name)
return self:_tool().get(name)
end
+-- link the target file
+function linker:link(objectfiles, targetfile, target)
+
+ -- get flags
+ local flags = nil
+ if target then
+ flags = self:_flags(target)
+ end
+
+ -- get it
+ return sandbox.load(self:_tool().link, table.concat(table.wrap(objectfiles), " "), targetfile, flags or "")
+end
+
-- get the link command
-function linker:linkcmd(objfiles, targetfile, target)
+function linker:linkcmd(objectfiles, targetfile, target)
-- get flags
local flags = nil
@@ -342,14 +355,14 @@ function linker:linkcmd(objfiles, targetfile, target)
end
-- get it
- return self:_tool().linkcmd(table.concat(table.wrap(objfiles), " "), targetfile, flags or "")
+ return self:_tool().linkcmd(table.concat(table.wrap(objectfiles), " "), targetfile, flags or "")
end
--- make the link flag
-function linker:link(lib)
+-- make the linklib flag
+function linker:linklib(lib)
-- make it
- return self:_tool().link(lib)
+ return self:_tool().linklib(lib)
end
-- make the linkdir flag