Visual Studio: Implement startup project

pull/3376/head
Niklas Claesson 7 years ago committed by Jussi Pakkanen
parent 26e11f5fd8
commit 14716ea90c
  1. 30
      docs/markdown/Build-options.md
  2. 13
      mesonbuild/backend/vs2010backend.py
  3. 16
      mesonbuild/coredata.py

@ -21,6 +21,8 @@ option('free_array_opt', type : 'array', value : ['one', 'two'])
option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two'])
```
## Build option types
All types allow a `description` value to be set describing the option,
if no option is set then the name of the option will be used instead.
@ -40,7 +42,7 @@ A combo allows any one of the values in the `choices` parameter to be
selected. If no default value is set then the first value will be the
default.
## Integers
### Integers
An integer option contains a single integer with optional upper and
lower values that are specified with the `min` and `max` keyword
@ -135,3 +137,29 @@ project which also has an option called `some_option`, then calling
`get_option` returns the value of the superproject. If the value of
`yield` is `false`, `get_option` returns the value of the subproject's
option.
## Built-in build options
There are a number of built-in options. To get the current list execute `meson
configure` in the build directory.
### Visual Studio
#### Startup project
The backend\_startup\_project option can be set to define the default project
that will be executed with the "Start debugging F5" action in visual studio.
It should be the same name as an executable target name.
```meson
project('my_project', 'c', default_options: ['backend_startup_project=my_exe'])
executable('my_exe', ...)
```
### Ninja
#### Max links
The backend\_max\_links can be set to limit the number of processes that ninja
will use to link.

@ -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):

@ -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:

Loading…
Cancel
Save