Slight consistency changes to get_gui_app_args

pull/8096/head
Laurin-Luis Lehning 4 years ago committed by Dylan Baker
parent 76b577af11
commit 4053babf9c
  1. 3
      mesonbuild/compilers/compilers.py
  2. 8
      mesonbuild/compilers/mixins/visualstudio.py
  3. 10
      mesonbuild/linkers.py

@ -871,7 +871,8 @@ class Compiler(metaclass=abc.ABCMeta):
return []
def get_gui_app_args(self, value: bool) -> T.List[str]:
return []
# Only used on Windows
return self.linker.get_gui_app_args(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

@ -197,14 +197,6 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
def linker_to_compiler_args(self, args: T.List[str]) -> T.List[str]:
return ['/link'] + args
def get_gui_app_args(self, value: bool) -> T.List[str]:
# the default is for the linker to guess the subsystem based on presence
# of main or WinMain symbols, so always be explicit
if value:
return ['/SUBSYSTEM:WINDOWS']
else:
return ['/SUBSYSTEM:CONSOLE']
def get_pic_args(self) -> T.List[str]:
return [] # PIC is handled by the loader on Windows

@ -477,6 +477,10 @@ class DynamicLinker(LinkerEnvVarsMixin, metaclass=abc.ABCMeta):
# Only used by the Apple linker
return []
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]:
# Only used if supported by the dynamic linker and
# only when targeting Windows
@ -1150,6 +1154,12 @@ class VisualStudioLikeLinkerMixin:
def get_allow_undefined_args(self) -> T.List[str]:
return []
def get_gui_app_args(self, value: bool) -> T.List[str]:
if value:
return self.get_win_subsystem_args("windows")
return self.get_win_subsystem_args("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