Commit Graph

201 Commits

Author SHA1 Message Date
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
2019-04-25 12:28:51 -07:00
Dylan Baker add821db64 Don't use mutable types as default arguments
This isn't safe given the way python implements default arguments.
Basically python store a reference to the instance it was passed, and
then if that argument is not provided it uses the default. That means
that two calls to the same function get the same instance, if one of
them mutates that instance every subsequent call that gets the default
will receive the mutated instance. The idiom to this in python is to use
None and replace the None,

def in(value: str, container: Optional[List[str]]) -> boolean:
   return src in (container or [])

if there is no chance of mutation it's less code to use or and take
advantage of None being falsy. If you may want to mutate the value
passed in you need a ternary (this example is stupid):

def add(value: str, container: Optional[List[str]]) -> None:
    container = container if container is not None else []
    container.append(value)

I've used or everywhere I'm sure that the value will not be mutated by
the function and erred toward caution by using ternaries for the rest.
2019-04-23 02:03:19 +03:00
Jussi Pakkanen 4e4f97edb3 Can run argument strings with internal Python. Closes #5217. 2019-04-21 15:14:34 +03:00
Jussi Pakkanen ee863d33c1
Merge pull request #2601 from 1ace/feature/completion
Add completion scripts for Bash and Zsh
2019-03-04 18:40:13 +02:00
Daniel Mensinger 90b557e38a
rewriter: Remove command alias 2019-03-04 13:00:07 +01:00
Daniel Mensinger 9874ce81f0
rewriter: make flake8 happy 2019-03-04 13:00:06 +01:00
Daniel Mensinger c4708c28f2
better formating of the help output 2019-03-04 13:00:06 +01:00
Eric Engestrom b758f0a953 add note to keep completion scripts updated 2019-02-20 18:48:39 +00:00
Andrei Alexeyev 51dadb92d0 runpython: insert script's dir into import path
Fixes #4947
2019-02-18 22:09:32 +02:00
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Jussi Pakkanen e6df5a7586
Merge pull request #4719 from ocrete/fix-posix-lang
Replace surrogates with valid codepoints to print env
2019-01-17 00:40:56 +02:00
Olivier Crête 92b343f2f7 mesonmain: Force to output UTF-8 even when the locale isn't
Otherwise Python gets all confused and it makes testing difficult.

Also minimally emulate the behaviour of the normal object to make the rest
of the code happy.
2019-01-15 14:01:32 -05:00
Martin Hostettler 768fa502ac Add new meson.py unstable-coredata subcommand.
This adds a hidden option to dump the current otherwise hidden peristant
state in coredata.dat.

This interface is unstable as meson has no compatibility promises about
coredata.dat.
2019-01-07 22:55:45 +02:00
Xavier Claessens 60b58e056f Add 'meson subprojects update' command
This is inspired by gst-build's git-update script.
2018-12-02 08:37:32 -05:00
Xavier Claessens adae6b56de Hide 'rewrite' and 'runpython' commands from help 2018-10-04 09:40:21 -04:00
Xavier Claessens 37067a53c4 Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands,
making them discoverable. This also reduce the manual parsing of
arguments to the strict minimum needed for backward compatibility.
2018-10-04 09:40:21 -04:00
Xavier Claessens 5af2717e76 Simplify run_script_command() 2018-10-04 09:40:21 -04:00
Xavier Claessens f8913d1d28 Move setup command handling to its own msetup.py file 2018-10-04 09:40:21 -04:00
Xavier Claessens 246d5d86f5 Move set_meson_command() to mesonlib 2018-10-04 09:39:26 -04:00
Xavier Claessens 2f0285c7ef Return code 0 when builddir is already configured
This is a regression in Meson 0.48.0, commit 674ae46, Meson used to
exit(0) when running setup command in a builddir already configured.
Changing to exit(1) breaks some build tools that does "meson builddir
&& ninja -C builddir".

Closes #4247.
2018-09-24 10:58:53 -04:00
Xavier Claessens 674ae466c8 mesonmain: Add --reconfigure argument
Allows to manually reconfigure a project the same way backends would do
(e.g. ninja reconfigure). This has the advantage that new options can be
set using "meson --reconfigure -Dfoo=bar" and solve situations where a
project cannot be reconfigured because new options has been added with
the wrong default value.

Fixes #3543.
2018-09-05 12:54:19 -04:00
Xavier Claessens 8de60f9078 mesonmain: Move builddir/sourcedir handling code inside MesonApp 2018-09-05 12:53:56 -04:00
Xavier Claessens ef231d3edd Add --fatal-meson-warnings command line option
This makes any warning message printed by meson raise an exception,
intended to be used by CI and developpers to easily catch deprecation
warnings and other potential issues.
2018-09-04 09:01:39 -04:00
Jussi Pakkanen b86f2fd17f
Merge pull request #4016 from thiblahute/hotdoc
modules: Add an 'hotdoc' module
2018-08-29 21:18:26 +03:00
Thibault Saunier 378bd4df0e modules: Add an 'hotdoc' module
hotdoc: http://github.com/hotdoc/hotdoc/
2018-08-28 18:18:40 -03:00
Xavier Claessens 05cab3dee5 Set wrap_mode to None by default to know if user passed a value 2018-08-22 15:15:54 -04:00
Xavier Claessens 55bbb3600f mesonmain: Use MesonException instead of RuntimeError in MesonApp init 2018-08-22 15:15:54 -04:00
Nirbheek Chauhan 2ee28029f9 Install meson.exe as the entrypoint on Windows
Thanks to Rafael Rivera for the suggestion

Fixes https://github.com/mesonbuild/meson/issues/1877
2018-08-11 03:19:57 +05:30
Jussi Pakkanen 09ad29ec56 Fix directory verification. Closes #3857. 2018-07-09 23:14:59 +02:00
Nirbheek Chauhan e4417eb301 mlog: Log timestamps in profile-self mode
This makes it much clearer which statements are taking a long time,
and helps in interpreting the outputted profile itself.
2018-07-06 06:25:12 +00:00
Jussi Pakkanen ce7cdadd37 Fix glib build when using MSI installer. Closes #3762. 2018-06-26 23:01:52 +03:00
Niklas Claesson 9620755ff7 Print default option values that don't match the current value 2018-06-21 00:56:30 +03:00
Jussi Pakkanen 6a21e19515 Refactored installer to use a class to eradicate global variables. 2018-06-18 22:12:13 +03:00
Jussi Pakkanen 6cf79f86ee Made install a top level Meson command. 2018-06-18 22:02:56 +03:00
Xavier Claessens 7fbe10ac8d mesonmain: Take only 2 optional directories
If only 1 dir is provided, the 2nd defaults to '.' and if none is
provided they default to '.' and '..'. It should be builddir first,
followed by sourcedir, but validate_core_dirs() will still swap them if
builddir contains a meson.build file.
2018-06-06 20:02:37 +00:00
Xavier Claessens f4d60acaa9 Remove had_argument_for() it is not used anymore
This also means we don't need to keep original command line arguments
anymore.
2018-06-06 20:02:37 +00:00
Xavier Claessens 75e501ceb8 coredata: Stop setting default option values as argparse attribute
All options are now the projectoptions list, regardless of how they got
defined in the command line.

This also delays setting builtin option values until the main project()
default options are parsed to simplify the code. This is possible
because we already delayed setting the backend after parsing main
project() in a previous commit.
2018-06-06 20:02:37 +00:00
Xavier Claessens 5af98d16b9 Delay backend creation until project() is parsed
The project() function could have a different value for the backend
option in its default_options kwargs.

Also set backend options, passing them in command line had no effect
previously.
2018-06-06 20:02:37 +00:00
Nirbheek Chauhan 8e8d3231ad Link to our Getting-meson page instead of python.org [skip ci] 2018-06-03 18:59:24 +00:00
Nirbheek Chauhan 107e061506 Error out when someone tries to use msys/python to run Meson
This mistake seems to be a very common hiccup for people trying to use
Meson with MSYS2 on Windows from git or with pip.

msys/python uses POSIX paths with '/' as the root instead of a drive
like `C:/`, and also does not identify the platform as Windows.

This means that configure checks will be wrong, and many build tools
will be unable to parse the paths that are returned by functions in
Python such as shutil.which.

Closes https://github.com/mesonbuild/meson/issues/3653
2018-06-03 18:59:24 +00:00
Nirbheek Chauhan 0a035dea6d Set the meson command to use when we know what it is
Instead of using fragile guessing to figure out how to invoke meson,
set the value when meson is run. Also rework how we pass of
meson_script_launcher to regenchecker.py -- it wasn't even being used

With this change, we only need to guess the meson path when running
the tests, and in that case:

1. If MESON_EXE is set in the env, we know how to run meson
   for project tests.
2. MESON_EXE is not set, which means we run the configure in-process
   for project tests and need to guess what meson to run, so either
   - meson.py is found next to run_tests.py, or
   - meson, meson.py, or meson.exe is in PATH

Otherwise, you can invoke meson in the following ways:

1. meson is installed, and mesonbuild is available in PYTHONPATH:
   - meson, meson.py, meson.exe from PATH
   - python3 -m mesonbuild.mesonmain
   - python3 /path/to/meson.py
   - meson is a shell wrapper to meson.real
2. meson is not installed, and is run from git:
   - Absolute path to meson.py
   - Relative path to meson.py
   - Symlink to meson.py

All these are tested in test_meson_commands.py, except meson.exe since
that involves building the meson msi and installing it.
2018-06-01 19:20:04 +00:00
Nirbheek Chauhan f56b402a5b Revert "mesonlib: handle meson exe wrappers"
This reverts commit 0627e9d616.

Breaks installation: https://github.com/mesonbuild/meson/issues/3647

Will be restored once that can be fixed.
2018-05-31 15:40:10 +05:30
Martin Kelly 0627e9d616 mesonlib: handle meson exe wrappers
There are cases when it is useful to wrap the main meson executable with
a script that sets up environment variables, passes --cross-file, etc.
For example, in a Yocto SDK, we need to point to the right meson.cross
so that everything "just works", and we need to alter CC, CXX, etc. In
such cases, it can happen that the "meson" found in the path is actually
a wrapper script that invokes the real meson, which may be in another
location (e.g. "meson.real" or similar).

Currently, in such a situation, meson gets confused because it tries to
invoke itself using the "meson" executable (which points to the wrapper
script) instead of the actual meson (which may be called "meson.real" or
similar). In fact, the wrapper script is not necessarily even Python, so
the whole thing fails.

Fix this by using Python imports to directly find mesonmain.py instead
of trying to detect it heuristically. In addition to fixing the wrapper
issue, this should make the detection logic much more robust.
2018-05-30 18:29:16 +00:00
Nirbheek Chauhan a6c9f98c57 depfixer: We no longer run this as a script 2018-05-24 14:38:28 +00:00
Jussi Pakkanen e3be7f7021 Write coredata transactionally. Closes #3511. 2018-05-21 00:48:25 +03:00
Jussi Pakkanen d52f892de9
Merge pull request #3485 from xclaesse/warnlevel
--warnlevel got renamed to --warning-level
2018-04-29 20:27:43 +03:00
Nirbheek Chauhan 900c23f98a New argument: --profile-self for profiling performance
Outputs two profile logs: one for the interpreter run and another for
the backend-specific build file generation. Both are stored in
meson-private in the build directory.
2018-04-27 23:14:16 +03:00
Xavier Claessens 570c108635 Fix --warnlevel being renamed to --warning-level in latest release 2018-04-27 11:09:14 -04:00
Xavier Claessens cb5ad2f211 Remove duplicated definition of -D cmdline arg 2018-04-26 22:46:40 -04:00
Dylan Baker 8120ff9cf7 Move builtin_argument_registration to coredata
We're going to want to use these functions in meson configure as well to
make the command line options the same between `meson` and `meson
configure`.
2018-04-17 11:32:26 -07:00
Dylan Baker 78e37c4953 Accept builtin options with -D when making initial meson call
Currently meson only accepts `-Dopt=value` for builtin options when
calling `meson configure` and `--opt=value` for builtin options when
calling `meson` initially. This is a confusing behavior, and users only
get a small warning at the top of a potentially long configuration
summary to catch this.

This has confused end users and developers alike, there are at least 5
duplicates of the bug this fixes, and I have personally been asked about
this more times than I can count. The help documentation doesn't make
it clear that -D cannot be used to set options like prefix and bindir.

This adds support for -D options to the initial meson call, but not --
options to the meson configure call. I think it's better to have one way
to do things, and -- options are kinda one off while -D is used
everywhere else, so lets stick with that.

Related #969
2018-04-17 11:32:26 -07:00
Dylan Baker cdefc15285 mesonmain: be DRY
We have all the information needed to calculate the builtin arguments in
the coredata module already, don't duplicate that in the mesonmain
module as well.
2018-04-17 11:32:26 -07:00
Dylan Baker 1452eb73c1 coredata: encapsulate destination name
This means that there are no special args passed ot builtin args
anymore.
2018-04-17 11:32:26 -07:00
Dylan Baker bbf71d9aa3 coredata: Add helper for setting action
Currently we manually pass the argparse action, this isn't very DRY,
since the builtin_types already has all the data necessary to find that.
This adds a new function to determine the action based on the default
type.
2018-04-17 11:32:26 -07:00
Jussi Pakkanen bdb57cf62a Convert Gnome module to use find_program from interpreter. 2018-04-15 13:32:38 +05:30
Jussi Pakkanen 58156ef7cf Grab a file lock on the build dir during modifications. 2018-03-20 22:28:37 +02:00
Jukka Laurila 52c50da6c7 Refactor: Add log.error and log.exception to reduce code duplication. 2018-03-10 18:04:52 +02:00
Jukka Laurila 048508c989 Make "meson help" and "meson help <subcommand>" do the expected thing. 2018-03-06 14:02:55 +02:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00
Jon Turney 2a64ed855e Verify that failing tests are failing with an error, not a python exception
PR #2527 suggests "making failing tests more strict about failing
gracefully".

To achive this, make meson exit with distinct exit statuses for meson errors
and python exceptions, and check the exit status is as expected for failing
tests.

I can't see how to write a test for this, within the current framework.

You can test this change by reverting the fix (but not the test) from commit
1a159db8 and verifying that 'test cases/failing/66 string as link target'
fails.
2018-02-15 12:51:24 +00:00
Jon Turney c027bb2c42 Ensure any generation error appears in the logfile and thus in CI output
Since c2a5ac39, MesonApp.generate() closes the logfile before returning,
which means that when invoked by mesonmain.run(), any MesonException is not
logged there.

MesonApp.generate() does not appear to have any other users I can find.

This somewhat reduces the diagnostic value of the logfile.

This also interacts badly with running project tests in CI, as _run_tests
chooses to report the logfile contents, rather than stdout, for the
configure step, and it thus doesn't report any configure error which caused
a test failure.
2018-02-14 19:15:30 +02:00
Jon Turney 6a1a56ab57 Report warning/error locations in a format IDEs may already know how to parse
Examples:

meson.build:2:0: ERROR: Dependency is both required and not-found
meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.

These are already matched by the default compilation-error-regexp-alist in
emacs.

Also:
Don't start 'red' markup until after the \n before an error
Unabsorb full-stop at end of warning with location from mlog.warning()
Update warning_location test
2018-01-30 06:48:22 +11:00
Jussi Pakkanen 3bea6eeae8 Removed duplicate if branch. 2018-01-18 19:39:22 +02:00
Jussi Pakkanen 0538009d30 Bump minimum supported Python from 3.4 to 3.5. 2018-01-04 21:29:02 +02:00
Jussi Pakkanen d2b68d31dd Added init command that creates a sample exe project. 2017-12-31 23:18:08 +02:00
Gabríel Arthúr Pétursson 2fc3fc8d67 Remember which Visual Studio backend was auto-detected
This fixes the REGEN build target since VSINSTALLDIR does not get set by
Visual Studio when building targets.

Fixes #2848.
2017-12-30 14:03:59 +00:00
Dylan Baker e1c9d2f53a mesonmain: Remove useless ternary
This ternary checks the value of a bool, and returns the same value.
2017-12-19 10:10:40 -08:00
Dylan Baker 8a1a866c68 Don't print traceback when options are invalid
Currently passing a bad combo or array option, providing a non-boolean
to a bool arg, or a host of other things can cause an traceback from a
MesonException, don't do that.

Fixes #2683
2017-11-28 21:41:06 +02:00
Jussi Pakkanen 105ea1e597 Make the full test suite runnable with an external command. 2017-11-20 23:14:45 +02:00
Jussi Pakkanen 5d51bc79c7 Replaced sys.executable use with the mesonlib equivalent. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen a437cd1955 Add command to run Python scripts with the current interpreter. 2017-11-20 23:08:17 +02:00
Jussi Pakkanen 69bd87a716
Merge pull request #2511 from jon-turney/prefix-dependent-defaults
Make sysconfdir, localstatedir and sharedstatedir defaults depend on prefix
2017-11-13 21:14:59 +02:00
Eric Engestrom 5f7f5cdb05 Print correct command in help message
Taking mconf for instance:
before:
  $ meson configure --help
  usage: meson [-h] [-D SETS] [--clearcache] [directory [directory ...]]
after:
  $ meson configure --help
  usage: meson configure [-h] [-D SETS] [--clearcache] [directory [directory ...]]
2017-11-09 21:12:34 +02:00
Elliott Sales de Andrade 6715087598 Dump coredata earlier.
Unfortunately, `time.time` and file timestamps are not guaranteed to be
in sync and due to various kernel caches may be different enough to
cause rebuilds to fail [1]. This was masked by older ninja versions that
could not read sub-second timestamps.

[1] https://travis-ci.org/mesonbuild/meson/jobs/296797872
2017-11-06 20:56:53 +02:00
Jon Turney 24549dbed5 Make sysconfdir, localstatedir and sharedstatedir defaults depend on prefix
Rather than requiring a bit of boilerplate in every meson.build, which is
only documented in a comment in mesoncore.py, use sensible defaults for
sysconfdir, localstatedir and sharedstatedir depending on the prefix.

Fixes #1637

v2:
For clarity, give get_builtin_option_default() a noneIfSuppress argument,
rather than overloading prefix '' and None with special meanings.
2017-10-28 23:27:36 +01:00
Luke Shumaker bb25260f00 flake8: Perform suggested whitespace/formatting changes
This only touches newlines, spaces, and (occaisionally) commas.  Anything
else is left for another commit.
2017-09-21 11:59:03 -04:00
Nirbheek Chauhan f04d141088 logging: Print location of log file on error
Similar to configure

Closes https://github.com/mesonbuild/meson/issues/2316
2017-09-14 18:29:30 +03:00
Chet Gurevitch e5e060a6b7 Update message for already configured builddir 2017-09-12 20:30:26 +03:00
Nirbheek Chauhan 6cf5cb5842 wrap-mode: Make the error output more useful
Now it errors out while displaying the possible options

See: https://bugs.python.org/issue25061 for native support
2017-09-07 19:05:38 +03:00
Jussi Pakkanen 511a370856 Merge pull request #2163 from chetgurevitch/master
Don't error if build directory is already configured and update instructions
2017-08-20 23:18:39 +03:00
Jussi Pakkanen c2a5ac3981 Ensure log file gets closed. 2017-08-18 12:08:50 +03:00
Chet Gurevitch 2da2c92698 Tell users about ninja rebuild and meson configure 2017-08-18 01:30:11 -07:00
Chet Gurevitch 0ec2e530e1 Don't error if build directory is already configured 2017-08-18 01:22:39 -07:00
Jussi Pakkanen 59a35c4c53 Print deprecation warnings on old style commands. 2017-08-02 22:01:13 +03:00
Jussi Pakkanen fa278f351f Add command multiplexer to main Meson invoker. 2017-08-02 22:00:09 +03:00
Elliott Sales de Andrade b52955ff3d Run postconf scripts after dumping coredata.
MESONINTROSPECT is set when running postconf scripts, which implies that
introspection is possible. But it isn't really possible because coredata
hasn't been written yet. We also still need to make sure to delete
coredata if any postconf scripts fail.
2017-07-15 13:47:17 +02:00
Nirbheek Chauhan 627190faf3 Add an env var to force meson to print a backtrace
This is really useful when debugging test failures. Without a stack
trace, you have to grep the source code for the error message.

Also set this in run_tests.py.
2017-06-09 20:21:01 +05:30
Alistair Thomas a195b78c8d Whitespace tweaks to reduce Flake8 warnings 2017-05-29 19:32:47 +03:00
Jussi Pakkanen 8d2fbf8084 Clarify multiple uses of -D. Closes #1836. 2017-05-26 23:22:56 +03:00
Jussi Pakkanen 111e3df45d Moved coverage commands to a standalone script. 2017-05-13 22:54:08 +03:00
Jussi Pakkanen 255be79e22 Created a dist target. Closes #877. 2017-05-11 19:34:16 +03:00
Jussi Pakkanen 0e3aa5a348 Merge pull request #1587 from mesonbuild/tingping/msgfmt-datadir
i18n: Improve data_dirs support
2017-05-03 18:51:55 +03:00
Jussi Pakkanen 9d69c934d6 Expand input paths so they do not contain symlinks. 2017-05-02 22:05:31 +03:00
Dylan Baker a8173630ea Don't use len() to test emptiness vs not emptiness
Meson has a common pattern of using 'if len(foo) == 0:' or
'if len(foo) != 0:', however, this is a common anti-pattern in python.
Instead tests for emptiness/non-emptiness should be done with a simple
'if foo:' or 'if not foo:'

Consider the following:
>>> import timeit
>>> timeit.timeit('if len([]) == 0: pass')
0.10730923599840025
>>> timeit.timeit('if not []: pass')
0.030033907998586074
>>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass')
0.1154778649979562
>>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass")
0.08259823200205574
>>> timeit.timeit('if len("") == 0: pass')
0.089759664999292
>>> timeit.timeit('if not "": pass')
0.02340641999762738
>>> timeit.timeit('if len("foo") == 0: pass')
0.08848102600313723
>>> timeit.timeit('if not "foo": pass')
0.04032287199879647

And for the one additional case of 'if len(foo.strip()) == 0', which can
be replaced with 'if not foo.isspace()'
>>> timeit.timeit('if len("   ".strip()) == 0: pass')
0.15294511600222904
>>> timeit.timeit('if "   ".isspace(): pass')
0.09413968399894657
>>> timeit.timeit('if len("   abc".strip()) == 0: pass')
0.2023209120015963
>>> timeit.timeit('if "   abc".isspace(): pass')
0.09571301700270851

In other words, it's always a win to not use len(), when you don't
actually want to check the length.
2017-05-02 21:57:26 +03:00
Patrick Griffis 82492f5d76 i18n: Add data_dirs kwarg to merge_file()
For parity with gettext()

Fixes #1565
2017-04-29 04:05:20 -04:00
Jussi Pakkanen b48daeda1a Make it possible to only do unity builds on subprojects. 2017-04-15 18:28:36 +03:00
Jussi Pakkanen e4c224bdc1 Merge pull request #1516 from centricular/git-submodule-subprojects
Add support for using git submodules as subprojects
2017-03-25 18:24:38 +02:00
Nirbheek Chauhan d5975cc683 wrap: Implement special wrap modes for use by packagers
Special wrap modes:
  nofallback: Don't download wraps for dependency() fallbacks
  nodownload: Don't download wraps for all subproject() calls

Subprojects are used for two purposes:
1. To download and build dependencies by using .wrap files if they
   are not provided by the system. This is usually expressed via
   dependency(..., fallback: ...).
2. To download and build 'copylibs' which are meant to be used by
   copying into your project. This is always done with an explicit
   subproject() call.

--wrap-mode=nofallback will never do (1)
--wrap-mode=nodownload will do neither (1) nor (2)

If you are building from a release tarball, you should be able to
safely use 'nodownload' since upstream is expected to ship all
required sources with the tarball.

If you are building from a git repository, you will want to use
'nofallback' so that any 'copylib' wraps will be download as
subprojects.

Note that these options do not affect subprojects that are git
submodules since those are only usable in git repositories, and you
almost always want to download them.
2017-03-25 06:57:30 +05:30
Nicolas Schneider 92ed607290 add 'vs' backend that automatically chooses between the vs backends
For newer VS versions, we can simply rely on 'VisualStudioVersion' being
set in the environment.
For VS2010, we fall back to check 'VSINSTALLDIR' for the version string.
If the backend can not be auto detected, we raise an exception to make the
user choose an explicit backend.
We also print the detected backend to the meson log.
2017-03-23 10:34:32 +01:00
Nicolas Schneider 994696e0ad add vs2017 backend
VS2017 requires the 'WindowsTargetPlatformVersion' property to be set.
We gather the version to use from the environment variable
'WindowsSDKVersion' that will be set by the VS developer command prompt.
2017-03-22 11:05:28 +01:00