summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-22 00:58:20 +0800
committerruki <[email protected]>2024-02-22 00:58:20 +0800
commit2c97dacfe8490643fe6c8f488fea72350aa64945 (patch)
tree837d55cb521cbd4d7b09d320592376928681034c
parent76558d21fd3277f5f8d7c43c69d0b24f68ca4acd (diff)
improve ccbin #4755
-rw-r--r--xmake/modules/core/tools/nvcc.lua9
-rw-r--r--xmake/rules/cuda/env/xmake.lua6
-rw-r--r--xmake/rules/cuda/xmake.lua8
3 files changed, 9 insertions, 14 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 127f51656..a7ef324f3 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -37,15 +37,8 @@ function init(self)
self:set("binary.cuflags", "-Xcompiler -fPIE")
end
- -- add -ccbin
- local cu_ccbin = platform.tool("cu-ccbin")
- if cu_ccbin then
- self:add("cuflags", "-ccbin=" .. os.args(cu_ccbin))
- end
-
-- init flags map
- self:set("mapflags",
- {
+ self:set("mapflags", {
-- warnings
["-W4"] = "-Wreorder --Wno-deprecated-gpu-targets --Wno-deprecated-declarations"
, ["-Wextra"] = "-Wreorder --Wno-deprecated-gpu-targets --Wno-deprecated-declarations"
diff --git a/xmake/rules/cuda/env/xmake.lua b/xmake/rules/cuda/env/xmake.lua
index 69a3dee1c..b57151f9f 100644
--- a/xmake/rules/cuda/env/xmake.lua
+++ b/xmake/rules/cuda/env/xmake.lua
@@ -43,12 +43,6 @@ rule("cuda.env")
target:add("culdflags", "-m64", {force = true})
end
- -- add ccbin
- local cu_ccbin = platform.tool("cu-ccbin")
- if cu_ccbin then
- 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")
diff --git a/xmake/rules/cuda/xmake.lua b/xmake/rules/cuda/xmake.lua
index 543df54b8..334f569f1 100644
--- a/xmake/rules/cuda/xmake.lua
+++ b/xmake/rules/cuda/xmake.lua
@@ -23,6 +23,14 @@ rule("cuda.build")
set_sourcekinds("cu")
add_deps("cuda.build.devlink")
on_build_files("private.action.build.object", {batch = true})
+ on_config(function (target)
+ -- https://github.com/xmake-io/xmake/issues/4755
+ local cu_ccbin = target:tool("cu-ccbin")
+ if cu_ccbin then
+ target:add("cuflags", "-ccbin=" .. os.args(cu_ccbin), {force = true})
+ target:add("culdflags", "-ccbin=" .. os.args(cu_ccbin), {force = true})
+ end
+ end)
-- define rule: cuda
rule("cuda")