From f01ed0a230e0bbf93e53551df27d8c6170a689c4 Mon Sep 17 00:00:00 2001 From: Aurorabili Date: Mon, 4 Nov 2024 10:02:26 +0000 Subject: [PATCH] fix: #5777 Remove -G and -lineinfo and add them in mode.debug and mode.profile respectively Signed-off-by: Aurorabili --- xmake/modules/core/tools/nvcc.lua | 4 +++- xmake/rules/mode/xmake.lua | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index a7ef324f3fb..fdb30563193 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -52,7 +52,9 @@ function nf_symbol(self, level, opt) -- debug? generate *.pdb file local flags = nil if level == "debug" then - flags = {"-G", "-g", "-lineinfo"} + -- #5777: '--device-debug (-G)' overrides '--generate-line-info (-lineinfo)' in nvcc + -- remove '-G' and '-lineinfo' and add them in mode.debug and mode.profile respectively + flags = {"-g"} if self:is_plat("windows") then local host_flags = nil local symbolfile = nil diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua index 8644f60f43f..f554ce93d58 100644 --- a/xmake/rules/mode/xmake.lua +++ b/xmake/rules/mode/xmake.lua @@ -34,6 +34,9 @@ rule("mode.debug") if not target:get("optimize") then target:set("optimize", "none") end + + -- #5777: '--device-debug (-G)' overrides '--generate-line-info (-lineinfo)' in nvcc + target:add("cuflags", "-G") end end) @@ -158,6 +161,9 @@ rule("mode.profile") -- enable NDEBUG macros to disables standard-C assertions target:add("cxflags", "-DNDEBUG") target:add("cuflags", "-DNDEBUG") + + -- #5777: '--device-debug (-G)' overrides '--generate-line-info (-lineinfo)' in nvcc + target:add("cuflags", "-lineinfo") end end)