diff options
| author | ruki <[email protected]> | 2020-10-05 23:33:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-05 23:33:47 +0800 |
| commit | 3c24b8c6ebecb87f7171b74ac2695e37f32a9612 (patch) | |
| tree | 174f1345ecc6897ac095bb9c5f353424a5df3c27 | |
| parent | 68640a3c5df67d21022e727b25938d607c958d9b (diff) | |
fix order of target:objectfiles()
| -rw-r--r-- | xmake/core/base/table.lua | 9 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 8 |
2 files changed, 5 insertions, 12 deletions
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index 49d846e0c..27e6ecb3c 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -261,13 +261,8 @@ end -- remove repeat from the given array function table.unique(array, barrier) - -- remove repeat for array if table.is_array(array) then - - -- not only one? if table.getn(array) ~= 1 then - - -- done local exists = {} local unique = {} for _, v in ipairs(array) do @@ -284,13 +279,9 @@ function table.unique(array, barrier) table.insert(unique, v) end end - - -- update it array = unique end end - - -- ok return array end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 5ee5d54c3..ab6a90b51 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1197,7 +1197,11 @@ function _instance:objectfiles() -- get object files from source batches local objectfiles = {} local batchcount = 0 - for _, sourcebatch in pairs(self:sourcebatches()) do + local sourcebatches = self:sourcebatches() + local orderkeys = table.keys(sourcebatches) + table.sort(orderkeys) -- @note we need guarantee the order of objectfiles for depend.is_changed() and etc. + for _, k in ipairs(orderkeys) do + local sourcebatch = sourcebatches[k] table.join2(objectfiles, sourcebatch.objectfiles) batchcount = batchcount + 1 end @@ -1223,8 +1227,6 @@ function _instance:objectfiles() -- cache it self._OBJECTFILES = objectfiles - - -- ok? return objectfiles end |
