diff options
| author | ruki <[email protected]> | 2022-03-15 22:07:56 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-15 22:07:56 +0800 |
| commit | c966a4177cec53b46aa70b5af3f8b2bd55c4a50c (patch) | |
| tree | b73013c53d132097f9e406d5372405128b22164e | |
| parent | 18b910e27d60ee244ee2245071f33ff0fc821991 (diff) | |
| parent | 9f58078d7f23cb8708bec4117e72deca3fa2c0eb (diff) | |
Merge pull request #2168 from SirLynix/patch-10
Fix unity build when batchsize is set
| -rw-r--r-- | xmake/rules/c++/unity_build/unity_build.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/xmake/rules/c++/unity_build/unity_build.lua b/xmake/rules/c++/unity_build/unity_build.lua index 608f79fed..d334c4970 100644 --- a/xmake/rules/c++/unity_build/unity_build.lua +++ b/xmake/rules/c++/unity_build/unity_build.lua @@ -83,24 +83,25 @@ 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] local dependfile = sourcebatch.dependfiles[idx] local fileconfig = target:fileconfig(sourcefile) if fileconfig and fileconfig.unity_group then - sourcefile_unity = path.join(sourcedir, "unity_" .. fileconfig.unity_group .. path.extension(sourcefile)) + sourcefile_unity = path.join(sourcedir, "unity_group_" .. fileconfig.unity_group .. path.extension(sourcefile)) elseif (fileconfig and fileconfig.unity_ignored) or (batchsize and batchsize <= 1) then -- we do not add these files to unity file table.insert(sourcefiles, sourcefile) 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 |
