From 90107baef97e8c87f8bbc39a0d33a81def87f30d Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Sat, 26 Feb 2022 21:21:32 +0800 Subject: improve cuda flags detection --- xmake/modules/detect/tools/nvcc/has_flags.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua index c30c87363..d96ffdfe8 100644 --- a/xmake/modules/detect/tools/nvcc/has_flags.lua +++ b/xmake/modules/detect/tools/nvcc/has_flags.lua @@ -122,6 +122,15 @@ function _check_try_running(flags, opt, islinker) end end + -- add architecture flags if cross compiling + if not is_arch(os.arch()) then + if is_arch(".+64.*") then + table.insert(args, 1, "-m64") + else + table.insert(args, 1, "-m32") + end + end + -- check flags return _try_running(opt.program, table.join(flags, args), opt) end -- cgit v1.3.1