aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNiklas Claesson <niklas.claesson@cosylab.com>2018-05-21 01:27:57 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-06-10 23:36:54 +0300
commit14716ea90c5b4c7b8309751196ede734739a8ee0 (patch)
tree308255ee874e06df2d98a683dad3619593f366c9 /mesonbuild
parent26e11f5fd88c2bb65fe692015cf9c6ae9afcbcf0 (diff)
downloadmeson-14716ea90c5b4c7b8309751196ede734739a8ee0.zip
meson-14716ea90c5b4c7b8309751196ede734739a8ee0.tar.gz
meson-14716ea90c5b4c7b8309751196ede734739a8ee0.tar.bz2
Visual Studio: Implement startup project
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/vs2010backend.py13
-rw-r--r--mesonbuild/coredata.py16
2 files changed, 24 insertions, 5 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index dc2660b..d42e91d 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -282,7 +282,7 @@ class Vs2010Backend(backends.Backend):
for dep in all_deps.keys():
guid = self.environment.coredata.target_guids[dep]
ofile.write('\t\t{%s} = {%s}\n' % (guid, guid))
- ofile.write('EndProjectSection\n')
+ ofile.write('\tEndProjectSection\n')
ofile.write('EndProject\n')
for dep, target in recursive_deps.items():
if prj[0] in default_projlist:
@@ -345,8 +345,12 @@ class Vs2010Backend(backends.Backend):
ofile.write('EndGlobal\n')
def generate_projects(self):
+ startup_project = self.environment.coredata.backend_options['backend_startup_project'].value
projlist = []
- for name, target in self.build.targets.items():
+ startup_idx = 0
+ for (i, (name, target)) in enumerate(self.build.targets.items()):
+ if startup_project and startup_project == target.get_basename():
+ startup_idx = i
outdir = Path(
self.environment.get_build_dir(),
self.get_target_dir(target)
@@ -359,6 +363,11 @@ class Vs2010Backend(backends.Backend):
proj_uuid = self.environment.coredata.target_guids[name]
self.gen_vcxproj(target, str(projfile_path), proj_uuid)
projlist.append((name, relname, proj_uuid))
+
+ # Put the startup project first in the project list
+ if startup_idx:
+ projlist = [projlist[startup_idx]] + projlist[0:startup_idx] + projlist[startup_idx + 1:-1]
+
return projlist
def split_sources(self, srclist):
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 7bedd13..4db8e4a 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -303,9 +303,19 @@ class CoreData:
def init_backend_options(self, backend_name):
if backend_name == 'ninja':
- self.backend_options['backend_max_links'] = UserIntegerOption('backend_max_links',
- 'Maximum number of linker processes to run or 0 for no limit',
- 0, None, 0)
+ self.backend_options['backend_max_links'] = \
+ UserIntegerOption(
+ 'backend_max_links',
+ 'Maximum number of linker processes to run or 0 for no '
+ 'limit',
+ 0, None, 0)
+ elif backend_name.startswith('vs'):
+ self.backend_options['backend_startup_project'] = \
+ UserStringOption(
+ 'backend_startup_project',
+ 'Default project to execute in Visual Studio',
+ '')
+
def get_builtin_option(self, optname):
if optname in self.builtins: