summaryrefslogtreecommitdiff
path: root/xmake/modules/detect
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-01 11:23:19 +0800
committerruki <[email protected]>2017-06-01 11:23:19 +0800
commit2743cb2ee2b2640bbb22aa39d63c134563949a05 (patch)
tree937f1ac22b73da7bb6149bdb99671e80074dc879 /xmake/modules/detect
parent95a3f4499e5fb575613b4192519a53d323a7a19c (diff)
improve find program, file and path modules
Diffstat (limited to 'xmake/modules/detect')
-rw-r--r--xmake/modules/detect/sdk/find_vstudio.lua19
-rw-r--r--xmake/modules/detect/tool/find_ollydbg.lua9
-rw-r--r--xmake/modules/detect/tool/find_vsjitdebugger.lua7
-rw-r--r--xmake/modules/detect/tool/find_windbg.lua9
-rw-r--r--xmake/modules/detect/tool/find_x64dbg.lua9
5 files changed, 41 insertions, 12 deletions
diff --git a/xmake/modules/detect/sdk/find_vstudio.lua b/xmake/modules/detect/sdk/find_vstudio.lua
index d1a071c1f..1e2c88f1a 100644
--- a/xmake/modules/detect/sdk/find_vstudio.lua
+++ b/xmake/modules/detect/sdk/find_vstudio.lua
@@ -49,6 +49,22 @@ function main()
, ["4.2"] = "4.2"
}
+ -- init vsenvs
+ local vsenvs =
+ {
+ ["14.0"] = "VS140COMNTOOLS"
+ , ["12.0"] = "VS120COMNTOOLS"
+ , ["11.0"] = "VS110COMNTOOLS"
+ , ["10.0"] = "VS100COMNTOOLS"
+ , ["9.0"] = "VS90COMNTOOLS"
+ , ["8.0"] = "VS80COMNTOOLS"
+ , ["7.1"] = "VS71COMNTOOLS"
+ , ["7.0"] = "VS70COMNTOOLS"
+ , ["6.0"] = "VS60COMNTOOLS"
+ , ["5.0"] = "VS50COMNTOOLS"
+ , ["4.2"] = "VS42COMNTOOLS"
+ }
+
-- find vs2017 -> vs4.2
local results = {}
for _, version in ipairs({"15.0", "14.0", "12.0", "11.0", "10.0", "9.0", "8.0", "7.1", "7.0", "6.0", "5.0", "4.2"}) do
@@ -57,7 +73,8 @@ function main()
local vcvarsall = find_file("vcvarsall.bat", {format("$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;%s)\\VC", version),
format("$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7;%s)\\VC", version),
format("$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;%s)\\VC\\Auxiliary\\Build", version),
- format("$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7;%s)\\VC\\Auxiliary\\Build", version)})
+ format("$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7;%s)\\VC\\Auxiliary\\Build", version),
+ format("$(env %s)\\..\\..\\VC", vsenvs[version] or "")})
-- found?
if vcvarsall then
diff --git a/xmake/modules/detect/tool/find_ollydbg.lua b/xmake/modules/detect/tool/find_ollydbg.lua
index eaef184ea..636f52932 100644
--- a/xmake/modules/detect/tool/find_ollydbg.lua
+++ b/xmake/modules/detect/tool/find_ollydbg.lua
@@ -51,7 +51,10 @@ function main(opt)
opt = opt or {}
-- find program
- return find_program(opt.program or "ollydbg", {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]",
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]"}
- , function (program) if not os.isfile(program) then raise() end end)
+ return find_program(opt.program or "ollydbg", {function ()
+ for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
+ return (val("reg " .. reg) or ""):match("\"(.-)\"")
+ end
+ end}
+ , function (program) if not os.isfile(program) then raise() end end)
end
diff --git a/xmake/modules/detect/tool/find_vsjitdebugger.lua b/xmake/modules/detect/tool/find_vsjitdebugger.lua
index 922d3fdf3..879fd0a5d 100644
--- a/xmake/modules/detect/tool/find_vsjitdebugger.lua
+++ b/xmake/modules/detect/tool/find_vsjitdebugger.lua
@@ -51,7 +51,10 @@ function main(opt)
opt = opt or {}
-- find program
- return find_program(opt.program or "vsjitdebugger", {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)",
- "$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger)"}
+ return find_program(opt.program or "vsjitdebugger", {function ()
+ for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
+ return (val("reg " .. reg) or ""):match("\"(.-)\"")
+ end
+ end}
, function (program) if not os.isfile(program) then raise() end end)
end
diff --git a/xmake/modules/detect/tool/find_windbg.lua b/xmake/modules/detect/tool/find_windbg.lua
index 7b57f2c1f..323855d79 100644
--- a/xmake/modules/detect/tool/find_windbg.lua
+++ b/xmake/modules/detect/tool/find_windbg.lua
@@ -51,7 +51,10 @@ function main(opt)
opt = opt or {}
-- find program
- return find_program(opt.program or "windbg", {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]",
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]"}
- , function (program) if not os.isfile(program) then raise() end end)
+ return find_program(opt.program or "windbg", {function ()
+ for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
+ return (val("reg " .. reg) or ""):match("\"(.-)\"")
+ end
+ end}
+ , function (program) if not os.isfile(program) then raise() end end)
end
diff --git a/xmake/modules/detect/tool/find_x64dbg.lua b/xmake/modules/detect/tool/find_x64dbg.lua
index 86aea7ebc..431fea112 100644
--- a/xmake/modules/detect/tool/find_x64dbg.lua
+++ b/xmake/modules/detect/tool/find_x64dbg.lua
@@ -51,7 +51,10 @@ function main(opt)
opt = opt or {}
-- find program
- return find_program(opt.program or "x64dbg", {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]",
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger]"}
- , function (program) if not os.isfile(program) then raise() end end)
+ return find_program(opt.program or "x64dbg", {function ()
+ for _, reg in ipairs({"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug;Debugger"}) do
+ return (val("reg " .. reg) or ""):match("\"(.-)\"")
+ end
+ end}
+ , function (program) if not os.isfile(program) then raise() end end)
end