summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-15 16:53:45 +0800
committerruki <[email protected]>2020-03-15 16:53:45 +0800
commitdded30fe3f71b20b724dcad7830b7b971af51f0a (patch)
treed2c27990ea8d36549d348dfff6fa981996941b9c
parent267907714e29124e5bc292a2aea5afdcd4089fa8 (diff)
fix qt links
-rw-r--r--xmake/rules/qt/load.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua
index 2dfda2200..62027aaa4 100644
--- a/xmake/rules/qt/load.lua
+++ b/xmake/rules/qt/load.lua
@@ -39,7 +39,7 @@ function _link(framework, major)
end
-- find the static links from the given qt link directories, e.g. libqt*.a
-function _find_static_links(linkdirs, libpattern)
+function _find_static_links_3rd(linkdirs, major, libpattern)
local links = {}
local debug_suffix = "_debug"
if is_plat("windows") then
@@ -52,8 +52,11 @@ function _find_static_links(linkdirs, libpattern)
for _, linkdir in ipairs(linkdirs) do
for _, libpath in ipairs(os.files(path.join(linkdir, libpattern))) do
local basename = path.basename(libpath)
- if (is_mode("debug") and basename:endswith(debug_suffix)) or (not is_mode("debug") and not basename:endswith(debug_suffix)) then
- table.insert(links, target.linkname(path.filename(libpath)))
+ -- we need ignore qt framework libraries, e.g. libQt5xxx.a, Qt5Core.lib ..
+ if not basename:startswith("libQt" .. major) and not basename:startswith("Qt" .. major) then
+ if (is_mode("debug") and basename:endswith(debug_suffix)) or (not is_mode("debug") and not basename:endswith(debug_suffix)) then
+ table.insert(links, target.linkname(path.filename(libpath)))
+ end
end
end
end
@@ -184,8 +187,9 @@ function main(target, opt)
end
end
- -- add some static third-party links if exists
- target:add("syslinks", _find_static_links(qt.linkdirs, is_plat("windows") and "qt*.lib" or "libqt*.a"))
+ -- add some static third-party links if exists, e.g. libqtmain.a, libqtfreetype.q, libqtlibpng.a
+ -- and exclude qt framework libraries, e.g. libQt5xxx.a, Qt5xxx.lib
+ target:add("syslinks", _find_static_links_3rd(qt.linkdirs, major, is_plat("windows") and "qt*.lib" or "libqt*.a"))
-- add user syslinks
if syslinks_user then