From ad0ba6a911b9fcdca24379bb4f14b4b5a312a3d5 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Tue, 12 Mar 2019 13:36:33 +0800 Subject: [PATCH] Add VS2019 backend CI and docs. --- azure-pipelines.yml | 23 +++++++++++++ ci/azure-steps.yml | 7 +++- .../markdown/Configuring-a-build-directory.md | 2 +- docs/markdown/Reference-manual.md | 3 +- mesonbuild/backend/vs2010backend.py | 2 +- mesonbuild/backend/vs2019backend.py | 34 +++++++++++++++++++ 6 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 mesonbuild/backend/vs2019backend.py diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 483f1eb2b..3ec142e78 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -57,6 +57,29 @@ jobs: architecture: 'x64' - template: ci/azure-steps.yml +- job: vs2019 + pool: + vmImage: windows-2019 + + strategy: + matrix: + vc2019x64ninja: + arch: x64 + compiler: msvc2019 + backend: ninja + vc2019x64vs: + arch: x64 + compiler: msvc2019 + backend: vs2019 + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + addToPath: true + architecture: 'x64' + - template: ci/azure-steps.yml + - job: cygwin pool: vmImage: VS2017-Win2016 diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml index d0f6d0935..87ab337bf 100644 --- a/ci/azure-steps.yml +++ b/ci/azure-steps.yml @@ -99,6 +99,8 @@ steps: # import visual studio variables if ($env:compiler -eq 'msvc2015') { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" + } elseif($env:compiler -eq 'msvc2019') { + $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" } else { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" } @@ -154,7 +156,10 @@ steps: echo "" echo "=== Start running tests ===" - python run_tests.py --backend $(backend) + # Starting from VS2019 Powershell(?) will fail the test run + # if it prints anything to stderr. Python's test runner + # does that by default so we need to forward it. + cmd /c 'python 2>&1' run_tests.py --backend $(backend) - task: PublishTestResults@2 inputs: diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md index 73585e251..b0fb5740c 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -24,7 +24,7 @@ sample output for a simple project. Option Current Value Possible Values Description ------ ------------- --------------- ----------- auto_features auto [enabled, disabled, auto] Override value of all 'auto' features - backend ninja [ninja, vs, vs2010, vs2015, vs2017, xcode] Backend to use + backend ninja [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode] Backend to use buildtype release [plain, debug, debugoptimized, release, minsize, custom] Build type to use debug false [true, false] Debug default_library shared [shared, static, both] Default library type diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 6fa2dd4fe..056612dc9 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1553,7 +1553,8 @@ the following methods. `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` set. - `backend()` *(added 0.37.0)* returns a string representing the - current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, or `xcode`. + current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, `vs2019`, + or `xcode`. - `build_root()` returns a string with the absolute path to the build root directory. Note: this function will return the build root of diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 2ef8187ad..3b9f541b4 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -207,7 +207,7 @@ class Vs2010Backend(backends.Backend): if 'VCINSTALLDIR' in os.environ: vs_version = os.environ['VisualStudioVersion'] \ if 'VisualStudioVersion' in os.environ else None - relative_path = 'Auxiliary\\Build\\' if vs_version == '15.0' else '' + relative_path = 'Auxiliary\\Build\\' if vs_version >= '15.0' else '' script_path = os.environ['VCINSTALLDIR'] + relative_path + 'vcvarsall.bat' if os.path.exists(script_path): if has_arch_values: diff --git a/mesonbuild/backend/vs2019backend.py b/mesonbuild/backend/vs2019backend.py new file mode 100644 index 000000000..c6e78cbb3 --- /dev/null +++ b/mesonbuild/backend/vs2019backend.py @@ -0,0 +1,34 @@ +# Copyright 2014-2019 The Meson development team + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import xml.etree.ElementTree as ET + +from .vs2010backend import Vs2010Backend + + +class Vs2019Backend(Vs2010Backend): + def __init__(self, build): + super().__init__(build) + self.name = 'vs2019' + self.platform_toolset = 'v142' + self.vs_version = '2019' + # WindowsSDKVersion should be set by command prompt. + sdk_version = os.environ.get('WindowsSDKVersion', None) + if sdk_version: + self.windows_target_platform_version = sdk_version.rstrip('\\') + + def generate_debug_information(self, link): + # valid values for vs2019 is 'false', 'true', 'DebugFastLink', 'DebugFull' + ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'