summaryrefslogtreecommitdiff
path: root/xmake/core/tool/linker.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-04-03 00:48:49 +0800
committerruki <[email protected]>2019-04-02 22:52:56 +0800
commit09a1f710f009c7b90deea8a0e2c788551c03e66c (patch)
tree352fefed6af060924cc665b4aa59f92b2f43b1bd /xmake/core/tool/linker.lua
parent7175aa15a46eb6c6c8b87755719d39fbd904d983 (diff)
fix -fPIC for nvcc
Diffstat (limited to 'xmake/core/tool/linker.lua')
-rw-r--r--xmake/core/tool/linker.lua22
1 files changed, 9 insertions, 13 deletions
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index 6d8eff546..1046d204b 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -43,7 +43,7 @@ local compiler = require("tool/compiler")
-- add flags from the platform
function linker:_add_flags_from_platform(flags, targetkind)
- -- attempt to add special lanugage flags first for target kind, .e.g binary.gc-ldflags, static.dc-arflags
+ -- attempt to add special lanugage flags first for target kind, .e.g binary.go.gc-ldflags, static.dc-arflags
if targetkind then
local toolkind = self:kind()
local toolname = self:name()
@@ -60,6 +60,7 @@ 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
@@ -67,24 +68,19 @@ function linker:_add_flags_from_compiler(flags, target, targetkind)
if instance then
for _, flagkind in ipairs(self:_flagkinds()) do
- -- attempt to add special lanugage flags first, e.g. gc-ldflags, dc-arflags
- table.join2(flags_of_compiler, instance:get(toolkind .. 'flags') or instance:get(flagkind))
+ -- 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.gc-ldflags, targetkind.dc-arflags
+ -- attempt to add special lanugage flags first for target kind, e.g. targetkind.gcc.ldflags, targetkind.gc-ldflags, targetkind.dc-arflags
if targetkind then
- table.join2(flags_of_compiler, instance:get(targetkind .. '.' .. toolkind .. 'flags') or instance:get(targetkind .. '.' .. flagkind))
+ 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
-
- -- check the compiler flags in linker and add them
- for _, flag in ipairs(flags_of_compiler) do
- -- we need check flags first, see https://github.com/xmake-io/xmake/issues/379
- if self:has_flags(flag) then
- table.insert(flags, flag)
- end
- end
+ table.join2(flags, flags_of_compiler)
end
-- add flags from the linker