diff options
| author | ruki <[email protected]> | 2019-04-03 22:18:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-04-03 07:51:38 +0800 |
| commit | adbcc87f0699702c32fa8dc63aa8aafaa1deca9d (patch) | |
| tree | e0bc6b981218c77081878e2ec1ff0d14296c3c01 /xmake/core/tool/linker.lua | |
| parent | 09a1f710f009c7b90deea8a0e2c788551c03e66c (diff) | |
improve linker
Diffstat (limited to 'xmake/core/tool/linker.lua')
| -rw-r--r-- | xmake/core/tool/linker.lua | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 1046d204b..4aea7740c 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -54,35 +54,6 @@ function linker:_add_flags_from_platform(flags, targetkind) end end --- add flags from the compiler -function linker:_add_flags_from_compiler(flags, target, targetkind) - - -- make flags - local flags_of_compiler = {} - local toolkind = self:kind() - local toolname = self:name() - for _, sourcekind in ipairs(self._SOURCEKINDS) do - - -- load compiler - local instance, errors = compiler.load(sourcekind, target) - if instance then - for _, flagkind in ipairs(self:_flagkinds()) do - - -- attempt to add special lanugage flags first, e.g. gcc.ldflags, gc-ldflags, dc-arflags - local toolflags = instance:get(toolname .. '.' .. toolkind .. 'flags') or instance:get(toolname .. '.' .. flagkind) - table.join2(flags_of_compiler, toolflags or instance:get(toolkind .. 'flags') or instance:get(flagkind)) - - -- attempt to add special lanugage flags first for target kind, e.g. targetkind.gcc.ldflags, targetkind.gc-ldflags, targetkind.dc-arflags - if targetkind then - toolflags = instance:get(targetkind .. '.' .. toolname .. '.' .. toolkind .. 'flags') or instance:get(targetkind .. '.' .. toolname .. '.' .. flagkind) - table.join2(flags_of_compiler, toolflags or instance:get(targetkind .. '.' .. toolkind .. 'flags') or instance:get(targetkind .. '.' .. flagkind)) - end - end - end - end - table.join2(flags, flags_of_compiler) -end - -- add flags from the linker function linker:_add_flags_from_linker(flags) @@ -204,9 +175,6 @@ function linker.load(targetkind, sourcekinds, target) -- init target kind instance._TARGETKIND = targetkind - -- init source kinds - instance._SOURCEKINDS = sourcekinds - -- init flag kinds instance._FLAGKINDS = {linkerinfo.linkerflag} @@ -278,10 +246,11 @@ function linker:linkflags(opt) -- add flags from the platform self:_add_flags_from_platform(flags, targetkind) + --[[ -- add flags from the compiler if target then self:_add_flags_from_compiler(flags, target, targetkind) - end + end]] -- add flags from the linker self:_add_flags_from_linker(flags) |
