From 784f2fb015f748cd381fb5a8a2098d7a7255ac74 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Thu, 11 Jul 2019 13:44:13 +0800 Subject: improve find_cuda --- xmake/modules/detect/sdks/find_cuda.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_cuda.lua b/xmake/modules/detect/sdks/find_cuda.lua index b7fb4911e..87ac6f3a1 100644 --- a/xmake/modules/detect/sdks/find_cuda.lua +++ b/xmake/modules/detect/sdks/find_cuda.lua @@ -31,13 +31,16 @@ function _find_sdkdir() -- init the search directories local pathes = {} if os.host() == "macosx" then + table.insert(pathes, "/Developer/NVIDIA/CUDA/bin") table.insert(pathes, "/Developer/NVIDIA/CUDA*/bin") elseif os.host() == "windows" then table.insert(pathes, "$(env CUDA_PATH)/bin") else + -- find from default symbol link dir + table.insert(pathes, "/usr/local/cuda/bin") table.insert(pathes, "/usr/local/cuda*/bin") end - table.insert(pathes, "$(env PATH)") + table.join2(pathes, path.splitenv(os.getenv("PATH"))) -- attempt to find nvcc local nvcc = find_file(os.host() == "windows" and "nvcc.exe" or "nvcc", pathes) -- cgit v1.3.1 From 695a634afebe0855d6aea84001dba8a0faffbbf4 Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Thu, 11 Jul 2019 13:49:22 +0800 Subject: fix regex --- xmake/core/sandbox/modules/import/lib/detect/find_file.lua | 2 +- xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 +- xmake/modules/detect/sdks/find_cuda.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua index 2d64d6067..869c3d540 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua @@ -82,7 +82,7 @@ function sandbox_lib_detect_find_file.main(name, pathes, opt) raise(results) end elseif type(_path) == "string" then - if _path:match("^%$%($s*env%s+%S+%s*%)$") then + if _path:match("^%$%(%s*env%s+%S+%s*%)$") then _path = path.splitenv(vformat(_path)) else _path = vformat(_path) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index bfc21f35c..fe9d73322 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -91,7 +91,7 @@ function sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt) raise(results) end elseif type(_path) == "string" then - if _path:match("^%$%($s*env%s+%S+%s*%)$") then + if _path:match("^%$%(%s*env%s+%S+%s*%)$") then _path = path.splitenv(vformat(_path)) else _path = vformat(_path) diff --git a/xmake/modules/detect/sdks/find_cuda.lua b/xmake/modules/detect/sdks/find_cuda.lua index 87ac6f3a1..54b8f21cf 100644 --- a/xmake/modules/detect/sdks/find_cuda.lua +++ b/xmake/modules/detect/sdks/find_cuda.lua @@ -40,7 +40,7 @@ function _find_sdkdir() table.insert(pathes, "/usr/local/cuda/bin") table.insert(pathes, "/usr/local/cuda*/bin") end - table.join2(pathes, path.splitenv(os.getenv("PATH"))) + table.insert(pathes, "$(env PATH)") -- attempt to find nvcc local nvcc = find_file(os.host() == "windows" and "nvcc.exe" or "nvcc", pathes) -- cgit v1.3.1 From b11c6f57662624732501045e6cccf6b6188dacee Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Thu, 11 Jul 2019 14:41:17 +0800 Subject: fix regex --- xmake/core/sandbox/modules/import/lib/detect/find_file.lua | 2 +- xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua index 869c3d540..45a3ebd8a 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua @@ -82,7 +82,7 @@ function sandbox_lib_detect_find_file.main(name, pathes, opt) raise(results) end elseif type(_path) == "string" then - if _path:match("^%$%(%s*env%s+%S+%s*%)$") then + if _path:match("^%$%(env .+%)$") then _path = path.splitenv(vformat(_path)) else _path = vformat(_path) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index fe9d73322..f8a62ceaf 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -91,7 +91,7 @@ function sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt) raise(results) end elseif type(_path) == "string" then - if _path:match("^%$%(%s*env%s+%S+%s*%)$") then + if _path:match("^%$%(env .+%)$") then _path = path.splitenv(vformat(_path)) else _path = vformat(_path) -- cgit v1.3.1