Give get_gui_app_args access to the Environment

pull/8096/head
Laurin-Luis Lehning 4 years ago committed by Dylan Baker
parent 4053babf9c
commit 919278e3e1
  1. 3
      mesonbuild/backend/ninjabackend.py
  2. 4
      mesonbuild/compilers/compilers.py
  3. 2
      mesonbuild/compilers/mixins/gnu.py
  4. 8
      mesonbuild/linkers.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

@ -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

@ -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 []

@ -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()}'])

Loading…
Cancel
Save