summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-09-27 20:21:59 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2020-10-07 18:55:25 +0300
commit1a0603835e3c9f1047d9b7694efc996219a422e4 (patch)
tree17262dcb1829ebad6a9817ce8571beb342eaad75 /mesonbuild/compilers/mixins
parent8b20852b0ff35a9e19b3b26c04decdef35036fd5 (diff)
downloadmeson-1a0603835e3c9f1047d9b7694efc996219a422e4.tar.gz
Add win_subsystem kwarg. Closes #7765.
Diffstat (limited to 'mesonbuild/compilers/mixins')
-rw-r--r--mesonbuild/compilers/mixins/gnu.py14
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py3
2 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 41afadd1e..bb1fc6631 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -219,6 +219,20 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return ['-mwindows' if value else '-mconsole']
return []
+ def get_win_subsystem_args(self, value: str) -> T.List[str]:
+ args = []
+ if self.info.is_windows() or self.info.is_cygwin():
+ if 'windows' in value:
+ args = ['-Wl,--subsystem,windows']
+ elif 'console' in value:
+ args = ['-Wl,--subsystem,console']
+ else:
+ raise mesonlib.MesonException('Only "windows" and "console" are supported for win_subsystem with MinGW, not "{}".'.format(value))
+ if ',' in value:
+ args[-1] = args[-1] + ':' + value.split(',')[1]
+ return args
+
+
def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
for idx, i in enumerate(parameter_list):
if i[:2] == '-I' or i[:2] == '-L':
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 3494beefe..75ab635e1 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -205,6 +205,9 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
else:
return ['/SUBSYSTEM:CONSOLE']
+ def get_win_subsystem_args(self, value: str) -> T.List[str]:
+ return ['/SUBSYSTEM:' + value.upper()]
+
def get_pic_args(self) -> T.List[str]:
return [] # PIC is handled by the loader on Windows