From 63d2f0bf0736cdd3e7f13ecb720030684c8f987f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 4 Dec 2017 15:29:35 -0500 Subject: [PATCH] Do not extract object for header sources Closes #2716 --- mesonbuild/backend/backends.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 3f1e4ced7..5a5db22c2 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -346,6 +346,11 @@ class Backend: assert isinstance(source, mesonlib.File) build_dir = self.environment.get_build_dir() rel_src = source.rel_to_builddir(self.build_to_src) + + if (not self.environment.is_source(rel_src) or + self.environment.is_header(rel_src)) and not is_unity: + return None + # foo.vala files compile down to foo.c and then foo.c.o, not foo.vala.o if rel_src.endswith(('.vala', '.gs')): # See description in generate_vala_compile for this logic. @@ -393,8 +398,9 @@ class Backend: return [objpath] for osrc in extobj.srclist: objname = self.object_filename_from_source(extobj.target, osrc, False) - objpath = os.path.join(proj_dir_to_build_root, targetdir, objname) - result.append(objpath) + if objname: + objpath = os.path.join(proj_dir_to_build_root, targetdir, objname) + result.append(objpath) return result def get_pch_include_args(self, compiler, target):