summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-14 22:29:08 +0800
committerruki <[email protected]>2022-01-14 22:29:08 +0800
commite628a134af84c81f725bb63bcfe0b6b3245e7da6 (patch)
tree9d6378512be5ad0cacfd173f6ba95ddef7eb50a9
parentd5687e7feccd26d28e94b4b6725e7acd3cd3e688 (diff)
add rdc for cuda
-rw-r--r--xmake/rules/cuda/env/xmake.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua
index 96d587e41..d36482901 100644
--- a/xmake/rules/cuda/env/xmake.lua
+++ b/xmake/rules/cuda/env/xmake.lua
@@ -22,11 +22,8 @@
rule("cuda.env")
on_load(function (target)
-
- -- imports
import("detect.sdks.find_cuda")
- -- find cuda sdk first
local cuda = assert(find_cuda(nil, {verbose = true}), "Cuda SDK not found!")
if cuda then
target:data_set("cuda", cuda)
@@ -34,15 +31,13 @@ rule("cuda.env")
end)
after_load(function (target)
-
- -- imports
import("core.platform.platform")
-- get cuda sdk
local cuda = assert(target:data("cuda"), "Cuda SDK not found!")
-- add arch
- if is_arch("i386", "x86") then
+ if target:is_arch("i386", "x86") then
target:add("cuflags", "-m32", {force = true})
target:add("culdflags", "-m32", {force = true})
else
@@ -56,6 +51,11 @@ rule("cuda.env")
target:add("culdflags", "-ccbin=" .. os.args(cu_ccbin), {force = true})
end
+ -- add rdc, @see https://github.com/xmake-io/xmake/issues/1975
+ if target:values("cuda.rdc") ~= false then
+ target:add("cuflags", "-rdc=true")
+ end
+
-- add links
target:add("syslinks", "cudadevrt")
local cudart = false
@@ -68,7 +68,7 @@ rule("cuda.env")
if not cudart then
target:add("syslinks", "cudart_static")
end
- if is_plat("linux") then
+ if target:is_plat("linux") then
target:add("syslinks", "rt", "pthread", "dl")
end
target:add("linkdirs", cuda.linkdirs)