summaryrefslogtreecommitdiff
path: root/xmake/rules/cuda/devlink
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-18 08:28:35 +0800
committerOpportunityLiu <[email protected]>2019-06-18 08:28:35 +0800
commit9c8b83a61fce275edd3808c54f36ba368378fa5d (patch)
tree13c33fc09353745d706bfccbc7e7fba9531b24ce /xmake/rules/cuda/devlink
parent284857c1a43ce61a9f5433d88414e539f2bdc02a (diff)
Support clang as cuda compiler
Diffstat (limited to 'xmake/rules/cuda/devlink')
-rw-r--r--xmake/rules/cuda/devlink/xmake.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/xmake/rules/cuda/devlink/xmake.lua b/xmake/rules/cuda/devlink/xmake.lua
index 0416b9abe..2d4644781 100644
--- a/xmake/rules/cuda/devlink/xmake.lua
+++ b/xmake/rules/cuda/devlink/xmake.lua
@@ -26,16 +26,21 @@ rule("cuda.devlink")
-- @see https://devblogs.nvidia.com/separate-compilation-linking-cuda-device-code/
before_link(function (target, opt)
+ import("core.platform.platform")
-- disable devlink?
+ -- local cu_tool, cu_toolname = platform.tool("cu")
+ -- if (cu_toolname or path.basename(cu_tool)) ~= "nvcc" then
+ -- return
+ -- end
if target:values("cuda.devlink") == false then
- return
+ return
end
-- only for binary/shared
local targetkind = target:targetkind()
if targetkind ~= "binary" and targetkind ~= "shared" then
- return
+ return
end
-- imports
@@ -50,6 +55,8 @@ rule("cuda.devlink")
-- init culdflags
local culdflags = {"-dlink"}
+
+ -- add shared flag
if targetkind == "shared" then
table.insert(culdflags, "-shared")
end