From 919278e3e1db85b4acc517e5614cc6c7b3163aa4 Mon Sep 17 00:00:00 2001 From: Laurin-Luis Lehning <65224843+e820@users.noreply.github.com> Date: Mon, 14 Dec 2020 14:04:25 +0100 Subject: [PATCH] Give get_gui_app_args access to the Environment --- mesonbuild/backend/ninjabackend.py | 3 ++- mesonbuild/compilers/compilers.py | 4 ++-- mesonbuild/compilers/mixins/gnu.py | 2 +- mesonbuild/linkers.py | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 9193dfcf5..1ec1af01d 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2702,8 +2702,9 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # If gui_app is significant on this platform, add the appropriate linker arguments. # Unfortunately this can't be done in get_target_type_link_args, because some misguided # libraries (such as SDL2) add -mwindows to their link flags. + if target.gui_app is not None: - commands += linker.get_gui_app_args(target.gui_app) + commands += linker.get_gui_app_args(self.environment, target.gui_app) else: commands += linker.get_win_subsystem_args(self.environment, target.win_subsystem) return commands diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index e83514de9..abb8af3c9 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -870,9 +870,9 @@ class Compiler(metaclass=abc.ABCMeta): def gnu_symbol_visibility_args(self, vistype: str) -> T.List[str]: return [] - def get_gui_app_args(self, value: bool) -> T.List[str]: + def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: # Only used on Windows - return self.linker.get_gui_app_args(value) + return self.linker.get_gui_app_args(env, value) def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: # By default the dynamic linker is going to return an empty diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index bb41a8a11..74841ff86 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -214,7 +214,7 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta): def get_profile_use_args(self) -> T.List[str]: return ['-fprofile-use', '-fprofile-correction'] - def get_gui_app_args(self, value: bool) -> T.List[str]: + def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: if self.info.is_windows() or self.info.is_cygwin(): return ['-mwindows' if value else '-mconsole'] return [] diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 6259b4e08..eaaf29949 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -477,7 +477,7 @@ class DynamicLinker(LinkerEnvVarsMixin, metaclass=abc.ABCMeta): # Only used by the Apple linker return [] - def get_gui_app_args(self, value: bool) -> T.List[str]: + def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: # Only used by VisualStudioLikeLinkers return [] @@ -1154,11 +1154,11 @@ class VisualStudioLikeLinkerMixin: def get_allow_undefined_args(self) -> T.List[str]: return [] - def get_gui_app_args(self, value: bool) -> T.List[str]: + def get_gui_app_args(self, env: 'Environment', value: bool) -> T.List[str]: if value: - return self.get_win_subsystem_args("windows") + return self.get_win_subsystem_args(env, "windows") - return self.get_win_subsystem_args("console") + return self.get_win_subsystem_args(env, "console") def get_win_subsystem_args(self, env: 'Environment', value: str) -> T.List[str]: return self._apply_prefix([f'/SUBSYSTEM:{value.upper()}'])