From b93b3d0cc8241e099fc508ffb1f9dace6ab8586a Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Thu, 4 Jul 2019 16:10:05 +0800 Subject: add Fd flags for nvcc on windows --- xmake/modules/core/tools/nvcc.lua | 40 +++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index e72857a93..3d86660f8 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -57,16 +57,40 @@ function init(self) end -- make the symbol flag -function nf_symbol(self, level) +function nf_symbol(self, level, target) + + -- debug? generate *.pdb file + local flags = nil + if level == "debug" then + flags = "-g -G" + if is_plat("windows") then + local host_flags = nil + local symbolfile = nil + if target and target.symbolfile then + symbolfile = target:symbolfile() + end + if symbolfile then - -- the maps - local maps = - { - debug = "-g -G" - } + -- ensure the object directory + local symboldir = path.directory(symbolfile) + if not os.isdir(symboldir) then + os.mkdir(symboldir) + end - -- make it - return maps[level] + -- check and add symbol output file + host_flags = "-Zi -Fd" .. target:symbolfile() + if self:has_flags({'-Xcompiler "-Zi -FS -Fd' .. os.tmpfile() .. '.pdb"'}, "cuflags") then + host_flags = "-FS " .. host_flags + end + else + host_flags = "-Zi" + end + flags = flags .. ' -Xcompiler "' .. host_flags .. '"' + end + end + + -- none + return flags end -- make the warning flag -- cgit v1.3.1