diff options
| author | ruki <[email protected]> | 2023-09-09 22:11:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-09-09 22:11:09 +0800 |
| commit | 7298851075ef05ff34849934ecd113e6a6cfd33a (patch) | |
| tree | ae63a4480a2b11e8ba608ed921d543a6731b5886 | |
| parent | e72c760f2458c93167b508ab77732bb8eec7a44c (diff) | |
improve target object files
| -rw-r--r-- | xmake/core/project/target.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index c296a529e..b53291358 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1617,10 +1617,24 @@ function _instance:objectfiles() -- @note we only merge objects in plain deps, e.g. binary -> (static -> object, object ...) local plaindeps = self:get("deps") if plaindeps and (self:is_binary() or self:is_shared() or self:is_static()) then + local function _get_all_objectfiles_of_object_dep (t) + local _objectfiles = {} + table.join2(_objectfiles, t:objectfiles()) + local _plaindeps = t:get("deps") + if _plaindeps then + for _, depname in ipairs(_plaindeps) do + local dep = t:dep(depname) + if dep and dep:is_object() then + table.join2(_objectfiles, _get_all_objectfiles_of_object_dep(dep)) + end + end + end + return _objectfiles + end for _, depname in ipairs(table.wrap(plaindeps)) do local dep = self:dep(depname) if dep and dep:is_object() then - table.join2(objectfiles, dep:objectfiles()) + table.join2(objectfiles, _get_all_objectfiles_of_object_dep(dep)) deduplicate = true end end |
