diff options
-rw-r--r-- | mesonbuild/compilers/compilers.py | 3 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 8 | ||||
-rw-r--r-- | mesonbuild/linkers.py | 10 |
3 files changed, 12 insertions, 9 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b1452b2..e83514d 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.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 diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 6e9a4d7..c38d59a 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -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 diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 7181cc1..6259b4e 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -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()}']) |