summaryrefslogtreecommitdiff
path: root/xmake/rules/cuda/env/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-06-11 00:54:39 +0800
committerruki <[email protected]>2019-06-10 23:27:58 +0800
commitf42f1b5a97f5fdbac4d74a2e43a32fcc71cee0c3 (patch)
tree4bd1cdcdc1f8db843720686133666bd9c0098d37 /xmake/rules/cuda/env/xmake.lua
parent9f81f22e0d241bfc6ddb2f5b55b75ddfbc3f6851 (diff)
improve cuda.env and ignore static kind
Diffstat (limited to 'xmake/rules/cuda/env/xmake.lua')
-rw-r--r--xmake/rules/cuda/env/xmake.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua
index a4d408d2d..1acbc08ba 100644
--- a/xmake/rules/cuda/env/xmake.lua
+++ b/xmake/rules/cuda/env/xmake.lua
@@ -25,7 +25,6 @@ rule("cuda.env")
-- get cuda sdk
import("detect.sdks.find_cuda")
local cuda = assert(find_cuda(nil, {verbose = true}), "Cuda SDK not found!")
- target:data_set("cuda", cuda)
-- add arch
if is_arch("i386", "x86") then
@@ -43,6 +42,24 @@ rule("cuda.env")
target:add("culdflags", "-ccbin", os.args(cu_ccbin), {force = true})
end
+ -- add links
+ target:add("syslinks", "cudadevrt")
+ local cudart = false
+ for _, link in ipairs(table.join(target:get("links") or {}, target:get("syslinks"))) do
+ if link == "cudart" or link == "cudart_static" then
+ cudart = true
+ break
+ end
+ end
+ if not cudart then
+ target:add("syslinks", "cudart_static")
+ end
+ if is_plat("linux") then
+ target:add("syslinks", "rt", "pthread", "dl")
+ end
+ target:add("linkdirs", cuda.linkdirs)
+ target:add("rpathdirs", cuda.linkdirs)
+
-- add includedirs
target:add("includedirs", cuda.includedirs)
end)