summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-01 22:17:30 +0800
committerruki <[email protected]>2022-05-01 22:17:47 +0800
commite456ecaf8539a67d5e0d3354d7bd5eb9727852a0 (patch)
treec9205b4c853a0dbe6c2da9f9c5c789250d240a09
parent6948a822ea35dc61092dedadfaaa7e542c81f202 (diff)
add nvc and nvc++ support
-rw-r--r--xmake/modules/core/tools/nvc.lua24
-rw-r--r--xmake/modules/core/tools/nvcxx.lua24
-rw-r--r--xmake/modules/core/tools/nvfortran.lua39
-rw-r--r--xmake/modules/detect/tools/nvc/features.lua23
-rw-r--r--xmake/modules/detect/tools/nvc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/nvcxx/features.lua23
-rw-r--r--xmake/modules/detect/tools/nvcxx/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/nvfortran/has_flags.lua23
-rw-r--r--xmake/rules/fortran/xmake.lua2
-rw-r--r--xmake/toolchains/cuda/xmake.lua7
10 files changed, 210 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/nvc.lua b/xmake/modules/core/tools/nvc.lua
new file mode 100644
index 000000000..1ccc1770d
--- /dev/null
+++ b/xmake/modules/core/tools/nvc.lua
@@ -0,0 +1,24 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file nvc.lua
+--
+
+-- inherit gcc
+inherit("gcc")
+
+
diff --git a/xmake/modules/core/tools/nvcxx.lua b/xmake/modules/core/tools/nvcxx.lua
new file mode 100644
index 000000000..15bbb82ea
--- /dev/null
+++ b/xmake/modules/core/tools/nvcxx.lua
@@ -0,0 +1,24 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file nvcxx.lua
+--
+
+-- inherit gcc
+inherit("gcc")
+
+
diff --git a/xmake/modules/core/tools/nvfortran.lua b/xmake/modules/core/tools/nvfortran.lua
new file mode 100644
index 000000000..bc8343173
--- /dev/null
+++ b/xmake/modules/core/tools/nvfortran.lua
@@ -0,0 +1,39 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file nvfortran.lua
+--
+
+inherit("gfortran")
+import("core.language.language")
+
+-- make the symbol flag
+function nf_symbol(self, level)
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps = _g.symbol_maps
+ if not maps then
+ maps = {
+ debug = "-g"
+ }
+ _g.symbol_maps = maps
+ end
+ return maps[level .. '_' .. kind] or maps[level]
+ end
+end
+
diff --git a/xmake/modules/detect/tools/nvc/features.lua b/xmake/modules/detect/tools/nvc/features.lua
new file mode 100644
index 000000000..b887b9efc
--- /dev/null
+++ b/xmake/modules/detect/tools/nvc/features.lua
@@ -0,0 +1,23 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file features.lua
+--
+
+-- imports
+inherit("detect.tools.gcc.features")
+
diff --git a/xmake/modules/detect/tools/nvc/has_flags.lua b/xmake/modules/detect/tools/nvc/has_flags.lua
new file mode 100644
index 000000000..6464e10b6
--- /dev/null
+++ b/xmake/modules/detect/tools/nvc/has_flags.lua
@@ -0,0 +1,23 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/nvcxx/features.lua b/xmake/modules/detect/tools/nvcxx/features.lua
new file mode 100644
index 000000000..b887b9efc
--- /dev/null
+++ b/xmake/modules/detect/tools/nvcxx/features.lua
@@ -0,0 +1,23 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file features.lua
+--
+
+-- imports
+inherit("detect.tools.gcc.features")
+
diff --git a/xmake/modules/detect/tools/nvcxx/has_flags.lua b/xmake/modules/detect/tools/nvcxx/has_flags.lua
new file mode 100644
index 000000000..6464e10b6
--- /dev/null
+++ b/xmake/modules/detect/tools/nvcxx/has_flags.lua
@@ -0,0 +1,23 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/nvfortran/has_flags.lua b/xmake/modules/detect/tools/nvfortran/has_flags.lua
new file mode 100644
index 000000000..c0ee706cd
--- /dev/null
+++ b/xmake/modules/detect/tools/nvfortran/has_flags.lua
@@ -0,0 +1,23 @@
+--!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-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.gfortran.has_flags")
+
diff --git a/xmake/rules/fortran/xmake.lua b/xmake/rules/fortran/xmake.lua
index ffec0edea..4ab11906d 100644
--- a/xmake/rules/fortran/xmake.lua
+++ b/xmake/rules/fortran/xmake.lua
@@ -21,7 +21,7 @@
-- define rule: fortran.build.modules
rule("fortran.build.modules")
before_build(function (target)
- if not is_host("windows") then
+ if target:has_tool("fc", "gfortran") then
local modulesdir = target:values("fortran.moduledir") or path.join(target:objectdir(), ".modules")
os.mkdir(modulesdir)
target:add("fcflags", "-J" .. modulesdir)
diff --git a/xmake/toolchains/cuda/xmake.lua b/xmake/toolchains/cuda/xmake.lua
index 29079d656..2145368a7 100644
--- a/xmake/toolchains/cuda/xmake.lua
+++ b/xmake/toolchains/cuda/xmake.lua
@@ -26,6 +26,13 @@ toolchain("cuda")
set_description("CUDA Toolkit")
-- set toolset
+ set_toolset("cc", "nvc")
+ set_toolset("cxx", "nvc++")
+ set_toolset("fc", "nvfortran")
+ set_toolset("fcld", "nvfortran")
+ set_toolset("fcsh", "nvfortran")
+ set_toolset("ld", "nvc++", "nvc")
+ set_toolset("sh", "nvc++", "nvc")
set_toolset("cu", "nvcc", "clang")
set_toolset("culd", "nvcc")
set_toolset("cu-ccbin", "$(env CXX)", "$(env CC)")