summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2019-07-17 15:02:03 +0800
committerGitHub <[email protected]>2019-07-17 15:02:03 +0800
commit42fd31e85dfbb8f1e916394bb2497fd0ee78f0d4 (patch)
treec90f60fa8d998a7542c128a20fb5899b56f418de /xmake/modules/detect/tools
parente0fbf9ffa3e809bd72afa6182f439db7cd6f4474 (diff)
parente7bcde1188f02ac07e64f6b9a798e0b1ca1e049c (diff)
Merge pull request #491 from OpportunityLiu/cuda-debug
Cuda debug
Diffstat (limited to 'xmake/modules/detect/tools')
-rw-r--r--xmake/modules/detect/tools/find_cudagdb.lua39
-rw-r--r--xmake/modules/detect/tools/find_cudamemcheck.lua39
-rw-r--r--xmake/modules/detect/tools/find_nvcc.lua38
3 files changed, 80 insertions, 36 deletions
diff --git a/xmake/modules/detect/tools/find_cudagdb.lua b/xmake/modules/detect/tools/find_cudagdb.lua
new file mode 100644
index 000000000..15d501ba4
--- /dev/null
+++ b/xmake/modules/detect/tools/find_cudagdb.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 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file find_cudagdb.lua
+--
+
+-- imports
+import("private.detect.find_cudatool")
+
+-- find cudagdb
+--
+-- @param opt the argument options, .e.g {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local cudagdb = find_cudagdb()
+-- local cudagdb, version = find_cudagdb({program = "cuda-gdb", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ return find_cudatool("cuda-gdb", "(%d+%.?%d*%.?%d*.-)%s+release", opt)
+end
diff --git a/xmake/modules/detect/tools/find_cudamemcheck.lua b/xmake/modules/detect/tools/find_cudamemcheck.lua
new file mode 100644
index 000000000..4c7de7469
--- /dev/null
+++ b/xmake/modules/detect/tools/find_cudamemcheck.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 - 2019, TBOOX Open Source Group.
+--
+-- @author OpportunityLiu
+-- @file find_cudamemcheck.lua
+--
+
+-- imports
+import("private.detect.find_cudatool")
+
+-- find cudamemcheck
+--
+-- @param opt the argument options, .e.g {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local cudamemcheck = find_cudamemcheck()
+-- local cudamemcheck, version = find_cudamemcheck({program = "cuda-memcheck", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ return find_cudatool("cuda-memcheck", "version (%d+%.?%d*%.?%d*.-)", opt)
+end
diff --git a/xmake/modules/detect/tools/find_nvcc.lua b/xmake/modules/detect/tools/find_nvcc.lua
index ce98c9a60..68db9fef5 100644
--- a/xmake/modules/detect/tools/find_nvcc.lua
+++ b/xmake/modules/detect/tools/find_nvcc.lua
@@ -19,10 +19,7 @@
--
-- imports
-import("core.project.config")
-import("lib.detect.find_program")
-import("lib.detect.find_programver")
-import("detect.sdks.find_cuda")
+import("private.detect.find_cudatool")
-- find nvcc
--
@@ -38,36 +35,5 @@ import("detect.sdks.find_cuda")
-- @endcode
--
function main(opt)
-
- -- init options
- opt = opt or {}
- opt.parse = opt.parse or "V(%d+%.?%d*%.?%d*.-)%s"
-
- -- find program
- local program = nil
- if opt.program then
- program = find_program(opt.program, opt)
- end
-
- -- not found? attempt to find program from cuda toolchains
- if not program then
- local toolchains = find_cuda()
- if toolchains and toolchains.bindir then
- program = find_program(path.join(toolchains.bindir, "nvcc"), opt)
- end
- end
-
- -- not found? attempt to find program from PATH
- if not program then
- program = find_program("nvcc", opt)
- end
-
- -- find program version
- local version = nil
- if program and opt.version then
- version = find_programver(program, opt)
- end
-
- -- ok?
- return program, version
+ return find_cudatool("nvcc", "V(%d+%.?%d*%.?%d*.-)%s", opt)
end