summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/nvcc/has_flags.lua
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2019-05-20 17:36:17 +0800
committerGitHub <[email protected]>2019-05-20 17:36:17 +0800
commitc2c491ab4bedea3be7b1a6aca8bb4e65a9d763db (patch)
tree9784ea67b81b5cf42f7b657b5162a3febbc42d5e /xmake/modules/detect/tools/nvcc/has_flags.lua
parentd0fc956fc21a92a39c7f56d62820ab78946617f0 (diff)
Support cudart flags
Fix check failed of "-cudart none" ``` checking for the flags (-cudart none ) ... no > nvcc -cudart none -m64 -LC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib checkinfo: C:\Program Files (x86)\xmake/core/base/os.lua:715: nvcc_has_flags.cu tmpxft_00003f20_00000000-18_nvcc_has_flags.obj : error LNK2019: 无法解析的外部符号 __cudaRegisterFatBinary,该符号在函数 "void __cdecl __nv_cudaEntityRegisterCallback(void * *)" (?__nv_cudaEntityRegisterCallback@@YAXPEAPEAX@Z) 中被引用 tmpxft_00003f20_00000000-18_nvcc_has_flags.obj : error LNK2019: 无法解析的外部符号 __cudaRegisterFatBinaryEnd,该符号在函数 "void __cdecl __nv_cudaEntityRegisterCallback(void * *)" (?__nv_cudaEntityRegisterCallback@@YAXPEAPEAX@Z) 中被引用 tmpxft_00003f20_00000000-18_nvcc_has_flags.obj : error LNK2019: 无法解析的外部符号 __cudaUnregisterFatBinary,该符号在函数 "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ) 中被引用 C:\Users\lzy\AppData\Local\Temp\.xmake\190520\detect\nvcc_has_flags.cu.o : fatal error LNK1120: 3 个无法解析的外部命令 stack traceback: [C]: in function 'error' [C:\Program Files (x86)\xmake/core/base/os.lua:715]: in function 'raise' [C:\Program Files (x86)\xmake\core\sandbox\modules\os.lua:309]: in function 'runv' [...iles (x86)\xmake\modules\detect\tools\nvcc\has_flags.lua:44]: ```
Diffstat (limited to 'xmake/modules/detect/tools/nvcc/has_flags.lua')
-rw-r--r--xmake/modules/detect/tools/nvcc/has_flags.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua
index 7926a15ef..a60f3b8b3 100644
--- a/xmake/modules/detect/tools/nvcc/has_flags.lua
+++ b/xmake/modules/detect/tools/nvcc/has_flags.lua
@@ -48,11 +48,17 @@ end
function _check_from_arglist(flags, opt, islinker)
-- check for the builtin flags
- local builtin_flags = {["-code"] = true, ["--gpu-code"] = true, ["-gencode"] = true, ["--generate-code"] = true, ["-arch"] = true, ["--gpu-architecture"] = true}
+ local builtin_flags = {["-code"] = true, ["--gpu-code"] = true, ["-gencode"] = true, ["--generate-code"] = true, ["-arch"] = true, ["--gpu-architecture"] = true, ["-cudart=none"] = true, ["--cudart=none"] = true}
if builtin_flags[flags[1]] then
return true
end
+ local cudart_flags = {["none"] = true, ["shared"] = true, ["static"] = true}
+ local builtin_flags_pair = {["-cudart"] = cudart_flags, ["--cudart"] = cudart_flags}
+ if #flags > 1 and builtin_flags_pair[flags[1]] and builtin_flags_pair[flags[1]][flags[2]] then
+ return true
+ end
+
-- check from the `--help` menu, only for linker
if islinker or #flags > 1 then
return