diff options
| author | ruki <[email protected]> | 2019-02-22 23:59:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-22 17:54:30 +0800 |
| commit | 8ee3fb6e476da6d39ee3685cc4ee17fedcdaccd1 (patch) | |
| tree | 4200e8da8995e39df1a419c3c96dc15ad78c7356 | |
| parent | 59f904ceaf907fbd1a88b41c4367cae1a23ed242 (diff) | |
add some 3rd static links for qt
| -rw-r--r-- | xmake/rules/qt/load.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua index 8a83e5788..2c96cd5fa 100644 --- a/xmake/rules/qt/load.lua +++ b/xmake/rules/qt/load.lua @@ -22,6 +22,9 @@ -- @file load.lua -- +-- imports +import("core.project.target") + -- make link for framework function _link(framework, major) if major and framework:startswith("Qt") then @@ -30,6 +33,20 @@ function _link(framework, major) return framework end +-- find the static third-party links from qt link directories, e.g. libqt*.a +function _find_static_links_3rd(linkdirs) + local links = {} + for _, linkdir in ipairs(linkdirs) do + for _, libpath in ipairs(os.files(path.join(linkdir, is_plat("windows") and "qt*.lib" or "libqt*.a"))) do + local basename = path.basename(libpath) + if (is_mode("debug") and basename:endswith("_debug")) or not basename:endswith("_debug") then + table.insert(links, target.linkname(path.filename(libpath))) + end + end + end + return links +end + -- the main entry function main(target, opt) @@ -146,5 +163,8 @@ function main(target, opt) target:add("linkdirs", qt.linkdirs) target:add("links", "mingw32") end + + -- add some static third-party links if exists + target:add("links", _find_static_links_3rd(qt.linkdirs)) end |
