summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-07 06:07:44 +0800
committerGitHub <[email protected]>2022-09-07 06:07:44 +0800
commit46e28a1d9959e05676f7bbe60be828c8743659a4 (patch)
tree41a2623d9f00ed4299bcf758a6dd7c4c7a8f99fa
parent35d62e7599db7d87b6071dc4b28392fc67311af3 (diff)
parentb771433c52a5d8139960d134293863ff7ba31727 (diff)
Merge pull request #2788 from WubiCookie/matlab
Fix find_matlab[_runtime]
-rw-r--r--xmake/modules/detect/sdks/find_matlab.lua8
-rw-r--r--xmake/modules/detect/sdks/find_matlab_runtime.lua8
2 files changed, 12 insertions, 4 deletions
diff --git a/xmake/modules/detect/sdks/find_matlab.lua b/xmake/modules/detect/sdks/find_matlab.lua
index 1980ea960..e6adbde0b 100644
--- a/xmake/modules/detect/sdks/find_matlab.lua
+++ b/xmake/modules/detect/sdks/find_matlab.lua
@@ -37,7 +37,7 @@ function main(opt)
local result = {sdkdir = "", includedirs = {}, linkdirs = {}, links = {}}
if is_host("windows") then
- local matlabkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB"
+ local matlabkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB"
local valuekeys = winos.registry_keys(matlabkey)
if #valuekeys == 0 then
return nil
@@ -80,7 +80,11 @@ function main(opt)
-- find lib
for _, value in pairs(result.linkdirs) do
local dirbasename = path.basename(value)
- result.links[dirbasename] = path.join(value, "*")
+ result.links[dirbasename] = {}
+ for _, filepath in ipairs(os.files(value.."/*.lib")) do
+ table.insert(result.links[dirbasename], path.basename(filepath))
+ end
+ result.links[dirbasename] = table.unique(result.links[dirbasename])
end
end
return result
diff --git a/xmake/modules/detect/sdks/find_matlab_runtime.lua b/xmake/modules/detect/sdks/find_matlab_runtime.lua
index 27852d2f0..5fd884a4a 100644
--- a/xmake/modules/detect/sdks/find_matlab_runtime.lua
+++ b/xmake/modules/detect/sdks/find_matlab_runtime.lua
@@ -49,7 +49,7 @@ function main(opt)
local itemkey = nil
if runtime_version == nil then
local splitvaluekeys = valuekeys[1]:split("\\")
- versionvalue = splitvaluekeys[#splitvaluekeys - 1]
+ versionvalue = splitvaluekeys[#splitvaluekeys]
versionname = matlab.versions()[versionvalue]
itemkey = valuekeys[1] .. ";MATLABROOT"
else
@@ -95,7 +95,11 @@ function main(opt)
-- find lib
for _, value in pairs(result.linkdirs) do
local dirbasename = path.basename(value)
- result.links[dirbasename] = path.join(value, "*")
+ result.links[dirbasename] = {}
+ for _, filepath in ipairs(os.files(value.."/*.lib")) do
+ table.insert(result.links[dirbasename], path.basename(filepath))
+ end
+ result.links[dirbasename] = table.unique(result.links[dirbasename])
end
end
return result