summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2018-12-20 23:55:49 +0800
committerruki <[email protected]>2018-12-20 17:34:56 +0800
commitd95758dc85e1e34e6ce507ffee78f7634a0661c5 (patch)
treef740966dedf5eea54bf54c4f7d379fcfa012034a /xmake/modules
parentcbce3651b8baff9d4cad89b3056e629c9ace4a41 (diff)
add flagkind to has_flags
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/cl.lua6
-rw-r--r--xmake/modules/core/tools/gcc.lua6
-rw-r--r--xmake/modules/core/tools/nvcc.lua4
-rw-r--r--xmake/modules/lib/detect/has_flags.lua2
4 files changed, 9 insertions, 9 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index e2434d0ec..a05add33e 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -105,7 +105,7 @@ function nf_symbol(self, level, target)
-- check and add symbol output file
flags = "-Zi -Fd" .. target:symbolfile()
- if self:has_flags({"-Zi", "-FS", "-Fd" .. os.tmpfile() .. ".pdb"}) then
+ if self:has_flags({"-Zi", "-FS", "-Fd" .. os.tmpfile() .. ".pdb"}, "cxflags") then
flags = "-FS " .. flags
end
else
@@ -165,7 +165,7 @@ function nf_vectorext(self, extension)
-- check it
local flag = maps[extension]
- if flag and self:has_flags(flag) then
+ if flag and self:has_flags(flag, "cxflags") then
return flag
end
end
@@ -215,7 +215,7 @@ function nf_language(self, stdname)
local flag = maps[stdname]
-- not support it?
- if flag and flag:find("std:c++", 1, true) and not self:has_flags(flag) then
+ if flag and flag:find("std:c++", 1, true) and not self:has_flags(flag, "cxflags") then
return
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 278df4451..89773c85c 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -254,12 +254,12 @@ end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
- if self:has_flags("-Wl,-rpath=" .. dir) then
+ if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
return "-Wl,-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
end))
- elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir) then
+ elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir, "ldflags") then
return "-Xlinker -rpath -Xlinker " .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
end
end
@@ -330,7 +330,7 @@ function _include_deps(self, sourcefile, flags)
-- support -E -MM? some old gcc does not support it at same time
if _g._HAS_EMM == nil then
- _g._HAS_EMM = self:has_flags("-E -MM")
+ _g._HAS_EMM = self:has_flags("-E -MM", "cxflags")
end
if not _g._HAS_EMM then
return {}
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index dbbf5476d..8e64b6704 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -134,12 +134,12 @@ end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
- if self:has_flags("-Wl,-rpath=" .. dir) then
+ if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
return "-Wl,-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
end))
- elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir) then
+ elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir, "ldflags") then
return "-Xlinker -rpath -Xlinker " .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
end
end
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index 4f3d42eab..9245b3f30 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -87,7 +87,7 @@ function main(name, flags, opt)
local arch = config.get("arch") or os.arch()
-- init cache key
- local key = plat .. "_" .. arch .. "_" .. tool.program .. "_" .. (tool.version or "") .. "_" .. (opt.toolkind or "") .. "_" .. table.concat(flags, " ")
+ local key = plat .. "_" .. arch .. "_" .. tool.program .. "_" .. (tool.version or "") .. "_" .. (opt.toolkind or "") .. "_" .. (opt.flagkind or "") .. "_" .. table.concat(flags, " ")
-- @note avoid detect the same program in the same time if running in the coroutine (.e.g ccache)
local coroutine_running = coroutine.running()