summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-05 00:40:16 +0800
committerruki <[email protected]>2022-08-05 00:40:16 +0800
commite581f5c19ad1feeed70e26d294c114c48ade00da (patch)
tree52e3158f303285e01a60855287b7de85da433fd3
parentb8c3621afb10f6dd7ee483ed8bebfb039cd11d7e (diff)
optimize to get headerunits info
-rw-r--r--xmake/rules/c++/modules/xmake.lua18
-rw-r--r--xmake/rules/qt/env/xmake.lua4
2 files changed, 10 insertions, 12 deletions
diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua
index 9a7599358..a1d6fdca4 100644
--- a/xmake/rules/c++/modules/xmake.lua
+++ b/xmake/rules/c++/modules/xmake.lua
@@ -89,20 +89,18 @@ rule("c++.build.modules.builder")
sourcebatch.dependfiles = {}
common.patch_sourcebatch(target, sourcebatch, opt)
- -- get headerunits info, TODO maybe need optimize it
+ -- get headerunits info
local headerunits
local modules = target:data("cxx.modules")
for _, objectfile in ipairs(sourcebatch.objectfiles) do
- for obj, m in pairs(modules) do
- if obj == objectfile then
- for name, r in pairs(m.requires) do
- if r.method ~= "by-name" then
- headerunits = headerunits or {}
- local unittype = r.method == "include-angle" and ":angle" or ":quote"
- table.append(headerunits, {name = name, path = r.path, type = unittype, stl = stl_headers.is_stl_header(name)})
- end
+ local m = modules[objectfile]
+ if m then
+ for name, r in pairs(m.requires) do
+ if r.method ~= "by-name" then
+ headerunits = headerunits or {}
+ local unittype = r.method == "include-angle" and ":angle" or ":quote"
+ table.insert(headerunits, {name = name, path = r.path, type = unittype, stl = stl_headers.is_stl_header(name)})
end
- break
end
end
end
diff --git a/xmake/rules/qt/env/xmake.lua b/xmake/rules/qt/env/xmake.lua
index 592ef07d9..815ae49cb 100644
--- a/xmake/rules/qt/env/xmake.lua
+++ b/xmake/rules/qt/env/xmake.lua
@@ -34,9 +34,9 @@ rule("qt.env")
local qmlimportpath = target:values("qt.env.qmlimportpath") or {}
if target:is_plat("windows") or (target:is_plat("mingw") and is_host("windows")) then
target:add("runenvs", "PATH", qt.bindir)
- table.append(qmlimportpath, qt.qmldir)
+ table.insert(qmlimportpath, qt.qmldir)
-- add targetdir in QML2_IMPORT_PATH in case of the user have qml plugins
- table.append(qmlimportpath, target:targetdir())
+ table.insert(qmlimportpath, target:targetdir())
target:set("runenv", "QML_IMPORT_TRACE", "1")
elseif target:is_plat("msys", "cygwin") then
raise("please run `xmake f -p mingw --mingw=/mingw64` to support Qt/Mingw64 on Msys!")