diff options
author | Jonas Lundholm Bertelsen <drixi.b@gmail.com> | 2021-01-20 21:51:56 +0100 |
---|---|---|
committer | Jonas Lundholm Bertelsen <drixi.b@gmail.com> | 2021-01-21 14:46:20 +0100 |
commit | 2636eebd64221909157d93509ac72a5990f85060 (patch) | |
tree | 3203d4e74b27e0407587e65f748cd2f7486c2901 | |
parent | ea34a92632a0622bd140ec8160dd721e1f6ba040 (diff) | |
download | meson-2636eebd64221909157d93509ac72a5990f85060.zip meson-2636eebd64221909157d93509ac72a5990f85060.tar.gz meson-2636eebd64221909157d93509ac72a5990f85060.tar.bz2 |
Unity build reverts to normal for fortran fix
The `determine_ext_objs` function did not take into account that fortran
(and d) does not support unity builds. This caused failures in some
cases.
-rw-r--r-- | mesonbuild/backend/backends.py | 8 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 31ea1dd..8143941 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -45,6 +45,11 @@ if T.TYPE_CHECKING: InstallType = T.List[T.Tuple[str, str, T.Optional['FileMode']]] InstallSubdirsType = T.List[T.Tuple[str, str, T.Optional['FileMode'], T.Tuple[T.Set[str], T.Set[str]]]] +# Languages that can mix with C or C++ but don't support unity builds yet +# because the syntax we use for unity builds is specific to C/++/ObjC/++. +# Assembly files cannot be unitified and neither can LLVM IR files +LANGS_CANT_UNITY = ('d', 'fortran') + class TestProtocol(enum.Enum): EXITCODE = 0 @@ -637,6 +642,9 @@ class Backend: unity_size = self.get_option_for_target(OptionKey('unity_size'), extobj.target) for comp, srcs in compsrcs.items(): + if comp.language in LANGS_CANT_UNITY: + sources += srcs + continue for i in range(len(srcs) // unity_size + 1): osrc = self.get_unity_source_file(extobj.target, comp.get_default_suffix(), i) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 6a80299..b121d42 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -626,11 +626,6 @@ int dummy; srcs[f] = s return srcs - # Languages that can mix with C or C++ but don't support unity builds yet - # because the syntax we use for unity builds is specific to C/++/ObjC/++. - # Assembly files cannot be unitified and neither can LLVM IR files - langs_cant_unity = ('d', 'fortran') - def get_target_source_can_unity(self, target, source): if isinstance(source, File): source = source.fname @@ -638,7 +633,7 @@ int dummy; self.environment.is_assembly(source): return False suffix = os.path.splitext(source)[1][1:].lower() - for lang in self.langs_cant_unity: + for lang in backends.LANGS_CANT_UNITY: if lang not in target.compilers: continue if suffix in target.compilers[lang].file_suffixes: @@ -769,7 +764,7 @@ int dummy; if is_unity: # Warn about incompatible sources if a unity build is enabled langs = set(target.compilers.keys()) - langs_cant = langs.intersection(self.langs_cant_unity) + langs_cant = langs.intersection(backends.LANGS_CANT_UNITY) if langs_cant: langs_are = langs = ', '.join(langs_cant).upper() langs_are += ' are' if len(langs_cant) > 1 else ' is' |