summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Leclercq <[email protected]>2022-03-15 12:03:24 +0100
committerGitHub <[email protected]>2022-03-15 12:03:24 +0100
commitb7c9f94ec0efb1587da281d5a8781c3465f87837 (patch)
tree02f0e055a970ab26be2258a51f1c638f831e4206
parent18b910e27d60ee244ee2245071f33ff0fc821991 (diff)
Fix unity build when batchsize is set
-rw-r--r--xmake/rules/c++/unity_build/unity_build.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua
index 608f79fed..8d770ec02 100644
--- a/xmake/rules/c++/unity_build/unity_build.lua
+++ b/xmake/rules/c++/unity_build/unity_build.lua
@@ -83,7 +83,7 @@ function main(target, sourcebatch)
local sourcefiles = {}
local objectfiles = {}
local dependfiles = {}
- local sourcedir = path.join(target:autogendir({root = true}), "unity_build")
+ local sourcedir = path.join(target:autogendir({root = true}), target:plat(), "unity_build")
for idx, sourcefile in pairs(sourcebatch.sourcefiles) do
local sourcefile_unity
local objectfile = sourcebatch.objectfiles[idx]
@@ -97,10 +97,11 @@ function main(target, sourcebatch)
table.insert(objectfiles, objectfile)
table.insert(dependfiles, dependfile)
else
- if batchsize and count > batchsize then
+ if batchsize and count >= batchsize then
id = id + 1
+ count = 0
end
- sourcefile_unity = path.join(sourcedir, "unity_" .. hash.uuid(tostring(id)):split("-", {plain = true})[1] .. path.extension(sourcefile))
+ sourcefile_unity = path.join(sourcedir, "unity_" .. tostring(id) .. path.extension(sourcefile))
count = count + 1
end
if sourcefile_unity then