summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-07 22:47:24 +0800
committerruki <[email protected]>2022-09-07 22:47:24 +0800
commitff4ac252b4aedd535c2c7112c6078f66bb854635 (patch)
tree5b25af86e9e9fafefbf77eec1a494d65c5d87a87
parentf16528f0e60e1823fc1aa093e5cd38f8e3406ac9 (diff)
format code
-rw-r--r--xmake/modules/detect/sdks/find_matlab.lua9
-rw-r--r--xmake/modules/detect/sdks/find_matlab_runtime.lua16
2 files changed, 8 insertions, 17 deletions
diff --git a/xmake/modules/detect/sdks/find_matlab.lua b/xmake/modules/detect/sdks/find_matlab.lua
index e6adbde0b..b8089d170 100644
--- a/xmake/modules/detect/sdks/find_matlab.lua
+++ b/xmake/modules/detect/sdks/find_matlab.lua
@@ -34,16 +34,15 @@ import("detect.sdks.matlab")
function main(opt)
opt = opt or {}
local runtime_version = opt.runtime_version and tostring(opt.runtime_version) or nil
-
local result = {sdkdir = "", includedirs = {}, linkdirs = {}, links = {}}
if is_host("windows") then
local matlabkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB"
local valuekeys = winos.registry_keys(matlabkey)
if #valuekeys == 0 then
- return nil
+ return
end
- local itemkey = nil
+ local itemkey
if runtime_version == nil then
itemkey = valuekeys[1] .. ";MATLABROOT"
else
@@ -66,18 +65,16 @@ function main(opt)
local sdkdir = try {function () return winos.registry_query(itemkey) end}
if not sdkdir then
- return nil
+ return
end
result.sdkdir = sdkdir
result.includedirs = path.join(sdkdir, "extern", "include")
- -- find lib dirs
for _, value in ipairs(os.dirs(path.join(sdkdir, "extern", "lib", "**"))) do
local dirbasename = path.basename(value)
if not dirbasename:startswith("win") then
result.linkdirs[dirbasename] = value
end
end
- -- find lib
for _, value in pairs(result.linkdirs) do
local dirbasename = path.basename(value)
result.links[dirbasename] = {}
diff --git a/xmake/modules/detect/sdks/find_matlab_runtime.lua b/xmake/modules/detect/sdks/find_matlab_runtime.lua
index 5fd884a4a..41f1f0efd 100644
--- a/xmake/modules/detect/sdks/find_matlab_runtime.lua
+++ b/xmake/modules/detect/sdks/find_matlab_runtime.lua
@@ -34,19 +34,17 @@ import("detect.sdks.matlab")
function main(opt)
opt = opt or {}
local runtime_version = opt.runtime_version and tostring(opt.runtime_version) or nil
-
local result = {sdkdir = "", includedirs = {}, linkdirs = {}, links = {}, bindirs = {}}
if is_host("windows") then
local matlabkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB Runtime"
local valuekeys = winos.registry_keys(matlabkey)
if #valuekeys == 0 then
- return nil
+ return
end
- local versionname = nil
- local versionvalue = nil
-
- local itemkey = nil
+ local itemkey
+ local versionname
+ local versionvalue
if runtime_version == nil then
local splitvaluekeys = valuekeys[1]:split("\\")
versionvalue = splitvaluekeys[#splitvaluekeys]
@@ -74,25 +72,21 @@ function main(opt)
local sdkdir = try {function () return winos.registry_query(itemkey) end}
if not sdkdir then
- return nil
+ return
end
-
sdkdir = sdkdir .. "\\v" .. versionvalue:gsub("%.", "")
-
result.sdkdir = sdkdir
result.includedirs = path.join(sdkdir, "extern", "include")
result.bindirs = {
path.join(sdkdir, "bin", "win64"),
path.join(sdkdir, "runtime", "win64"),
}
- -- find lib dirs
for _, value in ipairs(os.dirs(path.join(sdkdir, "extern", "lib", "**"))) do
local dirbasename = path.basename(value)
if not dirbasename:startswith("win") then
result.linkdirs[dirbasename] = value
end
end
- -- find lib
for _, value in pairs(result.linkdirs) do
local dirbasename = path.basename(value)
result.links[dirbasename] = {}