summaryrefslogtreecommitdiff
path: root/xmake/modules/lib
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-25 21:07:37 +0800
committerGitHub <[email protected]>2022-02-25 21:07:37 +0800
commitdf4777bc2a897d054e4a5706fa2a34393b37c815 (patch)
tree031efde03a211ced568cb6c390386e23c0ca2fb4 /xmake/modules/lib
parent7282a7c84fc1543680f132b4e5e8840ce1cb28fd (diff)
parent304904858f9bec29aeaed8c1b646fba15ae025fb (diff)
Merge pull request #2095 from xq114/patch-4
fix find_cudadevice on windows x86
Diffstat (limited to 'xmake/modules/lib')
-rw-r--r--xmake/modules/lib/detect/find_cudadevices.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/lib/detect/find_cudadevices.lua b/xmake/modules/lib/detect/find_cudadevices.lua
index dcf4a4229..71ee12e3b 100644
--- a/xmake/modules/lib/detect/find_cudadevices.lua
+++ b/xmake/modules/lib/detect/find_cudadevices.lua
@@ -113,7 +113,7 @@ function _parse_result(lines, verbose)
end
-- find devices
-function _find_devices(verbose, envs)
+function _find_devices(verbose, opt)
-- find nvcc
local nvcc = assert(find_tool("nvcc"), "nvcc not found")
@@ -131,7 +131,12 @@ function _find_devices(verbose, envs)
{
function ()
local args = { sourcefile, "-run", "-o", outfile , '-DPRINT_SUFFIX="' .. _PRINT_SUFFIX .. '"' }
- return os.iorunv(nvcc.program, args, {envs = envs})
+ if opt.arch == "x86" then
+ table.insert(args, "-m32")
+ elseif opt.arch == "x64" or opt.arch == "x86_64" then
+ table.insert(args, "-m64")
+ end
+ return os.iorunv(nvcc.program, args, {envs = opt.envs})
end,
catch
{
@@ -187,7 +192,7 @@ function _get_devices(opt)
end
local verbose = opt.verbose or option.get("verbose") or option.get("diagnosis")
- local devices = _find_devices(verbose, opt.envs)
+ local devices = _find_devices(verbose, opt)
if devices then
cachedata = { succeed = true, data = devices }
else