summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-19 22:43:07 +0800
committerruki <[email protected]>2020-05-19 10:18:46 +0800
commit5ae55ab1f4233bd5a5f065a07763c1192b91341c (patch)
treed819c7f436cce9896c96a7a5a0ae15b9606688da
parent40f43fdf131b55639a8149a021394106eb8aef34 (diff)
add cuda toolchain
-rw-r--r--xmake/languages/cuda/xmake.lua4
-rw-r--r--xmake/platforms/bsd/check.lua2
-rw-r--r--xmake/platforms/cygwin/check.lua2
-rw-r--r--xmake/platforms/linux/check.lua2
-rw-r--r--xmake/platforms/macosx/xmake.lua3
-rw-r--r--xmake/platforms/msys/check.lua2
-rw-r--r--xmake/platforms/windows/check.lua2
-rw-r--r--xmake/toolchains/cuda/xmake.lua28
-rw-r--r--xmake/toolchains/dlang/xmake.lua8
-rw-r--r--xmake/toolchains/envs/xmake.lua3
-rw-r--r--xmake/toolchains/go/xmake.lua6
-rw-r--r--xmake/toolchains/rust/xmake.lua8
12 files changed, 47 insertions, 23 deletions
diff --git a/xmake/languages/cuda/xmake.lua b/xmake/languages/cuda/xmake.lua
index 60f36f098..535d652f2 100644
--- a/xmake/languages/cuda/xmake.lua
+++ b/xmake/languages/cuda/xmake.lua
@@ -28,7 +28,7 @@ language("cuda")
set_sourceflags {cu = "cuflags"}
-- set target kinds
- set_targetkinds {gpucode = "cu-ld", binary = "ld", static = "ar", shared = "sh"}
+ set_targetkinds {gpucode = "culd", binary = "ld", static = "ar", shared = "sh"}
-- set target flags
set_targetflags {gpucode = "culdflags", binary = "ldflags", static = "arflags", shared = "shflags"}
@@ -140,7 +140,7 @@ language("cuda")
{category = "Cross Complation Configuration/Compiler Configuration" }
, {nil, "cu", "kv", nil, "The Cuda Compiler" }
, {nil, "cu-ccbin", "kv", nil, "The Cuda Host C++ Compiler" }
- , {nil, "cu-ld", "kv", nil, "The Cuda Linker" }
+ , {nil, "culd", "kv", nil, "The Cuda Linker" }
, {category = "Cross Complation Configuration/Compiler Flags Configuration" }
, {nil, "cuflags", "kv", nil, "The Cuda Compiler Flags" }
diff --git a/xmake/platforms/bsd/check.lua b/xmake/platforms/bsd/check.lua
index 1eb8834ef..2422f3eb7 100644
--- a/xmake/platforms/bsd/check.lua
+++ b/xmake/platforms/bsd/check.lua
@@ -83,7 +83,7 @@ function _toolchains()
gc = gc, ["gcld"] = gc_ld, ["gcar"] = gc_ar,
dc = dc, ["dcld"] = dc_ld, ["dcsh"] = dc_sh, ["dcar"] = dc_ar,
rc = rc, ["rcld"] = rc_ld, ["rcsh"] = rc_sh, ["rcar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
+ cu = cu, ["culd"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
-- init the c compiler
cc:add("$(env CC)", {name = "clang", cross = cross}, {name = "gcc", cross = cross})
diff --git a/xmake/platforms/cygwin/check.lua b/xmake/platforms/cygwin/check.lua
index 3b1221387..22d8809ad 100644
--- a/xmake/platforms/cygwin/check.lua
+++ b/xmake/platforms/cygwin/check.lua
@@ -82,7 +82,7 @@ function _toolchains()
gc = gc, ["gcld"] = gc_ld, ["gcar"] = gc_ar,
dc = dc, ["dcld"] = dc_ld, ["dcsh"] = dc_sh, ["dcar"] = dc_ar,
rc = rc, ["rcld"] = rc_ld, ["rcsh"] = rc_sh, ["rcar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
+ cu = cu, ["culd"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
-- init the c compiler
cc:add("$(env CC)", {name = "gcc", cross = cross}, {name = "clang", cross = cross})
diff --git a/xmake/platforms/linux/check.lua b/xmake/platforms/linux/check.lua
index 1671ee0e9..0fee59e6d 100644
--- a/xmake/platforms/linux/check.lua
+++ b/xmake/platforms/linux/check.lua
@@ -83,7 +83,7 @@ function _toolchains()
gc = gc, ["gcld"] = gc_ld, ["gcar"] = gc_ar,
dc = dc, ["dcld"] = dc_ld, ["dcsh"] = dc_sh, ["dcar"] = dc_ar,
rc = rc, ["rcld"] = rc_ld, ["rcsh"] = rc_sh, ["rcar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
+ cu = cu, ["culd"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
-- init the c compiler
cc:add("$(env CC)", {name = "gcc", cross = cross}, {name = "clang", cross = cross})
diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua
index 887577575..8939fbc86 100644
--- a/xmake/platforms/macosx/xmake.lua
+++ b/xmake/platforms/macosx/xmake.lua
@@ -40,8 +40,7 @@ platform("macosx")
on_check("check")
-- set toolchains
--- set_toolchains("custom", "xcode", "clang", "gcc", "dlang", "rust", "go", "cuda")
- set_toolchains("envs", "xcode", "clang", "gcc", "dlang", "rust", "go")
+ set_toolchains("envs", "xcode", "clang", "gcc", "dlang", "rust", "go", "cuda")
-- set menu
set_menu {
diff --git a/xmake/platforms/msys/check.lua b/xmake/platforms/msys/check.lua
index 8c5a2dcdd..927e51e5d 100644
--- a/xmake/platforms/msys/check.lua
+++ b/xmake/platforms/msys/check.lua
@@ -82,7 +82,7 @@ function _toolchains()
gc = gc, ["gcld"] = gc_ld, ["gcar"] = gc_ar,
dc = dc, ["dcld"] = dc_ld, ["dcsh"] = dc_sh, ["dcar"] = dc_ar,
rc = rc, ["rcld"] = rc_ld, ["rcsh"] = rc_sh, ["rcar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
+ cu = cu, ["culd"] = cu_ld, ["cu-ccbin"] = cu_ccbin}
-- init the c compiler
cc:add("$(env CC)", {name = "gcc", cross = cross}, {name = "clang", cross = cross})
diff --git a/xmake/platforms/windows/check.lua b/xmake/platforms/windows/check.lua
index 55027ff6a..4503a35db 100644
--- a/xmake/platforms/windows/check.lua
+++ b/xmake/platforms/windows/check.lua
@@ -56,7 +56,7 @@ function _toolchains()
gc = gc, ["gcld"] = gc_ld, ["gcar"] = gc_ar,
dc = dc, ["dcld"] = dc_ld, ["dcsh"] = dc_sh, ["dcar"] = dc_ar,
rc = rc, ["rcld"] = rc_ld, ["rcsh"] = rc_sh, ["rcar"] = rc_ar,
- cu = cu, ["cu-ld"] = cu_ld}
+ cu = cu, ["culd"] = cu_ld}
-- init the c compiler
cc:add("cl.exe")
diff --git a/xmake/toolchains/cuda/xmake.lua b/xmake/toolchains/cuda/xmake.lua
new file mode 100644
index 000000000..884851581
--- /dev/null
+++ b/xmake/toolchains/cuda/xmake.lua
@@ -0,0 +1,28 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- define toolchain
+toolchain("cuda")
+
+ -- set toolsets
+ set_toolsets("cu", "nvcc", "clang")
+ set_toolsets("culd", "nvcc")
+ set_toolsets("cu-ccbin", "$(env CXX)", "$(env CC)", "clang", "gcc")
+
diff --git a/xmake/toolchains/dlang/xmake.lua b/xmake/toolchains/dlang/xmake.lua
index 984dae6df..783530b90 100644
--- a/xmake/toolchains/dlang/xmake.lua
+++ b/xmake/toolchains/dlang/xmake.lua
@@ -22,10 +22,10 @@
toolchain("dlang")
-- set toolsets
- set_toolsets("dc", "dmd", "ldc2", "gdc")
- set_toolsets("dcld", "dmd", "ldc2", "gdc")
- set_toolsets("dcsh", "dmd", "ldc2", "gdc")
- set_toolsets("dcar", "dmd", "ldc2", "gdc")
+ set_toolsets("dc", "$(env DC)", "dmd", "ldc2", "gdc")
+ set_toolsets("dcld", "$(env DC)", "dmd", "ldc2", "gdc")
+ set_toolsets("dcsh", "$(env DC)", "dmd", "ldc2", "gdc")
+ set_toolsets("dcar", "$(env DC)", "dmd", "ldc2", "gdc")
-- on load
on_load(function (toolchain)
diff --git a/xmake/toolchains/envs/xmake.lua b/xmake/toolchains/envs/xmake.lua
index 1fc043025..899802b8e 100644
--- a/xmake/toolchains/envs/xmake.lua
+++ b/xmake/toolchains/envs/xmake.lua
@@ -33,8 +33,5 @@ toolchain("envs")
set_toolsets("mm", "$(env MM)")
set_toolsets("mxx", "$(env MXX)")
set_toolsets("as", "$(env AS)")
- set_toolsets("dc", "$(env DC)")
set_toolsets("sc", "$(env SC)")
- set_toolsets("gc", "$(env GC)")
- set_toolsets("rc", "$(env RC)")
diff --git a/xmake/toolchains/go/xmake.lua b/xmake/toolchains/go/xmake.lua
index f7451a781..a5400302b 100644
--- a/xmake/toolchains/go/xmake.lua
+++ b/xmake/toolchains/go/xmake.lua
@@ -22,7 +22,7 @@
toolchain("go")
-- set toolsets
- set_toolsets("gc", "go", "gccgo")
- set_toolsets("gcld", "go", "gccgo")
- set_toolsets("gcar", "go", "gccgo")
+ set_toolsets("gc", "$(env GC)", "go", "gccgo")
+ set_toolsets("gcld", "$(env GC)", "go", "gccgo")
+ set_toolsets("gcar", "$(env GC)", "go", "gccgo")
diff --git a/xmake/toolchains/rust/xmake.lua b/xmake/toolchains/rust/xmake.lua
index dca2325bb..6c6e70bfb 100644
--- a/xmake/toolchains/rust/xmake.lua
+++ b/xmake/toolchains/rust/xmake.lua
@@ -22,10 +22,10 @@
toolchain("rust")
-- set toolsets
- set_toolsets("rc", "rustc")
- set_toolsets("rcld", "rustc")
- set_toolsets("rcsh", "rustc")
- set_toolsets("rcar", "rustc")
+ set_toolsets("rc", "$(env RC)", "rustc")
+ set_toolsets("rcld", "$(env RC)", "rustc")
+ set_toolsets("rcsh", "$(env RC)", "rustc")
+ set_toolsets("rcar", "$(env RC)", "rustc")
-- on load
on_load(function (toolchain)