summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxq114 <[email protected]>2022-01-19 19:01:52 +0800
committerxq114 <[email protected]>2022-01-19 19:01:52 +0800
commit7f970bfabcc2413cda468a8dbc435607c9a82e37 (patch)
treece5870b2d5ebfab300732b3b069d10400c797666
parentc692e42656a2406d8c27f6503d1d7ef60b820abb (diff)
improve nvcc error output
-rw-r--r--xmake/modules/core/tools/nvcc.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 471d62532..507077e08 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -347,8 +347,18 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
-- try removing the old object file for forcing to rebuild this source file
os.tryrm(objectfile)
+ -- use nvcc/stdout as errors first from os.iorunv()
+ if type(errors) == "table" then
+ local errs = errors.stdout or ""
+ if #errs:trim() == 0 then
+ errs = errors.stderr or ""
+ end
+ errors = errs
+ else
+ errors = tostring(errors)
+ end
+
-- find the start line of error
- errors = tostring(errors)
local lines = errors:split("\n", {plain = true})
local start = 0
for index, line in ipairs(lines) do