summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2018-03-09 23:15:48 +0800
committerruki <[email protected]>2018-03-09 13:34:53 +0800
commita6f86e9466987f5e14006245bb35cefc5339dfc0 (patch)
treeedea0be538ee40cb15bf42679f751c96799d5151 /xmake/modules
parentaf7fafb3c03680052207039cae975628192d3109 (diff)
support cuda for windows
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/detect/sdks/find_cuda_toolchains.lua9
-rw-r--r--xmake/modules/detect/tools/find_nvcc.lua2
2 files changed, 6 insertions, 5 deletions
diff --git a/xmake/modules/detect/sdks/find_cuda_toolchains.lua b/xmake/modules/detect/sdks/find_cuda_toolchains.lua
index 0d84f69b7..f6163ad54 100644
--- a/xmake/modules/detect/sdks/find_cuda_toolchains.lua
+++ b/xmake/modules/detect/sdks/find_cuda_toolchains.lua
@@ -33,12 +33,13 @@ function _find_cudadir()
if os.host() == "macosx" then
table.insert(pathes, "/Developer/NVIDIA/CUDA**/bin")
elseif os.host() == "windows" then
+ table.insert(pathes, "$(env CUDA_PATH)/bin")
else
table.insert(pathes, "/usr/local/cuda/bin")
end
-- attempt to find nvcc
- local nvcc = find_file("nvcc", pathes)
+ local nvcc = find_file(os.host() == "windows" and "nvcc.exe" or "nvcc", pathes)
if nvcc then
return path.directory(path.directory(nvcc))
end
@@ -69,13 +70,13 @@ function main(cudadir, opt)
-- not found?
if not cudadir or not os.isdir(cudadir) then
- return {}
+ return nil
end
-- get the bin directory
local bindir = path.join(cudadir, "bin")
- if not os.isfile(path.join(bindir, "nvcc")) then
- return {}
+ if not os.isexec(path.join(bindir, "nvcc")) then
+ return nil
end
-- get linkdirs
diff --git a/xmake/modules/detect/tools/find_nvcc.lua b/xmake/modules/detect/tools/find_nvcc.lua
index 7892726a1..1944915af 100644
--- a/xmake/modules/detect/tools/find_nvcc.lua
+++ b/xmake/modules/detect/tools/find_nvcc.lua
@@ -54,7 +54,7 @@ function main(opt)
local cudadir = config.get("cuda_dir")
if cudadir then
local toolchains = find_cuda_toolchains(cudadir)
- if toolchains then
+ if toolchains and toolchains.bindir then
program = find_program(path.join(toolchains.bindir, "nvcc"), opt)
end
end