From 76ab2db0863d85eb92933067a034c33962091286 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Sat, 9 Dec 2023 11:21:55 +0100 Subject: ninja backend: Adjust naming and comments Meson supports other transpilers generating source code for which compilation rules need to be generated other than Vala. Reflect this in variable names and comments to avoid confusion. --- mesonbuild/backend/ninjabackend.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index c5c208661..0e5697740 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -993,13 +993,15 @@ class NinjaBackend(backends.Backend): fortran_inc_args = mesonlib.listify([target.compilers['fortran'].get_include_args( self.get_target_private_dir(t), is_system=False) for t in obj_targets]) - # Generate compilation targets for C sources generated from Vala - # sources. This can be extended to other $LANG->C compilers later if - # necessary. This needs to be separate for at least Vala + # Generate compilation targets for sources generated by transpilers. # - # Do not try to unity-build the generated c files from vala, as these - # often contain duplicate symbols and will fail to compile properly - vala_generated_source_files = [] + # Do not try to unity-build the generated source files, as these + # often contain duplicate symbols and will fail to compile properly. + # + # Gather all generated source files and header before generating the + # compilation rules, to be able to add correct dependencies on the + # generated headers. + transpiled_source_files = [] for src in transpiled_sources: raw_src = File.from_built_relative(src) # Generated targets are ordered deps because the must exist @@ -1010,13 +1012,8 @@ class NinjaBackend(backends.Backend): if self.environment.is_header(src): header_deps.append(raw_src) else: - # We gather all these and generate compile rules below - # after `header_deps` (above) is fully generated - vala_generated_source_files.append(raw_src) - for src in vala_generated_source_files: - # Passing 'vala' here signifies that we want the compile - # arguments to be specialized for C code generated by - # valac. For instance, no warnings should be emitted. + transpiled_source_files.append(raw_src) + for src in transpiled_source_files: o, s = self.generate_single_compile(target, src, True, [], header_deps) obj_list.append(o) -- cgit v1.2.3