aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-06-22 15:56:34 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-06-22 15:56:46 +0200
commitbd75e0398fc66a71ecab297fefe68d0066c38a81 (patch)
tree89cd30daa8e2a7cbb7d052def4d66e021a26bce9 /mesonbuild/build.py
parenta656febccf6614008086bf124858826615924df7 (diff)
downloadmeson-bd75e0398fc66a71ecab297fefe68d0066c38a81.zip
meson-bd75e0398fc66a71ecab297fefe68d0066c38a81.tar.gz
meson-bd75e0398fc66a71ecab297fefe68d0066c38a81.tar.bz2
extract_objects: skip headers when building custom_target command line
As seen in the testcase, passing objects to custom_target does not work if headers are passed extract_objects(), or if extract_all_objects() is used and the sources include any header files. To fix this, use the code that already exists for unity build to filter out the nonexistent ".h.o" files. This already gives for free the handling of genlist, which was mentioned in a TODO comment.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 436a55d..0a792fc 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -375,7 +375,8 @@ class ExtractedObjects:
r = '<{0} {1!r}: {2}>'
return r.format(self.__class__.__name__, self.target.name, self.srclist)
- def classify_all_sources(self, sources, generated_sources):
+ @staticmethod
+ def get_sources(sources, generated_sources):
# Merge sources and generated sources
sources = list(sources)
for gensrc in generated_sources:
@@ -386,8 +387,10 @@ class ExtractedObjects:
sources.append(s)
# Filter out headers and all non-source files
- sources = [s for s in sources if environment.is_source(s) and not environment.is_header(s)]
+ return [s for s in sources if environment.is_source(s) and not environment.is_header(s)]
+ def classify_all_sources(self, sources, generated_sources):
+ sources = self.get_sources(sources, generated_sources)
return classify_unity_sources(self.target.compilers.values(), sources)
def check_unity_compatible(self):
@@ -407,10 +410,9 @@ class ExtractedObjects:
'the object files for each compiler at once.')
def get_outputs(self, backend):
- # TODO: Consider if we need to handle genlist here
return [
backend.object_filename_from_source(self.target, source)
- for source in self.srclist
+ for source in self.get_sources(self.srclist, self.genlist)
]
class EnvironmentVariables: