diff options
| author | ruki <[email protected]> | 2015-06-10 18:25:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-10 18:25:18 +0800 |
| commit | 62f8e7581602d698a341db16257bd3d9304fa30d (patch) | |
| tree | df06a9cade4d74d149b924d2f6dfe0f95632e28b | |
| parent | 72faab4c7e6468d94364e2fec7c11614845d0c74 (diff) | |
trace probe verbose
| -rw-r--r-- | xmake/scripts/action/_config.lua | 10 | ||||
| -rw-r--r-- | xmake/scripts/action/_global.lua | 6 | ||||
| -rw-r--r-- | xmake/scripts/base/config.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/base/global.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/base/main.lua | 6 | ||||
| -rw-r--r-- | xmake/scripts/base/project.lua | 18 | ||||
| -rw-r--r-- | xmake/scripts/base/utils.lua | 33 | ||||
| -rw-r--r-- | xmake/scripts/platform/android/prober.lua | 47 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphoneos/prober.lua | 73 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphonesimulator/prober.lua | 71 | ||||
| -rw-r--r-- | xmake/scripts/platform/linux/prober.lua | 48 | ||||
| -rw-r--r-- | xmake/scripts/platform/macosx/prober.lua | 74 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/prober.lua | 56 |
13 files changed, 278 insertions, 168 deletions
diff --git a/xmake/scripts/action/_config.lua b/xmake/scripts/action/_config.lua index 027c22288..417d6ec36 100644 --- a/xmake/scripts/action/_config.lua +++ b/xmake/scripts/action/_config.lua @@ -37,9 +37,6 @@ function _config.done() local options = xmake._OPTIONS assert(options) - -- dump config - config.dump() - -- save the configure if not config.save() then -- error @@ -61,8 +58,13 @@ function _config.done() return false end - -- ok + -- dump configure + config.dump() + + -- trace print("configure ok!") + + -- ok return true end diff --git a/xmake/scripts/action/_global.lua b/xmake/scripts/action/_global.lua index 329502c7d..c2b7a956b 100644 --- a/xmake/scripts/action/_global.lua +++ b/xmake/scripts/action/_global.lua @@ -31,9 +31,6 @@ local platform = require("platform/platform") -- done the given config function _global.done() - -- dump global - global.dump() - -- save the global configure if not global.save() then -- error @@ -41,6 +38,9 @@ function _global.done() return false end + -- dump global + global.dump() + -- ok print("configure ok!") return true diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua index 2d5bcdc37..d0f58892b 100644 --- a/xmake/scripts/base/config.lua +++ b/xmake/scripts/base/config.lua @@ -342,7 +342,7 @@ function config.dump() assert(config._CURRENT) -- dump - utils.dump(config._CURRENT, "__%w*") + utils.dump(config._CURRENT, "__%w*", "configure") end diff --git a/xmake/scripts/base/global.lua b/xmake/scripts/base/global.lua index 32b509d6d..0017590c6 100644 --- a/xmake/scripts/base/global.lua +++ b/xmake/scripts/base/global.lua @@ -238,7 +238,7 @@ function global.dump() assert(global._CURRENT) -- dump - utils.dump(global._CURRENT, "__%w*") + utils.dump(global._CURRENT, "__%w*", "configure") end diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua index 0cc3ecd1d..2f038c8cd 100644 --- a/xmake/scripts/base/main.lua +++ b/xmake/scripts/base/main.lua @@ -230,12 +230,6 @@ function main._done_option() return false end - -- dump project - project.dump() - - -- dump platform - platform.dump() - -- reconfig it first if marked as "reconfig" if config._RECONFIG and not action.done("config") then -- error diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua index 6b1b7406b..19da97029 100644 --- a/xmake/scripts/base/project.lua +++ b/xmake/scripts/base/project.lua @@ -396,7 +396,7 @@ function project._make_options(configs) for k, v in pairs(configs._OPTIONS) do -- this option has not been enabled? - if not config.get(k) then + if nil == config.get(k) then -- make option local o = project._make_option(k, v) @@ -408,7 +408,23 @@ function project._make_options(configs) -- save this option to configure config.set("__" .. k, o) + else + + -- disable this option + config.set(k, false) + + -- clear this option to configure + config.set("__" .. k, nil) + end + + -- trace + utils.verbose("checking %s ...: %s", k, utils.ifelse(o, "ok", "no")) + + else + + -- trace + utils.verbose("checking %s ...: %s", k, "ok") end end end diff --git a/xmake/scripts/base/utils.lua b/xmake/scripts/base/utils.lua index a2efbb482..bbbc802ac 100644 --- a/xmake/scripts/base/utils.lua +++ b/xmake/scripts/base/utils.lua @@ -121,7 +121,12 @@ function utils._dump_with_level(object, exclude, level) end -- dump object -function utils.dump(object, exclude) +function utils.dump(object, exclude, prefix) + + -- dump prefix + if prefix then + io.write(prefix) + end -- dump it utils._dump_with_level(object, exclude, 0) @@ -202,5 +207,31 @@ function utils.unique(array) return array end +-- call functions +function utils.call(self, funcs, pred, ...) + + -- check + assert(self and funcs and type(funcs) == "table") + + -- call all + for _, name in ipairs(funcs) do + + -- check + assert(type(name) == "string") + + -- get function + local func = self[name] + assert(type(func) == "function") + + -- call it + local result = func(...) + + -- exists predicate? + if pred and type(pred) == "function" then + if not pred(name, result) then break end + end + end +end + -- return module: utils return utils diff --git a/xmake/scripts/platform/android/prober.lua b/xmake/scripts/platform/android/prober.lua index eed124d8d..d3840d812 100644 --- a/xmake/scripts/platform/android/prober.lua +++ b/xmake/scripts/platform/android/prober.lua @@ -33,31 +33,31 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", "armv7-a") + configs.set("arch", "armv7-a") -- ok return true end -- probe the ccache -function prober._probe_ccache() +function prober._probe_ccache(configs) -- ok? - local ccache_enable = config.get("ccache") - if ccache_enable and config.get("__ccache") then return true end + local ccache_enable = configs.get("ccache") + if ccache_enable and configs.get("__ccache") then return true end -- disable? if type(ccache_enable) == "boolean" and not ccache_enable then - config.set("__ccache", nil) + configs.set("__ccache", nil) return true end @@ -66,10 +66,10 @@ function prober._probe_ccache() -- probe ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + configs.set("ccache", true) + configs.set("__ccache", ccache_path) else - config.set("ccache", false) + configs.set("ccache", false) end -- ok @@ -79,20 +79,35 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end - -- probe the ccache - if not prober._probe_ccache() then return end + , config) end -- probe the global configure function prober.global() - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober diff --git a/xmake/scripts/platform/iphoneos/prober.lua b/xmake/scripts/platform/iphoneos/prober.lua index 3b885da6e..4d29d77cb 100644 --- a/xmake/scripts/platform/iphoneos/prober.lua +++ b/xmake/scripts/platform/iphoneos/prober.lua @@ -33,26 +33,26 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", "armv7") + configs.set("arch", "armv7") -- ok return true end -- probe the xcode application directory -function prober._probe_xcode() +function prober._probe_xcode(configs) -- get the xcode directory - local xcode_dir = config.get("xcode_dir") + local xcode_dir = configs.get("xcode_dir") -- ok? if xcode_dir then return true end @@ -77,7 +77,7 @@ function prober._probe_xcode() -- probe ok? update it if xcode_dir then - config.set("xcode_dir", xcode_dir) + configs.set("xcode_dir", xcode_dir) else -- failed utils.error("The Xcode directory is unknown now, please config it first!") @@ -91,10 +91,10 @@ function prober._probe_xcode() end -- probe the xcode sdk version -function prober._probe_xcode_sdkver() +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version - local xcode_sdkver = config.get("xcode_sdkver") + local xcode_sdkver = configs.get("xcode_sdkver") -- ok? if xcode_sdkver then return true end @@ -104,7 +104,7 @@ function prober._probe_xcode_sdkver() -- attempt to match the directory if not xcode_sdkver then - local dirs = os.match(config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk", true) + local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk", true) if dirs then for _, dir in ipairs(dirs) do xcode_sdkver = string.match(dir, "%d+%.%d+") @@ -115,7 +115,7 @@ function prober._probe_xcode_sdkver() -- probe ok? update it if xcode_sdkver then - config.set("xcode_sdkver", xcode_sdkver) + configs.set("xcode_sdkver", xcode_sdkver) else -- failed utils.error("The Xcode SDK version is unknown now, please config it first!") @@ -129,15 +129,15 @@ function prober._probe_xcode_sdkver() end -- probe the ccache -function prober._probe_ccache() +function prober._probe_ccache(configs) -- ok? - local ccache_enable = config.get("ccache") - if ccache_enable and config.get("__ccache") then return true end + local ccache_enable = configs.get("ccache") + if ccache_enable and configs.get("__ccache") then return true end -- disable? if type(ccache_enable) == "boolean" and not ccache_enable then - config.set("__ccache", nil) + configs.set("__ccache", nil) return true end @@ -146,10 +146,10 @@ function prober._probe_ccache() -- probe ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + configs.set("ccache", true) + configs.set("__ccache", ccache_path) else - config.set("ccache", false) + configs.set("ccache", false) end -- ok @@ -159,29 +159,38 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_xcode" + , "_probe_xcode_sdkver" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the xcode sdk version - if not prober._probe_xcode_sdkver() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + , config) end -- probe the global configure function prober.global() - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_xcode" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober diff --git a/xmake/scripts/platform/iphonesimulator/prober.lua b/xmake/scripts/platform/iphonesimulator/prober.lua index 89e6fb846..5804e97b9 100644 --- a/xmake/scripts/platform/iphonesimulator/prober.lua +++ b/xmake/scripts/platform/iphonesimulator/prober.lua @@ -33,26 +33,26 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", "x86") + configs.set("arch", "x86") -- ok return true end -- probe the xcode application directory -function prober._probe_xcode() +function prober._probe_xcode(configs) -- get the xcode directory - local xcode_dir = config.get("xcode_dir") + local xcode_dir = configs.get("xcode_dir") -- ok? if xcode_dir then return true end @@ -77,7 +77,7 @@ function prober._probe_xcode() -- probe ok? update it if xcode_dir then - config.set("xcode_dir", xcode_dir) + configs.set("xcode_dir", xcode_dir) else -- failed utils.error("The Xcode directory is unknown now, please config it first!") @@ -91,10 +91,10 @@ function prober._probe_xcode() end -- probe the xcode sdk version -function prober._probe_xcode_sdkver() +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version - local xcode_sdkver = config.get("xcode_sdkver") + local xcode_sdkver = configs.get("xcode_sdkver") -- ok? if xcode_sdkver then return true end @@ -104,7 +104,7 @@ function prober._probe_xcode_sdkver() -- attempt to match the directory if not xcode_sdkver then - local dirs = os.match(config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk", true) + local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk", true) if dirs then for _, dir in ipairs(dirs) do xcode_sdkver = string.match(dir, "%d+%.%d+") @@ -115,7 +115,7 @@ function prober._probe_xcode_sdkver() -- probe ok? update it if xcode_sdkver then - config.set("xcode_sdkver", xcode_sdkver) + configs.set("xcode_sdkver", xcode_sdkver) else -- failed utils.error("The Xcode SDK version is unknown now, please config it first!") @@ -129,15 +129,15 @@ function prober._probe_xcode_sdkver() end -- probe the ccache -function prober._probe_ccache() +function prober._probe_ccache(configs) -- ok? - local ccache_enable = config.get("ccache") - if ccache_enable and config.get("__ccache") then return true end + local ccache_enable = configs.get("ccache") + if ccache_enable and configs.get("__ccache") then return true end -- disable? if type(ccache_enable) == "boolean" and not ccache_enable then - config.set("__ccache", nil) + configs.set("__ccache", nil) return true end @@ -146,10 +146,10 @@ function prober._probe_ccache() -- probe ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + configs.set("ccache", true) + configs.set("__ccache", ccache_path) else - config.set("ccache", false) + configs.set("ccache", false) end -- ok @@ -159,26 +159,37 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end - - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the xcode sdk version - if not prober._probe_xcode_sdkver() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_xcode" + , "_probe_xcode_sdkver" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , config) end -- probe the global configure function prober.global() - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_xcode" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua index f6e6ff5de..70f877bb7 100644 --- a/xmake/scripts/platform/linux/prober.lua +++ b/xmake/scripts/platform/linux/prober.lua @@ -33,31 +33,31 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", xmake._ARCH) + configs.set("arch", xmake._ARCH) -- ok return true end -- probe the ccache -function prober._probe_ccache() +function prober._probe_ccache(configs) -- ok? - local ccache_enable = config.get("ccache") - if ccache_enable and config.get("__ccache") then return true end + local ccache_enable = configs.get("ccache") + if ccache_enable and configs.get("__ccache") then return true end -- disable? if type(ccache_enable) == "boolean" and not ccache_enable then - config.set("__ccache", nil) + configs.set("__ccache", nil) return true end @@ -66,10 +66,10 @@ function prober._probe_ccache() -- probe ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + configs.set("ccache", true) + configs.set("__ccache", ccache_path) else - config.set("ccache", false) + configs.set("ccache", false) end -- ok @@ -79,20 +79,34 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , config) end -- probe the global configure function prober.global() - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober diff --git a/xmake/scripts/platform/macosx/prober.lua b/xmake/scripts/platform/macosx/prober.lua index 9a2298a71..bdee6431e 100644 --- a/xmake/scripts/platform/macosx/prober.lua +++ b/xmake/scripts/platform/macosx/prober.lua @@ -33,26 +33,26 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", xmake._ARCH) + configs.set("arch", xmake._ARCH) -- ok return true end -- probe the xcode application directory -function prober._probe_xcode() +function prober._probe_xcode(configs) -- get the xcode directory - local xcode_dir = config.get("xcode_dir") + local xcode_dir = configs.get("xcode_dir") -- ok? if xcode_dir then return true end @@ -77,7 +77,7 @@ function prober._probe_xcode() -- probe ok? update it if xcode_dir then - config.set("xcode_dir", xcode_dir) + configs.set("xcode_dir", xcode_dir) else -- failed utils.error("The Xcode directory is unknown now, please config it first!") @@ -91,10 +91,10 @@ function prober._probe_xcode() end -- probe the xcode sdk version -function prober._probe_xcode_sdkver() +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version - local xcode_sdkver = config.get("xcode_sdkver") + local xcode_sdkver = configs.get("xcode_sdkver") -- ok? if xcode_sdkver then return true end @@ -104,7 +104,7 @@ function prober._probe_xcode_sdkver() -- attempt to match the directory if not xcode_sdkver then - local dirs = os.match(config.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk", true) + local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk", true) if dirs then for _, dir in ipairs(dirs) do xcode_sdkver = string.match(dir, "%d+%.%d+") @@ -115,7 +115,7 @@ function prober._probe_xcode_sdkver() -- probe ok? update it if xcode_sdkver then - config.set("xcode_sdkver", xcode_sdkver) + configs.set("xcode_sdkver", xcode_sdkver) else -- failed utils.error("The Xcode SDK version is unknown now, please config it first!") @@ -129,15 +129,15 @@ function prober._probe_xcode_sdkver() end -- probe the ccache -function prober._probe_ccache() +function prober._probe_ccache(configs) -- ok? - local ccache_enable = config.get("ccache") - if ccache_enable and config.get("__ccache") then return true end + local ccache_enable = configs.get("ccache") + if ccache_enable and configs.get("__ccache") then return true end -- disable? if type(ccache_enable) == "boolean" and not ccache_enable then - config.set("__ccache", nil) + configs.set("__ccache", nil) return true end @@ -146,10 +146,10 @@ function prober._probe_ccache() -- probe ok? update it if ccache_path then - config.set("ccache", true) - config.set("__ccache", ccache_path) + configs.set("ccache", true) + configs.set("__ccache", ccache_path) else - config.set("ccache", false) + configs.set("ccache", false) end -- ok @@ -159,29 +159,37 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end - - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the xcode sdk version - if not prober._probe_xcode_sdkver() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_xcode" + , "_probe_xcode_sdkver" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , config) end -- probe the global configure function prober.global() - -- probe the xcode application directory - if not prober._probe_xcode() then return end - - -- probe the ccache - if not prober._probe_ccache() then return end + -- call all probe functions + utils.call( prober + , { "_probe_xcode" + , "_probe_ccache"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/windows/prober.lua index 26968b0c8..bc39f2382 100644 --- a/xmake/scripts/platform/windows/prober.lua +++ b/xmake/scripts/platform/windows/prober.lua @@ -32,26 +32,26 @@ local global = require("base/global") local prober = prober or {} -- probe the architecture -function prober._probe_arch() +function prober._probe_arch(configs) -- get the architecture - local arch = config.get("arch") + local arch = configs.get("arch") -- ok? if arch then return true end -- init the default architecture - config.set("arch", xmake._ARCH) + configs.set("arch", xmake._ARCH) -- ok return true end -- probe the vs version -function prober._probe_vs_version() +function prober._probe_vs_version(configs) -- get the vs version - local vs = config.get("vs") + local vs = configs.get("vs") -- ok? if vs then return true end @@ -86,7 +86,7 @@ function prober._probe_vs_version() -- probe ok? update it if vs then - config.set("vs", vs) + configs.set("vs", vs) else -- failed utils.error("The Microsoft Visual Studio is unknown now, please config it first!") @@ -100,13 +100,13 @@ function prober._probe_vs_version() end -- probe the vs path -function prober._probe_vs_path() +function prober._probe_vs_path(configs) -- ok? - if config.get("__vsenv_path") then return true end + if configs.get("__vsenv_path") then return true end -- get the vs version - local vs = config.get("vs") + local vs = configs.get("vs") assert(vs) -- make the map table @@ -180,7 +180,7 @@ function prober._probe_vs_path() -- save the variables for k, v in pairs(variables) do - config.set("__vsenv_" .. k, v) + configs.set("__vsenv_" .. k, v) end -- ok @@ -190,26 +190,36 @@ end -- probe the project configure function prober.config() - -- probe the architecture - if not prober._probe_arch() then return end - - -- probe the vs version - if not prober._probe_vs_version() then return end - - -- probe the vs path - if not prober._probe_vs_path() then return end + -- call all probe functions + utils.call( prober + , { "_probe_arch" + , "_probe_vs_version" + , "_probe_vs_path"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , config) end -- probe the global configure function prober.global() - -- probe the vs version - if not prober._probe_vs_version() then return end - - -- probe the vs path - if not prober._probe_vs_path() then return end + -- call all probe functions + utils.call( prober + , { "_probe_vs_version" + , "_probe_vs_path"} + + , function (name, result) + -- trace + utils.verbose("checking %s ...: %s", name:gsub("_probe_", ""), utils.ifelse(result, "ok", "no")) + return result + end + , global) end -- return module: prober |
