diff options
| author | ruki <[email protected]> | 2015-12-17 09:25:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-12-17 09:25:05 +0800 |
| commit | 6c6b9ae901f5cf8aaf1f89d43b8f09bad832990f (patch) | |
| tree | 9e46b51ab81181f8be7e42b1edfa5a0473c96fb0 /xmake/scripts | |
| parent | 61ae08bdfaf5f8dbde739677ce6997b28560a522 (diff) | |
fix probe g++ failed for ld
Diffstat (limited to 'xmake/scripts')
| -rw-r--r-- | xmake/scripts/platform/android/prober.lua | 14 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphoneos/prober.lua | 66 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphonesimulator/prober.lua | 66 | ||||
| -rw-r--r-- | xmake/scripts/platform/linux/prober.lua | 58 | ||||
| -rw-r--r-- | xmake/scripts/platform/macosx/prober.lua | 66 | ||||
| -rw-r--r-- | xmake/scripts/platform/mingw/prober.lua | 58 | ||||
| -rw-r--r-- | xmake/scripts/platform/watchos/prober.lua | 66 | ||||
| -rw-r--r-- | xmake/scripts/platform/watchsimulator/prober.lua | 66 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/prober.lua | 8 |
9 files changed, 276 insertions, 192 deletions
diff --git a/xmake/scripts/platform/android/prober.lua b/xmake/scripts/platform/android/prober.lua index a90c6bf43..a6446e0e1 100644 --- a/xmake/scripts/platform/android/prober.lua +++ b/xmake/scripts/platform/android/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "armv7-a") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -89,11 +89,11 @@ function prober._probe_ndk_sdkver(configs) configs.set("ndk_sdkver", ndk_sdkver) -- trace - utils.verbose("checking for the SDK version of NDK ... %s", string.format("android-%d", ndk_sdkver)) + utils.printf("checking for the SDK version of NDK ... %s", string.format("android-%d", ndk_sdkver)) else -- trace - utils.verbose("checking for the SDK version of NDK ... no") + utils.printf("checking for the SDK version of NDK ... no") end -- ok @@ -114,7 +114,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -145,7 +145,7 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true @@ -200,9 +200,9 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- failed? diff --git a/xmake/scripts/platform/iphoneos/prober.lua b/xmake/scripts/platform/iphoneos/prober.lua index 3b096fba2..0b4d10dc8 100644 --- a/xmake/scripts/platform/iphoneos/prober.lua +++ b/xmake/scripts/platform/iphoneos/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "armv7") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -84,7 +84,7 @@ function prober._probe_xcode(configs) configs.set("xcode_dir", xcode_dir) -- trace - utils.verbose("checking for the Xcode application directory ... %s", xcode_dir) + utils.printf("checking for the Xcode application directory ... %s", xcode_dir) else -- failed utils.error("checking for the Xcode application directory ... no") @@ -127,7 +127,7 @@ function prober._probe_xcode_sdkver(configs) configs.set("xcode_sdkver", xcode_sdkver) -- trace - utils.verbose("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) + utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) else -- failed utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat")) @@ -153,7 +153,7 @@ function prober._probe_target_minver(configs) configs.set("target_minver", "7.0") -- trace - utils.verbose("checking for the target minimal version ... %s", configs.get("target_minver")) + utils.printf("checking for the target minimal version ... %s", configs.get("target_minver")) -- ok return true @@ -173,7 +173,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -204,14 +204,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -219,31 +219,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -255,13 +267,13 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "xcrun -sdk iphoneos ", "clang", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphoneos ", "clang++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "mm", "xcrun -sdk iphoneos ", "clang", "the objc compiler") then return false end - if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphoneos ", "clang++", "the objc++ compiler") then return false end + if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the objc++ compiler") then return false end if not prober._probe_toolpath(configs, "as", xmake._SCRIPTS_DIR .. "/tools/gas-preprocessor.pl xcrun -sdk iphoneos ", "clang", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphoneos ", "clang++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "xcrun -sdk iphoneos ", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphoneos ", "clang++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "xcrun -sdk iphoneos ", "swiftc", "the swift compiler") then return false end if not prober._probe_toolpath(configs, "lipo", "xcrun -sdk iphoneos ", "lipo", "the universal files creater") then return false end return true diff --git a/xmake/scripts/platform/iphonesimulator/prober.lua b/xmake/scripts/platform/iphonesimulator/prober.lua index 86f6b70c6..a4c69c72a 100644 --- a/xmake/scripts/platform/iphonesimulator/prober.lua +++ b/xmake/scripts/platform/iphonesimulator/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "x86_64") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -84,7 +84,7 @@ function prober._probe_xcode(configs) configs.set("xcode_dir", xcode_dir) -- trace - utils.verbose("checking for the Xcode application directory ... %s", xcode_dir) + utils.printf("checking for the Xcode application directory ... %s", xcode_dir) else -- failed utils.error("checking for the Xcode application directory ... no") @@ -127,7 +127,7 @@ function prober._probe_xcode_sdkver(configs) configs.set("xcode_sdkver", xcode_sdkver) -- trace - utils.verbose("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) + utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) else -- failed utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat")) @@ -153,7 +153,7 @@ function prober._probe_target_minver(configs) configs.set("target_minver", "7.0") -- trace - utils.verbose("checking for the target minimal version ... %s", configs.get("target_minver")) + utils.printf("checking for the target minimal version ... %s", configs.get("target_minver")) -- ok return true @@ -173,7 +173,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -204,14 +204,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -219,31 +219,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -255,13 +267,13 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "xcrun -sdk iphonesimulator ", "clang", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphonesimulator ", "clang++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "mm", "xcrun -sdk iphonesimulator ", "clang", "the objc compiler") then return false end - if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphonesimulator ", "clang++", "the objc++ compiler") then return false end + if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the objc++ compiler") then return false end if not prober._probe_toolpath(configs, "as", "xcrun -sdk iphonesimulator ", "clang", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphonesimulator ", "clang++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "xcrun -sdk iphonesimulator ", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphonesimulator ", "clang++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "xcrun -sdk iphonesimulator ", "swiftc", "the swift compiler") then return false end return true end diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua index 91b2ff685..bb20036d6 100644 --- a/xmake/scripts/platform/linux/prober.lua +++ b/xmake/scripts/platform/linux/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", xmake._ARCH) -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -65,7 +65,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -96,14 +96,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -111,31 +111,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -147,11 +159,11 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "", "gcc", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "", "g++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "", {"g++", "gcc"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "as", "", "gcc", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "", "g++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "", {"g++", "gcc"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "", "g++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "", {"g++", "gcc"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "", "swiftc", "the swift compiler") then return false end return true end diff --git a/xmake/scripts/platform/macosx/prober.lua b/xmake/scripts/platform/macosx/prober.lua index d4602e22a..e2571fdd9 100644 --- a/xmake/scripts/platform/macosx/prober.lua +++ b/xmake/scripts/platform/macosx/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", xmake._ARCH) -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -84,7 +84,7 @@ function prober._probe_xcode(configs) configs.set("xcode_dir", xcode_dir) -- trace - utils.verbose("checking for the Xcode application directory ... %s", xcode_dir) + utils.printf("checking for the Xcode application directory ... %s", xcode_dir) else -- failed utils.error("checking for the Xcode application directory ... no") @@ -127,7 +127,7 @@ function prober._probe_xcode_sdkver(configs) configs.set("xcode_sdkver", xcode_sdkver) -- trace - utils.verbose("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) + utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) else -- failed utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat")) @@ -153,7 +153,7 @@ function prober._probe_target_minver(configs) configs.set("target_minver", "10.9") -- trace - utils.verbose("checking for the target minimal version ... %s", configs.get("target_minver")) + utils.printf("checking for the target minimal version ... %s", configs.get("target_minver")) -- ok return true @@ -173,7 +173,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -204,14 +204,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -219,31 +219,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -255,13 +267,13 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "xcrun -sdk macosx ", "clang", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk macosx ", "clang++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk macosx ", {"clang++", "clang"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "mm", "xcrun -sdk macosx ", "clang", "the objc compiler") then return false end - if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk macosx ", "clang++", "the objc++ compiler") then return false end + if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk macosx ", {"clang++", "clang"}, "the objc++ compiler") then return false end if not prober._probe_toolpath(configs, "as", "xcrun -sdk macosx ", "clang", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "xcrun -sdk macosx ", "clang++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "xcrun -sdk macosx ", {"clang++", "clang"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "xcrun -sdk macosx ", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "xcrun -sdk macosx ", "clang++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "xcrun -sdk macosx ", {"clang++", "clang"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "xcrun -sdk macosx ", "swiftc", "the swift compiler") then return false end return true end diff --git a/xmake/scripts/platform/mingw/prober.lua b/xmake/scripts/platform/mingw/prober.lua index b8471485f..575e3a7ba 100644 --- a/xmake/scripts/platform/mingw/prober.lua +++ b/xmake/scripts/platform/mingw/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "i386") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -65,7 +65,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -96,14 +96,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -111,31 +111,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -160,11 +172,11 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", cross, "gcc", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", cross, "g++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", cross, {"g++", "gcc"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "as", cross, "gcc", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", cross, "g++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", cross, {"g++", "gcc"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", cross, "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", cross, "g++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", cross, {"g++", "gcc"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", cross, "swiftc", "the swift compiler") then return false end return true end diff --git a/xmake/scripts/platform/watchos/prober.lua b/xmake/scripts/platform/watchos/prober.lua index b6563603c..7b393f925 100644 --- a/xmake/scripts/platform/watchos/prober.lua +++ b/xmake/scripts/platform/watchos/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "armv7") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -84,7 +84,7 @@ function prober._probe_xcode(configs) configs.set("xcode_dir", xcode_dir) -- trace - utils.verbose("checking for the Xcode application directory ... %s", xcode_dir) + utils.printf("checking for the Xcode application directory ... %s", xcode_dir) else -- failed utils.error("checking for the Xcode application directory ... no") @@ -127,7 +127,7 @@ function prober._probe_xcode_sdkver(configs) configs.set("xcode_sdkver", xcode_sdkver) -- trace - utils.verbose("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) + utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) else -- failed utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat")) @@ -153,7 +153,7 @@ function prober._probe_target_minver(configs) configs.set("target_minver", "7.0") -- trace - utils.verbose("checking for the target minimal version ... %s", configs.get("target_minver")) + utils.printf("checking for the target minimal version ... %s", configs.get("target_minver")) -- ok return true @@ -173,7 +173,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -204,14 +204,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -219,31 +219,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -255,13 +267,13 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "xcrun -sdk watchos ", "clang", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchos ", "clang++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchos ", {"clang++", "clang"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "mm", "xcrun -sdk watchos ", "clang", "the objc compiler") then return false end - if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchos ", "clang++", "the objc++ compiler") then return false end + if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchos ", {"clang++", "clang"}, "the objc++ compiler") then return false end if not prober._probe_toolpath(configs, "as", xmake._SCRIPTS_DIR .. "/tools/gas-preprocessor.pl xcrun -sdk watchos ", "clang", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchos ", "clang++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchos ", {"clang++", "clang"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "xcrun -sdk watchos ", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchos ", "clang++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchos ", {"clang++", "clang"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "xcrun -sdk watchos ", "swiftc", "the swift compiler") then return false end if not prober._probe_toolpath(configs, "lipo", "xcrun -sdk watchos ", "lipo", "the universal files creater") then return false end return true diff --git a/xmake/scripts/platform/watchsimulator/prober.lua b/xmake/scripts/platform/watchsimulator/prober.lua index a14d92054..d33059c36 100644 --- a/xmake/scripts/platform/watchsimulator/prober.lua +++ b/xmake/scripts/platform/watchsimulator/prober.lua @@ -45,7 +45,7 @@ function prober._probe_arch(configs) configs.set("arch", "x86_64") -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -84,7 +84,7 @@ function prober._probe_xcode(configs) configs.set("xcode_dir", xcode_dir) -- trace - utils.verbose("checking for the Xcode application directory ... %s", xcode_dir) + utils.printf("checking for the Xcode application directory ... %s", xcode_dir) else -- failed utils.error("checking for the Xcode application directory ... no") @@ -127,7 +127,7 @@ function prober._probe_xcode_sdkver(configs) configs.set("xcode_sdkver", xcode_sdkver) -- trace - utils.verbose("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) + utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver) else -- failed utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat")) @@ -153,7 +153,7 @@ function prober._probe_target_minver(configs) configs.set("target_minver", "7.0") -- trace - utils.verbose("checking for the target minimal version ... %s", configs.get("target_minver")) + utils.printf("checking for the target minimal version ... %s", configs.get("target_minver")) -- ok return true @@ -173,7 +173,7 @@ function prober._probe_make(configs) if make then configs.set("make", make) end -- trace - utils.verbose("checking for the make ... %s", utils.ifelse(make, make, "no")) + utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no")) -- ok return true @@ -204,14 +204,14 @@ function prober._probe_ccache(configs) end -- trace - utils.verbose("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) + utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no")) -- ok return true end -- probe the tool path -function prober._probe_toolpath(configs, kind, cross, name, description) +function prober._probe_toolpath(configs, kind, cross, names, description) -- check assert(kind) @@ -219,31 +219,43 @@ function prober._probe_toolpath(configs, kind, cross, name, description) -- get the cross cross = configs.get("cross") or cross - -- attempt to get it from the given cross toolchains + -- done local toolpath = nil local toolchains = configs.get("toolchains") - if toolchains then - toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) - end + for _, name in ipairs(utils.wrap(names)) do - -- attempt to get it directly from the configure - if not toolpath then - toolpath = configs.get(kind) - end + -- attempt to get it from the given cross toolchains + if toolchains then + toolpath = tools.probe(cross .. (configs.get(kind) or name), toolchains) + end - -- attempt to run it directly - if not toolpath then - toolpath = tools.probe(cross .. name) - end + -- attempt to get it directly from the configure + if not toolpath then + toolpath = configs.get(kind) + end - -- probe ok? update it - if toolpath then configs.set(kind, toolpath) end + -- attempt to run it directly + if not toolpath then + toolpath = tools.probe(cross .. name) + end + + -- probe ok? + if toolpath then + + -- update config + configs.set(kind, toolpath) + + -- end + break + end + + end -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok @@ -255,13 +267,13 @@ function prober._probe_toolchains(configs) -- done if not prober._probe_toolpath(configs, "cc", "xcrun -sdk watchsimulator ", "clang", "the c compiler") then return false end - if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchsimulator ", "clang++", "the c++ compiler") then return false end + if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the c++ compiler") then return false end if not prober._probe_toolpath(configs, "mm", "xcrun -sdk watchsimulator ", "clang", "the objc compiler") then return false end - if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchsimulator ", "clang++", "the objc++ compiler") then return false end + if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the objc++ compiler") then return false end if not prober._probe_toolpath(configs, "as", "xcrun -sdk watchsimulator ", "clang", "the assember") then return false end - if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchsimulator ", "clang++", "the linker") then return false end + if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the linker") then return false end if not prober._probe_toolpath(configs, "ar", "xcrun -sdk watchsimulator ", "ar", "the static library linker") then return false end - if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchsimulator ", "clang++", "the shared library linker") then return false end + if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the shared library linker") then return false end if not prober._probe_toolpath(configs, "sc", "xcrun -sdk watchsimulator ", "swiftc", "the swift compiler") then return false end return true end diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/windows/prober.lua index d5ccdef88..4a853325d 100644 --- a/xmake/scripts/platform/windows/prober.lua +++ b/xmake/scripts/platform/windows/prober.lua @@ -47,7 +47,7 @@ function prober._probe_arch(configs) configs.set("arch", xmake._ARCH) -- trace - utils.verbose("checking for the architecture ... %s", configs.get("arch")) + utils.printf("checking for the architecture ... %s", configs.get("arch")) -- ok return true @@ -96,7 +96,7 @@ function prober._probe_vs_version(configs) configs.set("vs", vs) -- trace - utils.verbose("checking for the Microsoft Visual Studio version ... %s", vs) + utils.printf("checking for the Microsoft Visual Studio version ... %s", vs) else -- failed utils.error("checking for the Microsoft Visual Studio version ... no") @@ -217,9 +217,9 @@ function prober._probe_toolpath(configs, kind, name, description) -- trace if toolpath then - utils.verbose("checking for %s (%s) ... %s", description, kind, path.filename(toolpath), "no") + utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath)) else - utils.verbose("checking for %s (%s) ... no", description, kind) + utils.printf("checking for %s (%s) ... no", description, kind) end -- ok |
