aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-08-11 17:56:48 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-08-15 06:17:58 -0700
commit94f09a84542862d474a0be9429dc9498cb303e12 (patch)
treeb7b6e7abda884f0467f339accf8c46ebe14d612d
parent399f8553b7b3e7069d897cada2b61c4c358d0ddf (diff)
downloadmeson-94f09a84542862d474a0be9429dc9498cb303e12.zip
meson-94f09a84542862d474a0be9429dc9498cb303e12.tar.gz
meson-94f09a84542862d474a0be9429dc9498cb303e12.tar.bz2
Explicitly set the Windows subsystem for ninja/VisualC
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/compilers/c.py9
-rw-r--r--mesonbuild/compilers/compilers.py4
3 files changed, 12 insertions, 7 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 9dcf0fa..ba5c68c 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2234,9 +2234,9 @@ rule FORTRAN_DEP_HACK%s
if isinstance(target, build.Executable):
# Currently only used with the Swift compiler to add '-emit-executable'
commands += linker.get_std_exe_link_args()
- # If gui_app, and that's significant on this platform
- if target.gui_app and hasattr(linker, 'get_gui_app_args'):
- commands += linker.get_gui_app_args()
+ # If gui_app is significant on this platform
+ if hasattr(linker, 'get_gui_app_args'):
+ commands += linker.get_gui_app_args(target.gui_app)
# If export_dynamic, add the appropriate linker arguments
if target.export_dynamic:
commands += linker.gen_export_dynamic_link_args(self.environment)
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 2dfe794..1a0d6b2 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1276,8 +1276,13 @@ class VisualStudioCCompiler(CCompiler):
def linker_to_compiler_args(self, args):
return ['/link'] + args
- def get_gui_app_args(self):
- return ['/SUBSYSTEM:WINDOWS']
+ def get_gui_app_args(self, value):
+ # 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):
return [] # PIC is handled by the loader on Windows
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index ea0fc2c..381b995 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1277,8 +1277,8 @@ class GnuCompiler:
# For other targets, discard the .def file.
return []
- def get_gui_app_args(self):
- if self.gcc_type in (GCC_CYGWIN, GCC_MINGW):
+ def get_gui_app_args(self, value):
+ if self.gcc_type in (GCC_CYGWIN, GCC_MINGW) and value:
return ['-mwindows']
return []