add objects keyword argument to declare_dependencies

pull/11240/head
Paolo Bonzini 2 years ago committed by Dylan Baker
parent 8d2940024b
commit b3fc3cd6b5
  1. 3
      mesonbuild/build.py
  2. 9
      mesonbuild/dependencies/base.py
  3. 5
      mesonbuild/interpreter/interpreter.py
  4. 2
      mesonbuild/modules/external_project.py
  5. 2
      mesonbuild/modules/gnome.py

@ -1294,6 +1294,7 @@ class BuildTarget(Target):
# Those parts that are internal.
self.process_sourcelist(dep.sources)
self.add_include_dirs(dep.include_directories, dep.get_include_type())
self.objects.extend(dep.objects)
for l in dep.libraries:
self.link(l)
for l in dep.whole_libraries:
@ -1304,7 +1305,7 @@ class BuildTarget(Target):
[],
dep.get_compile_args(),
dep.get_link_args(),
[], [], [], [], {}, [], [])
[], [], [], [], {}, [], [], [])
self.external_deps.append(extpart)
# Deps of deps.
self.add_deps(dep.ext_deps)

@ -31,13 +31,12 @@ from ..mesonlib import version_compare_many
if T.TYPE_CHECKING:
from .._typing import ImmutableListProtocol
from ..build import StructuredSources
from ..compilers.compilers import Compiler
from ..environment import Environment
from ..interpreterbase import FeatureCheckBase
from ..build import (
CustomTarget, IncludeDirs, CustomTargetIndex, LibTypes,
StaticLibrary
StaticLibrary, StructuredSources, ExtractedObjects
)
from ..mesonlib import FileOrString
@ -252,7 +251,8 @@ class InternalDependency(Dependency):
whole_libraries: T.List[T.Union[StaticLibrary, CustomTarget, CustomTargetIndex]],
sources: T.Sequence[T.Union[FileOrString, CustomTarget, StructuredSources]],
ext_deps: T.List[Dependency], variables: T.Dict[str, str],
d_module_versions: T.List[T.Union[str, int]], d_import_dirs: T.List['IncludeDirs']):
d_module_versions: T.List[T.Union[str, int]], d_import_dirs: T.List['IncludeDirs'],
objects: T.List['ExtractedObjects']):
super().__init__(DependencyTypeName('internal'), {})
self.version = version
self.is_found = True
@ -264,6 +264,7 @@ class InternalDependency(Dependency):
self.sources = list(sources)
self.ext_deps = ext_deps
self.variables = variables
self.objects = objects
if d_module_versions:
self.d_features['versions'] = d_module_versions
if d_import_dirs:
@ -315,7 +316,7 @@ class InternalDependency(Dependency):
return InternalDependency(
self.version, final_includes, final_compile_args,
final_link_args, final_libraries, final_whole_libraries,
final_sources, final_deps, self.variables, [], [])
final_sources, final_deps, self.variables, [], [], [])
def get_include_dirs(self) -> T.List['IncludeDirs']:
return self.include_directories

@ -670,12 +670,14 @@ class Interpreter(InterpreterBase, HoldableObject):
SOURCES_KW,
VARIABLES_KW.evolve(since='0.54.0', since_values={list: '0.56.0'}),
KwargInfo('version', (str, NoneType)),
KwargInfo('objects', ContainerTypeInfo(list, build.ExtractedObjects), listify=True, default=[], since='1.1.0'),
)
def func_declare_dependency(self, node, args, kwargs):
deps = kwargs['dependencies']
incs = self.extract_incdirs(kwargs)
libs = kwargs['link_with']
libs_whole = kwargs['link_whole']
objects = kwargs['objects']
sources = self.source_strings_to_files(kwargs['sources'])
compile_args = kwargs['compile_args']
link_args = kwargs['link_args']
@ -703,7 +705,8 @@ class Interpreter(InterpreterBase, HoldableObject):
dep = dependencies.InternalDependency(version, incs, compile_args,
link_args, libs, libs_whole, sources, deps,
variables, d_module_versions, d_import_dirs)
variables, d_module_versions, d_import_dirs,
objects)
return dep
@typed_pos_args('assert', bool, optargs=[str])

@ -269,7 +269,7 @@ class ExternalProject(NewExtensionModule):
link_args = [f'-L{abs_libdir}', f'-l{libname}']
sources = self.target
dep = InternalDependency(version, [], compile_args, link_args, [],
[], [sources], [], {}, [], [])
[], [sources], [], {}, [], [], [])
return dep

@ -2153,7 +2153,7 @@ class GnomeModule(ExtensionModule):
# - add relevant directories to include dirs
incs = [build.IncludeDirs(state.subdir, ['.'] + vapi_includes, False)]
sources = [vapi_target] + vapi_depends
rv = InternalDependency(None, incs, [], [], link_with, [], sources, [], {}, [], [])
rv = InternalDependency(None, incs, [], [], link_with, [], sources, [], {}, [], [], [])
created_values.append(rv)
return ModuleReturnValue(rv, created_values)

Loading…
Cancel
Save