aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends.py8
-rw-r--r--build.py6
-rw-r--r--test cases/windows/2 winmain/meson.build2
-rw-r--r--test cases/windows/4 winmaincpp/meson.build2
4 files changed, 14 insertions, 4 deletions
diff --git a/backends.py b/backends.py
index f46bfdf..9bb3ae7 100644
--- a/backends.py
+++ b/backends.py
@@ -1366,6 +1366,7 @@ class Vs2010Backend(Backend):
proj_to_src_root = os.path.join(down, self.build_to_src)
proj_to_src_dir = os.path.join(proj_to_src_root, target.subdir)
(sources, headers) = self.split_sources(target.sources)
+ entrypoint = 'WinMainCRTStartup'
buildtype = 'Debug'
platform = "Win32"
project_name = target.name
@@ -1373,11 +1374,14 @@ class Vs2010Backend(Backend):
subsystem = 'Windows'
if isinstance(target, build.Executable):
conftype = 'Application'
- subsystem = 'Console'
+ if not target.gui_app:
+ subsystem = 'Console'
+ entrypoint = 'mainCRTStartup'
elif isinstance(target, build.StaticLibrary):
conftype = 'StaticLibrary'
elif isinstance(target, build.SharedLibrary):
conftype = 'DynamicLibrary'
+ entrypoint = '_DllMainCrtStartup'
else:
raise MesonException('Unknown target type for %s' % target_name)
root = ET.Element('Project', {'DefaultTargets' : "Build",
@@ -1485,7 +1489,7 @@ class Vs2010Backend(Backend):
pdb = ET.SubElement(link, 'ProgramDataBaseFileName')
pdb.text = '$(OutDir}%s.pdb' % target_name
if isinstance(target, build.Executable):
- ET.SubElement(link, 'EntryPointSymbol').text = 'mainCRTStartup'
+ ET.SubElement(link, 'EntryPointSymbol').text = entrypoint
targetmachine = ET.SubElement(link, 'TargetMachine')
targetmachine.text = 'MachineX86'
diff --git a/build.py b/build.py
index be50b39..53c1e9a 100644
--- a/build.py
+++ b/build.py
@@ -266,6 +266,12 @@ class BuildTarget():
if not isinstance(main_class, str):
raise InvalidArguments('Main class must be a string')
self.main_class = main_class
+ if isinstance(self, Executable):
+ self.gui_app = kwargs.get('gui_app', False)
+ if not isinstance(self.gui_app, bool):
+ raise InvalidArguments('Argument gui_app must be boolean.')
+ elif 'gui_app' in kwargs:
+ raise InvalidArguments('Argument gui_app can only be used on executables.')
def get_subdir(self):
return self.subdir
diff --git a/test cases/windows/2 winmain/meson.build b/test cases/windows/2 winmain/meson.build
index ed5c2c8..ea0d23b 100644
--- a/test cases/windows/2 winmain/meson.build
+++ b/test cases/windows/2 winmain/meson.build
@@ -1,4 +1,4 @@
project('winmain', 'c')
-exe = executable('prog', 'prog.c')
+exe = executable('prog', 'prog.c', gui_app : true)
test('winmain', exe)
diff --git a/test cases/windows/4 winmaincpp/meson.build b/test cases/windows/4 winmaincpp/meson.build
index 7644489..4eda8ca 100644
--- a/test cases/windows/4 winmaincpp/meson.build
+++ b/test cases/windows/4 winmaincpp/meson.build
@@ -1,4 +1,4 @@
project('winmaincpp', 'cpp')
-exe = executable('prog', 'prog.cpp')
+exe = executable('prog', 'prog.cpp', gui_app : true)
test('winmaincpp', exe)