diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2023-02-20 11:18:00 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-05-31 11:59:39 -0400 |
commit | d17e3ce6ba0a22f449c9bcb82d67281048c776e9 (patch) | |
tree | 98bc49bb7236913901d6f6e911d2e2a3b98289e1 /mesonbuild | |
parent | 95b03f793028968a4a6df7fe25358fd8c5d39a0c (diff) | |
download | meson-d17e3ce6ba0a22f449c9bcb82d67281048c776e9.zip meson-d17e3ce6ba0a22f449c9bcb82d67281048c776e9.tar.gz meson-d17e3ce6ba0a22f449c9bcb82d67281048c776e9.tar.bz2 |
preprocess: Allow preprocessing any file extensions
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 19da249..5aeaa48 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -856,6 +856,10 @@ class NinjaBackend(backends.Backend): self.generate_swift_target(target) return + # CompileTarget compiles all its sources and does not do a final link. + # This is, for example, a preprocessor. + is_compile_target = isinstance(target, build.CompileTarget) + # Preexisting target C/C++ sources to be built; dict of full path to # source relative to build root and the original File object. target_sources: T.MutableMapping[str, File] @@ -922,6 +926,8 @@ class NinjaBackend(backends.Backend): obj_list.append(rel_src) elif self.environment.is_library(rel_src) or modules.is_module_library(rel_src): pass + elif is_compile_target: + generated_source_files.append(raw_src) else: # Assume anything not specifically a source file is a header. This is because # people generate files with weird suffixes (.inc, .fh) that they then include @@ -992,7 +998,7 @@ class NinjaBackend(backends.Backend): # Generate compile targets for all the preexisting sources for this target for src in target_sources.values(): - if not self.environment.is_header(src): + if not self.environment.is_header(src) or is_compile_target: if self.environment.is_llvm_ir(src): o, s = self.generate_llvm_ir_compile(target, src) obj_list.append(o) @@ -1015,7 +1021,7 @@ class NinjaBackend(backends.Backend): obj_list.append(o) compiled_sources.append(s) source2object[s] = o - if isinstance(target, build.CompileTarget): + if is_compile_target: # Skip the link stage for this special type of target return linker, stdlib_args = self.determine_linker_and_stdlib_args(target) |