summaryrefslogtreecommitdiff
path: root/xmake/platforms/linux
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/platforms/linux')
-rw-r--r--xmake/platforms/linux/config.lua12
-rw-r--r--xmake/platforms/linux/load.lua4
2 files changed, 15 insertions, 1 deletions
diff --git a/xmake/platforms/linux/config.lua b/xmake/platforms/linux/config.lua
index fb1ae10a2..60cc98676 100644
--- a/xmake/platforms/linux/config.lua
+++ b/xmake/platforms/linux/config.lua
@@ -78,12 +78,13 @@ function _toolchains()
local cu = toolchain("the cuda compiler")
local cu_ld = toolchain("the cuda linker")
local cu_sh = toolchain("the cuda shared library linker")
+ local cu_cxx = toolchain("the cuda host c++ compiler")
local toolchains = {cc = cc, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex,
mm = mm, mxx = mxx,
gc = gc, ["gc-ld"] = gc_ld, ["gc-ar"] = gc_ar,
dc = dc, ["dc-ld"] = dc_ld, ["dc-sh"] = dc_sh, ["dc-ar"] = dc_ar,
rc = rc, ["rc-ld"] = rc_ld, ["rc-sh"] = rc_sh, ["rc-ar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld, ["cu-sh"] = cu_sh}
+ cu = cu, ["cu-ld"] = cu_ld, ["cu-sh"] = cu_sh, ["cu-cxx"] = cu_cxx}
-- init the c compiler
cc:add("$(env CC)", {name = "gcc", cross = cross}, {name = "clang", cross = cross})
@@ -149,6 +150,9 @@ function _toolchains()
cu:add("nvcc")
cu_ld:add("nvcc")
cu_sh:add("nvcc")
+ if not cross or cross == "" then
+ cu_cxx:add("$(env CXX)", "$(env CC)", "gcc", "clang", "g++", "clang++")
+ end
return toolchains
end
@@ -169,6 +173,12 @@ function main(platform, name)
-- check cuda
check_cuda(config)
+
+ -- check cu-cxx after checking arch
+ if config.get("cuda") then
+ local toolchains = singleton.get("linux.toolchains", _toolchains)
+ check_toolchain(config, "cu-cxx", toolchains["cu-cxx"])
+ end
end
end
diff --git a/xmake/platforms/linux/load.lua b/xmake/platforms/linux/load.lua
index 622d59200..b9ff210b1 100644
--- a/xmake/platforms/linux/load.lua
+++ b/xmake/platforms/linux/load.lua
@@ -90,5 +90,9 @@ function main(platform)
platform:add("cu-shflags", "-L" .. os.args(path.join(cuda_dir, "lib")))
platform:add("cu-ldflags", "-Xlinker -rpath=" .. os.args(path.join(cuda_dir, "lib")))
end
+ local cu_cxx = config.get("cu-cxx")
+ if cu_cxx then
+ platform:add("cuflags", "-ccbin", os.args(cu_cxx))
+ end
end