summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/nvcc.lua
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-07-04 16:10:05 +0800
committerOpportunityLiu <[email protected]>2019-07-04 16:10:05 +0800
commitb93b3d0cc8241e099fc508ffb1f9dace6ab8586a (patch)
tree3b94cf12c1163a0be8e076cdaef7a273ae523eea /xmake/modules/core/tools/nvcc.lua
parentdb0b2ae6096ea05dc990ac7d975e194cca75035e (diff)
add Fd flags for nvcc on windows
Diffstat (limited to 'xmake/modules/core/tools/nvcc.lua')
-rw-r--r--xmake/modules/core/tools/nvcc.lua40
1 files 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)
- -- the maps
- local maps =
- {
- debug = "-g -G"
- }
+ -- 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
- -- make it
- return maps[level]
+ -- ensure the object directory
+ local symboldir = path.directory(symbolfile)
+ if not os.isdir(symboldir) then
+ os.mkdir(symboldir)
+ end
+
+ -- 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