Skip to content

Commit

Permalink
unity builds: correct integer ceiling division
Browse files Browse the repository at this point in the history
* edge case failure with unity builds:
  - static archive bar that gets installed, that links with another static
    archive foo that does not get installed
  - the number of files in static archive foo is divisible by unity_size

would yield an error with ninja:

  ninja: error: 'subprojects/foo/src/libfoo.a.p/meson-generated_foo-unity1.cpp.o', needed by 'src/libbar.a', missing and no known rule to make it
  • Loading branch information
SoapGentoo committed Nov 17, 2023
1 parent 6901ec3 commit 95b7d74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def _determine_ext_objs(self, extobj: 'build.ExtractedObjects', proj_dir_to_buil
if comp.language in LANGS_CANT_UNITY:
sources += srcs
continue
for i in range(len(srcs) // unity_size + 1):
for i in range((len(srcs) + unity_size - 1) // unity_size):
_src = self.get_unity_source_file(extobj.target,
comp.get_default_suffix(), i)
sources.append(_src)
Expand Down

0 comments on commit 95b7d74

Please sign in to comment.