diff options
| author | ruki <[email protected]> | 2022-08-05 00:40:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-08-05 00:40:16 +0800 |
| commit | e581f5c19ad1feeed70e26d294c114c48ade00da (patch) | |
| tree | 52e3158f303285e01a60855287b7de85da433fd3 /xmake/rules/c++ | |
| parent | b8c3621afb10f6dd7ee483ed8bebfb039cd11d7e (diff) | |
optimize to get headerunits info
Diffstat (limited to 'xmake/rules/c++')
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 18 |
1 files changed, 8 insertions, 10 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 |
