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.
We were adding them to the CompilerArgs instance in the order in which
they are specified, which is wrong because later dependencies would
override previous ones. Add them in the reverse order instead.
Closes https://github.com/mesonbuild/meson/issues/1495
The 'Visual Studio 2017' image does not include VS2010, so we have to use
the 'Visual Studio 2015' image by default and only use the 2017 image for
msvc2017 compiler tests.
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.
VS2015 automatically picks up outputs from CustomBuild commands, which we
now use instead of CustomBuildStep commands, which do not get picked up
automatically.
This changes how generated files are added to the VS project.
Previously, they were all added as a single CustomBuildStep with all
generator commands, inputs and outputs merged together.
Now, each input file is added separately to the project and is given a
CustomBuild command. This adds all generator input files to the files list
in the VS gui and allows to run only some of the generator commands if
only some of the input files have changed.
Because we are using check_output, if the command fails no output will
be printed at all. So, we use subprocess.run instead.
Also, on configure failures, print the meson-log.txt instead of stdout.
Also forcibly undefine __has_include and test that the fallback include
check in cc.has_header() works.
This is important because all the latest compilers support it now
and we might have no test coverage at all by accident. GCC 5, ICC 17,
Clang 3.8, and VS2015 Update 2 already support it.
We differ from cmake in the following manner:
* We only set the major version (SOVERSION) in the dylib
* If SOVERSION is not specified, we deduce it from version (VERSION)
See installed_files.txt for a list of output dylib names.
In this test, we try to manually link against the generated library to
create an executable and then run it to verify that it works.
Also test for all possible library versioning in the versioning tests on
Windows. Even though they yield the same dll naming, we should still
test it.
We check for the existence of PDB files in the install script, so we
don't need to do all this mucking about here. That's more robust too
because we don't need to parse build arguments in buildtype=plain
and decide if the PDB file would be generated.