diff options
Diffstat (limited to 'mesonbuild/linkers.py')
-rw-r--r-- | mesonbuild/linkers.py | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index eaaf299..269636f 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -477,11 +477,11 @@ class DynamicLinker(LinkerEnvVarsMixin, metaclass=abc.ABCMeta): # Only used by the Apple linker return [] - def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: + def get_gui_app_args(self, value: bool) -> T.List[str]: # Only used by VisualStudioLikeLinkers return [] - def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: + def get_win_subsystem_args(self, value: str) -> T.List[str]: # Only used if supported by the dynamic linker and # only when targeting Windows return [] @@ -752,17 +752,13 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam """Representation of GNU ld.bfd and ld.gold.""" - def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: - m = env.machines[self.for_machine] - args = [] - - if m.is_windows() or m.is_cygwin(): - if 'windows' in value: - args = ['--subsystem,windows'] - elif 'console' in value: - args = ['--subsystem,console'] - else: - raise mesonlib.MesonException(f'Only "windows" and "console" are supported for win_subsystem with MinGW, not "{value}".') + def get_win_subsystem_args(self, value: str) -> T.List[str]: + if 'windows' in value: + args = ['--subsystem,windows'] + elif 'console' in value: + args = ['--subsystem,console'] + else: + raise mesonlib.MesonException(f'Only "windows" and "console" are supported for win_subsystem with MinGW, not "{value}".') if ',' in value: args[-1] = args[-1] + ':' + value.split(',')[1] @@ -806,11 +802,7 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna return self._apply_prefix('--allow-shlib-undefined') return [] - def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: - m = env.machines[self.for_machine] - if not m.is_windows() or m.is_cygwin(): - return [] - + def get_win_subsystem_args(self, value: str) -> T.List[str]: return self._apply_prefix([f'-subsystem:{value}']) @@ -1154,13 +1146,10 @@ class VisualStudioLikeLinkerMixin: def get_allow_undefined_args(self) -> T.List[str]: return [] - def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: - if value: - return self.get_win_subsystem_args(env, "windows") - - return self.get_win_subsystem_args(env, "console") + def get_gui_app_args(self, value: bool) -> T.List[str]: + return self.get_win_subsystem_args("windows" if value else "console") - def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: + def get_win_subsystem_args(self, value: str) -> T.List[str]: return self._apply_prefix([f'/SUBSYSTEM:{value.upper()}']) def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str, |