summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2020-08-10 13:15:37 +0800
committerGitHub <[email protected]>2020-08-10 13:15:37 +0800
commit894b90a805a445dd9d882ffd434a73f0fa22197c (patch)
tree603478d7ac0971586a5c026f00d09a2c0a056f24 /xmake/modules
parent3cbe41e25b7a3dd0872daa9ea87ba786a9dc2df8 (diff)
parent084e01a6ac7961fa650aba9cdc06502e4bd88b2c (diff)
Merge pull request #918 from OpportunityLiu/cuda-update
Cuda update
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/nvcc.lua1
-rw-r--r--xmake/modules/detect/tools/nvcc/has_flags.lua28
-rw-r--r--xmake/modules/lib/detect/find_cudadevices.lua1
3 files changed, 24 insertions, 6 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 6aab1225d..24209e228 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -33,6 +33,7 @@ function init(self)
-- init cuflags
if not is_plat("windows", "mingw") then
self:set("shared.cuflags", "-Xcompiler -fPIC")
+ self:set("binary.cuflags", "-Xcompiler -fPIE")
end
-- add -ccbin
diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua
index 8cbffc010..2929f67bd 100644
--- a/xmake/modules/detect/tools/nvcc/has_flags.lua
+++ b/xmake/modules/detect/tools/nvcc/has_flags.lua
@@ -112,12 +112,24 @@ function _check_try_running(flags, opt, islinker)
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
end
- -- check flags
- if islinker then
- return _try_running(opt.program, table.join(flags, "-o", os.nuldev(), sourcefile))
- else
- return _try_running(opt.program, table.join(flags, "-c", "-o", os.nuldev(), sourcefile))
+ local args = table.join("-o", os.nuldev(), sourcefile)
+
+ if not islinker then
+ table.insert(args, 1, "-c")
+ end
+
+ -- avoid recursion
+ if flags[1] ~= "-allow-unsupported-compiler" then
+ -- add -allow-unsupported-compiler if supported to suppress error of unsupported compiler,
+ -- which caused all checks failed.
+ local allow_unsupported_compiler = _has_flags({"-allow-unsupported-compiler"}, opt)
+ if allow_unsupported_compiler then
+ table.insert(args, 1, "-allow-unsupported-compiler")
+ end
end
+
+ -- check flags
+ return _try_running(opt.program, table.join(flags, args))
end
-- has_flags(flags)?
@@ -126,7 +138,7 @@ end
--
-- @return true or false
--
-function main(flags, opt)
+function _has_flags(flags, opt)
-- is linker?
local islinker = _islinker(flags, opt)
@@ -140,3 +152,7 @@ function main(flags, opt)
return _check_try_running(flags, opt, islinker)
end
+function main(...)
+ return _has_flags(...)
+end
+
diff --git a/xmake/modules/lib/detect/find_cudadevices.lua b/xmake/modules/lib/detect/find_cudadevices.lua
index bd1bb72bc..98ae81e6d 100644
--- a/xmake/modules/lib/detect/find_cudadevices.lua
+++ b/xmake/modules/lib/detect/find_cudadevices.lua
@@ -238,6 +238,7 @@ function _order_by_flops(devices)
, [70] = 64
, [72] = 64
, [75] = 64
+ , [80] = 64
}
for _, dev in ipairs(devices) do