diff options
| author | ruki <[email protected]> | 2016-11-07 22:48:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-11-07 22:48:41 +0800 |
| commit | d59184e0fdb61ba2ac326da945e2fa41c412384a (patch) | |
| tree | ca2fa5c216f3b0cf6862abd8126ed3ed44ddf41c /xmake/core/tool/linker.lua | |
| parent | c2f463a161a717fb71ee12281e6715dfcff276e2 (diff) | |
add configure arguments
Diffstat (limited to 'xmake/core/tool/linker.lua')
| -rw-r--r-- | xmake/core/tool/linker.lua | 69 |
1 files changed, 54 insertions, 15 deletions
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 19430f908..418a150ab 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -126,6 +126,11 @@ function linker:_addflags_from_config(flags) -- done table.join2(flags, config.get(self:_flagname())) + + -- add the linkdirs flags + for _, linkdir in ipairs(table.wrap(config.get("linkdirs"))) do + table.join2(flags, self:linkdir(linkdir)) + end end -- add flags from the target @@ -139,11 +144,6 @@ function linker:_addflags_from_target(flags, target) table.join2(flags, self:linkdir(linkdir)) end - -- add the links flags - for _, link in ipairs(table.wrap(target:get("links"))) do - table.join2(flags, self:linklib(link)) - end - -- for target options? if target.options then @@ -157,11 +157,6 @@ function linker:_addflags_from_target(flags, target) for _, linkdir in ipairs(table.wrap(opt:get("linkdirs"))) do table.join2(flags, self:linkdir(linkdir)) end - - -- add the links flags from the option - for _, link in ipairs(table.wrap(opt:get("links"))) do - table.join2(flags, self:linklib(link)) - end end end @@ -189,11 +184,6 @@ function linker:_addflags_from_platform(flags) for _, linkdir in ipairs(table.wrap(platform.get("linkdirs"))) do table.join2(flags, self:linkdir(linkdir)) end - - -- add the links flags - for _, link in ipairs(table.wrap(platform.get("links"))) do - table.join2(flags, self:linklib(link)) - end end -- add flags from the compiler @@ -221,6 +211,46 @@ function linker:_addflags_from_linker(flags) table.join2(flags, self:get(self:_flagname())) end +-- add links from the configure +function linker:_addlinks_from_config(flags) + + -- add the links flags + for _, link in ipairs(table.wrap(config.get("links"))) do + table.join2(flags, self:linklib(link)) + end +end + +-- add links from the target +function linker:_addlinks_from_target(flags, target) + + -- add the links flags + for _, link in ipairs(table.wrap(target:get("links"))) do + table.join2(flags, self:linklib(link)) + end + + -- for target options? + if target.options then + + -- add the flags for the target options + for _, opt in ipairs(target:options()) do + + -- add the links flags from the option + for _, link in ipairs(table.wrap(opt:get("links"))) do + table.join2(flags, self:linklib(link)) + end + end + end +end + +-- add links from the platform +function linker:_addlinks_from_platform(flags) + + -- add the links flags + for _, link in ipairs(table.wrap(platform.get("links"))) do + table.join2(flags, self:linklib(link)) + end +end + -- get the current kind function linker:kind() @@ -333,6 +363,15 @@ function linker:linkflags(target) -- add flags from the linker self:_addflags_from_linker(flags) + -- add links from the configure + self:_addlinks_from_config(flags) + + -- add links from the target + self:_addlinks_from_target(flags, target) + + -- add flags from the platform + self:_addlinks_from_platform(flags) + -- remove repeat flags = table.unique(flags) |
