extract_all_objects: Also extract generated sources

pull/2711/head
Xavier Claessens 7 years ago
parent 5eef325ab6
commit 809f018333
  1. 12
      mesonbuild/backend/backends.py
  2. 11
      mesonbuild/build.py

@ -22,6 +22,7 @@ import json
import subprocess
from ..mesonlib import MesonException
from ..mesonlib import get_compiler_for_source, classify_unity_sources
from ..mesonlib import File
from ..compilers import CompilerArgs
from collections import OrderedDict
import shlex
@ -414,11 +415,20 @@ class Backend:
objname = objname.replace('/', '_').replace('\\', '_')
objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
return [objpath]
for osrc in extobj.srclist:
sources = list(extobj.srclist)
for gensrc in extobj.genlist:
for s in gensrc.get_outputs():
path = self.get_target_generated_dir(extobj.target, gensrc, s)
dirpart, fnamepart = os.path.split(path)
sources.append(File(True, dirpart, fnamepart))
for osrc in sources:
objname = self.object_filename_from_source(extobj.target, osrc, False)
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):

@ -211,9 +211,10 @@ class ExtractedObjects:
'''
Holds a list of sources for which the objects must be extracted
'''
def __init__(self, target, srclist, is_unity):
def __init__(self, target, srclist, genlist, is_unity):
self.target = target
self.srclist = srclist
self.genlist = genlist
if is_unity:
self.check_unity_compatible()
@ -625,13 +626,17 @@ class BuildTarget(Target):
if not isinstance(src, str):
raise MesonException('Object extraction arguments must be strings.')
src = File(False, self.subdir, src)
# FIXME: It could be a generated source
if src not in self.sources:
raise MesonException('Tried to extract unknown source %s.' % src)
obj_src.append(src)
return ExtractedObjects(self, obj_src, self.is_unity)
return ExtractedObjects(self, obj_src, [], self.is_unity)
def extract_all_objects(self):
return ExtractedObjects(self, self.sources, self.is_unity)
# FIXME: We should add support for transitive extract_objects()
if self.objects:
raise MesonException('Cannot extract objects from a target that itself has extracted objects')
return ExtractedObjects(self, self.sources, self.generated, self.is_unity)
def get_all_link_deps(self):
return self.get_transitive_link_deps()

Loading…
Cancel
Save