aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNicolas Schneider <nioncode+git@gmail.com>2017-03-22 09:59:09 +0100
committerNicolas Schneider <nioncode+git@gmail.com>2017-03-22 11:05:28 +0100
commit994696e0ad9adc6e25e8ae77c0f84f8998789e3f (patch)
tree0f017cd0f1d40bf6d7ed6bfe89bf08d7960290ff /mesonbuild
parentd9cabe9f0ca6fb06808c1d5cf5206a7c5158517e (diff)
downloadmeson-994696e0ad9adc6e25e8ae77c0f84f8998789e3f.zip
meson-994696e0ad9adc6e25e8ae77c0f84f8998789e3f.tar.gz
meson-994696e0ad9adc6e25e8ae77c0f84f8998789e3f.tar.bz2
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.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/vs2010backend.py9
-rw-r--r--mesonbuild/backend/vs2017backend.py27
-rw-r--r--mesonbuild/coredata.py2
-rw-r--r--mesonbuild/mesonmain.py3
4 files changed, 40 insertions, 1 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index e1f7325..6b4859d 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -62,6 +62,7 @@ class Vs2010Backend(backends.Backend):
self.sources_conflicts = {}
self.platform_toolset = None
self.vs_version = '2010'
+ self.windows_target_platform_version = None
def object_filename_from_source(self, target, source):
basename = os.path.basename(source.fname)
@@ -354,6 +355,8 @@ class Vs2010Backend(backends.Backend):
p.text = self.platform
pname = ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
+ if self.windows_target_platform_version:
+ ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
ET.SubElement(type_config, 'ConfigurationType')
@@ -589,6 +592,8 @@ class Vs2010Backend(backends.Backend):
p.text = self.platform
pname = ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
+ if self.windows_target_platform_version:
+ ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
# Start configuration
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
@@ -1006,6 +1011,8 @@ class Vs2010Backend(backends.Backend):
p.text = self.platform
pname = ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
+ if self.windows_target_platform_version:
+ ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
ET.SubElement(type_config, 'ConfigurationType').text = "Utility"
@@ -1085,6 +1092,8 @@ if %%errorlevel%% neq 0 goto :VCEnd'''
p.text = self.platform
pname = ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
+ if self.windows_target_platform_version:
+ ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
ET.SubElement(type_config, 'ConfigurationType')
diff --git a/mesonbuild/backend/vs2017backend.py b/mesonbuild/backend/vs2017backend.py
new file mode 100644
index 0000000..8301790
--- /dev/null
+++ b/mesonbuild/backend/vs2017backend.py
@@ -0,0 +1,27 @@
+# Copyright 2014-2016 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
+
+from .vs2010backend import Vs2010Backend
+
+
+class Vs2017Backend(Vs2010Backend):
+ def __init__(self, build):
+ super().__init__(build)
+ self.name = 'vs2017'
+ self.platform_toolset = 'v141'
+ self.vs_version = '2017'
+ # WindowsSDKVersion should be set by command prompt.
+ self.windows_target_platform_version = os.getenv('WindowsSDKVersion', None)
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index e88cdc8..0d2af69 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -18,7 +18,7 @@ from .mesonlib import MesonException, commonpath
from .mesonlib import default_libdir, default_libexecdir, default_prefix
version = '0.40.0.dev1'
-backendlist = ['ninja', 'vs2010', 'vs2015', 'xcode']
+backendlist = ['ninja', 'vs2010', 'vs2015', 'vs2017', 'xcode']
class UserOption:
def __init__(self, name, description, choices):
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 031486c..38c00a0 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -151,6 +151,9 @@ If you want to change option values, use the mesonconf tool instead.'''
elif self.options.backend == 'vs2015':
from .backend import vs2015backend
g = vs2015backend.Vs2015Backend(b)
+ elif self.options.backend == 'vs2017':
+ from .backend import vs2017backend
+ g = vs2017backend.Vs2017Backend(b)
elif self.options.backend == 'xcode':
from .backend import xcodebackend
g = xcodebackend.XCodeBackend(b)