aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/vs2010backend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-03-24 19:10:31 +0200
committerGitHub <noreply@github.com>2017-03-24 19:10:31 +0200
commit60034e87b20e71dcaa4fb795965d8477910c733c (patch)
treeb9415672429d031355df2b7536df719b25dc69d3 /mesonbuild/backend/vs2010backend.py
parent53795d89df48ca722b018ff8720669deb6209be4 (diff)
parent92ed60729070c5b94c34ab24b1553d40978b645d (diff)
downloadmeson-60034e87b20e71dcaa4fb795965d8477910c733c.zip
meson-60034e87b20e71dcaa4fb795965d8477910c733c.tar.gz
meson-60034e87b20e71dcaa4fb795965d8477910c733c.tar.bz2
Merge pull request #1491 from nioncode/vs2017
VS2017 backend
Diffstat (limited to 'mesonbuild/backend/vs2010backend.py')
-rw-r--r--mesonbuild/backend/vs2010backend.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 82c6463..07306aa 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -27,6 +27,29 @@ from ..compilers import CompilerArgs
from ..mesonlib import MesonException, File
from ..environment import Environment
+def autodetect_vs_version(build):
+ vs_version = os.getenv('VisualStudioVersion', None)
+ if vs_version:
+ if vs_version == '14.0':
+ from mesonbuild.backend.vs2015backend import Vs2015Backend
+ return Vs2015Backend(build)
+ if vs_version == '15.0':
+ from mesonbuild.backend.vs2017backend import Vs2017Backend
+ return Vs2017Backend(build)
+ raise MesonException('Could not detect Visual Studio (unknown Visual Studio version: "{}")!\n'
+ 'Please specify the exact backend to use.'.format(vs_version))
+
+ vs_install_dir = os.getenv('VSINSTALLDIR', None)
+ if not vs_install_dir:
+ raise MesonException('Could not detect Visual Studio (neither VisualStudioVersion nor VSINSTALLDIR set in '
+ 'environment)!\nPlease specify the exact backend to use.')
+
+ if 'Visual Studio 10.0' in vs_install_dir:
+ return Vs2010Backend(build)
+
+ raise MesonException('Could not detect Visual Studio (unknown VSINSTALLDIR: "{}")!\n'
+ 'Please specify the exact backend to use.'.format(vs_install_dir))
+
def split_o_flags_args(args):
"""
Splits any /O args and returns them. Does not take care of flags overriding
@@ -62,6 +85,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 +378,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')
@@ -598,6 +624,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')
@@ -1015,6 +1043,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"
@@ -1094,6 +1124,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')