summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-06-22 22:35:09 +0800
committerruki <[email protected]>2018-06-22 09:30:59 +0800
commit752e703e0041b6fd9770968693b0f625aa246d3e (patch)
tree607313a5ce1f82e85e8f19fb120c7e1166128af3
parent4602c6a9216e98e2729ef9657c1a95f0f29225de (diff)
improve find_qt
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_file.lua2
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_path.lua2
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua32
3 files changed, 15 insertions, 21 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua
index 1623eac23..83538d21e 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_file.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_file.lua
@@ -91,7 +91,7 @@ function sandbox_lib_detect_find_file.main(name, pathes, opt)
-- find file with suffixes
if #suffixes > 0 then
- for _, suffix in ipairs(table.wrap(opt.suffixes)) do
+ for _, suffix in ipairs(suffixes) do
local filedir = path.join(_path, suffix)
local results = sandbox_lib_detect_find_file._find(filedir, name)
if results then
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_path.lua b/xmake/core/sandbox/modules/import/lib/detect/find_path.lua
index 5228609cd..084983b8a 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_path.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_path.lua
@@ -84,7 +84,7 @@ function sandbox_lib_detect_find_path.main(name, pathes, opt)
-- find file with suffixes
if #suffixes > 0 then
- for _, suffix in ipairs(table.wrap(opt.suffixes)) do
+ for _, suffix in ipairs(suffixes) do
local filedir = path.join(_path, suffix)
local results = sandbox_lib_detect_find_path._find(filedir, name)
if results then
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index 655b0a6e0..f671931e1 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -32,33 +32,27 @@ import("core.project.config")
-- find qt sdk directory
function _find_sdkdir(sdkdir, sdkver)
- -- init sub-directory
- local subdir = sdkver or "*"
-
-- append target sub-directory
- local targetdir = nil
+ local subdirs = {}
if is_plat("linux") then
- targetdir = is_arch("x86_64") and "gcc_64" or "gcc_32"
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "gcc_64" or "gcc_32", "bin"))
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "clang_64" or "clang_32", "bin"))
elseif is_plat("macosx") then
- targetdir = is_arch("x86_64") and "clang_64" or "clang_32"
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "clang_64" or "clang_32", "bin"))
elseif is_plat("windows") then
local vs = config.get("vs")
if vs then
- targetdir = is_arch("x64") and "msvc" .. vs .. "_64" or "msvc" .. vs .. "_32"
- else
- targetdir = is_arch("x64") and "msvc*_64" or "msvc*_32"
- end
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x64") and "msvc" .. vs .. "_64" or "msvc" .. vs .. "_32", "bin"))
+ table.insert(subdirs, path.join(sdkver or "*", "msvc" .. vs, "bin"))
+ end
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x64") and "msvc*_64" or "msvc*_32", "bin"))
+ table.insert(subdirs, path.join(sdkver or "*", "msvc*", "bin"))
elseif is_plat("mingw") then
- targetdir = is_arch("x86_64") and "mingw*_64" or "mingw*_32"
+ table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "mingw*_64" or "mingw*_32", "bin"))
elseif is_plat("android") then
- targetdir = "android_*" -- TODO android_armv7 and ..?
- end
- if targetdir then
- subdir = path.join(subdir, targetdir)
- else
- subdir = path.join(subdir, "*")
+ table.insert(subdirs, path.join(sdkver or "*", "android_*", "bin"))
end
- subdir = path.join(subdir, "bin")
+ table.insert(subdirs, path.join(sdkver or "*", "*", "bin"))
-- init the search directories
local pathes = {}
@@ -89,7 +83,7 @@ function _find_sdkdir(sdkdir, sdkver)
end
-- attempt to find qmake
- local qmake = find_file(os.host() == "windows" and "qmake.exe" or "qmake", pathes, {suffixes = subdir})
+ local qmake = find_file(os.host() == "windows" and "qmake.exe" or "qmake", pathes, {suffixes = subdirs})
if qmake then
return path.directory(path.directory(qmake))
end