interpreter: use typed_kwargs for static_library(pic)

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

@ -1240,7 +1240,7 @@ class BuildTarget(Target):
raise InvalidArguments(f'Invalid rust_dependency_map "{rust_dependency_map}": must be a dictionary with string values.') raise InvalidArguments(f'Invalid rust_dependency_map "{rust_dependency_map}": must be a dictionary with string values.')
self.rust_dependency_map = rust_dependency_map self.rust_dependency_map = rust_dependency_map
def _extract_pic_pie(self, kwargs, arg: str, option: str): def _extract_pic_pie(self, kwargs: T.Dict[str, T.Any], arg: str, option: str) -> bool:
# Check if we have -fPIC, -fpic, -fPIE, or -fpie in cflags # Check if we have -fPIC, -fpic, -fPIE, or -fpie in cflags
all_flags = self.extra_args['c'] + self.extra_args['cpp'] all_flags = self.extra_args['c'] + self.extra_args['cpp']
if '-f' + arg.lower() in all_flags or '-f' + arg.upper() in all_flags: if '-f' + arg.lower() in all_flags or '-f' + arg.upper() in all_flags:
@ -1248,8 +1248,8 @@ class BuildTarget(Target):
return True return True
k = OptionKey(option) k = OptionKey(option)
if arg in kwargs: if kwargs.get(arg) is not None:
val = kwargs[arg] val = T.cast('bool', kwargs[arg])
elif k in self.environment.coredata.options: elif k in self.environment.coredata.options:
val = self.environment.coredata.options[k].value val = self.environment.coredata.options[k].value
else: else:

@ -347,6 +347,7 @@ class Executable(_BuildTarget):
class _StaticLibMixin(TypedDict): class _StaticLibMixin(TypedDict):
prelink: bool prelink: bool
pic: T.Optional[bool]
class StaticLibrary(_BuildTarget, _StaticLibMixin, _LibraryMixin): class StaticLibrary(_BuildTarget, _StaticLibMixin, _LibraryMixin):

@ -606,6 +606,7 @@ _EXCLUSIVE_LIB_KWS: T.List[KwargInfo] = [
# them into build_target easier # 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'), KwargInfo('prelink', bool, default=False, since='0.57.0'),
KwargInfo('pic', (bool, NoneType), since='0.36.0'),
] ]
# The total list of arguments used by StaticLibrary # The total list of arguments used by StaticLibrary

Loading…
Cancel
Save