diff options
author | Laurin-Luis Lehning <65224843+e820@users.noreply.github.com> | 2020-12-14 14:18:30 +0100 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-12-14 11:23:53 -0800 |
commit | 4164efceca7f0b91726e3e4258fe90aabaa5837e (patch) | |
tree | 0f1e8275561eae10e8a84d68e67f363d1f5523fa /mesonbuild/linkers.py | |
parent | 919278e3e1db85b4acc517e5614cc6c7b3163aa4 (diff) | |
download | meson-4164efceca7f0b91726e3e4258fe90aabaa5837e.zip meson-4164efceca7f0b91726e3e4258fe90aabaa5837e.tar.gz meson-4164efceca7f0b91726e3e4258fe90aabaa5837e.tar.bz2 |
Propagate Windows target checks up
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, |