diff options
| author | OpportunityLiu <[email protected]> | 2019-05-21 10:17:05 +0800 |
|---|---|---|
| committer | OpportunityLiu <[email protected]> | 2019-05-21 10:17:05 +0800 |
| commit | 29cd3ffaf30a04875672d2f752d1b252030e965f (patch) | |
| tree | eb7524728d5a9110ac29dd381bb74011c0ef83ca | |
| parent | 7ed7da5e9b333930081b50ff3781ea0a07417a1b (diff) | |
improve nvcc warning settings
| -rw-r--r-- | xmake/modules/core/tools/nvcc.lua | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 543d5d5a4..79a7c8019 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -40,9 +40,10 @@ function init(self) self:set("mapflags", { -- warnings - ["-W1"] = "-Wall" - , ["-W2"] = "-Wall" - , ["-W3"] = "-Wall" + ["-W1"] = "" + , ["-W2"] = "" + , ["-W3"] = "" + , ["-W4"] = "-Wreorder" }) -- init buildmodes @@ -72,25 +73,43 @@ function nf_warning(self, level) local maps = { none = "-w" + , less = "" + , more = "" + , all = "" , extra = "-Wreorder" , everything = "-Wreorder" , error = "-Werror" } + + local cl_maps = + { + none = "-W0" + , less = "-W1" + , more = "-W3" + , all = "-W3" -- = "-Wall" will enable too more warnings + , extra = "-W4" + , everything = "-Wall" + , error = "-WX" + } + + local gcc_clang_maps = + { + none = "-w" + , less = "-Wall" + , more = "-Wall" + , all = "-Wall" + , extra = "-Wextra" + , everything = "-Weverything -Wall -Wextra -Weffc++" -- gcc dosen't support `-Weverything`, use `-Wall -Wextra -Weffc++` for it + , error = "-Werror" + } local warning = maps[level] - if not warning then -- for cl.exe - if is_plat("windows") then - maps.less = "-Xcompiler -W1" - maps.more = "-Xcompiler -W3" - maps.all = "-Xcompiler -W3" - -- for gcc/clang - elseif self:has_flags("-Xcompiler -Wall", "cxflags") then - maps.less = "-Xcompiler -Wall" - maps.more = "-Xcompiler -Wall" - maps.all = "-Xcompiler -Wall" - end - warning = maps[level] + if is_plat("windows") then + warning = warning .. ' -Xcompiler "' .. cl_maps[level] .. '"' + -- for gcc/clang + elseif self:has_flags("-Xcompiler -Wall", "cxflags") then + warning = warning .. ' -Xcompiler "' .. gcc_clang_maps[level] .. '"' end return warning end |
