interpreter: use typed_kwargs for static_library(prelink)

pull/12302/head
Dylan Baker 1 year ago
parent dac25ba9a8
commit 798791baac
  1. 4
      mesonbuild/build.py
  2. 9
      mesonbuild/interpreter/kwargs.py
  3. 4
      mesonbuild/interpreter/type_checking.py

@ -2053,9 +2053,7 @@ class StaticLibrary(BuildTarget):
environment: environment.Environment,
compilers: T.Dict[str, 'Compiler'],
kwargs):
self.prelink = kwargs.get('prelink', False)
if not isinstance(self.prelink, bool):
raise InvalidArguments('Prelink keyword argument must be a boolean.')
self.prelink = T.cast('bool', kwargs.get('prelink', False))
super().__init__(name, subdir, subproject, for_machine, sources, structured_sources, objects,
environment, compilers, kwargs)

@ -344,7 +344,12 @@ class Executable(_BuildTarget):
win_subsystem: T.Optional[str]
class StaticLibrary(_BuildTarget, _LibraryMixin):
class _StaticLibMixin(TypedDict):
prelink: bool
class StaticLibrary(_BuildTarget, _StaticLibMixin, _LibraryMixin):
pass
@ -363,7 +368,7 @@ class SharedModule(_BuildTarget, _LibraryMixin):
pass
class Library(_BuildTarget, _SharedLibMixin, _LibraryMixin):
class Library(_BuildTarget, _SharedLibMixin, _StaticLibMixin, _LibraryMixin):
"""For library, both_library, and as a base for build_target"""

@ -604,7 +604,9 @@ _EXCLUSIVE_LIB_KWS: T.List[KwargInfo] = [
# Arguments exclusive to StaticLibrary. These are separated to make integrating
# them into build_target easier
_EXCLUSIVE_STATIC_LIB_KWS: T.List[KwargInfo] = []
_EXCLUSIVE_STATIC_LIB_KWS: T.List[KwargInfo] = [
KwargInfo('prelink', bool, default=False, since='0.57.0'),
]
# The total list of arguments used by StaticLibrary
STATIC_LIB_KWS = [

Loading…
Cancel
Save