From 3bedca025717aec3266450feb1d472d4169b68cd Mon Sep 17 00:00:00 2001 From: Nicolas Schneider Date: Thu, 26 May 2016 00:03:02 +0200 Subject: [PATCH] add vs2015 backend --- mesonbuild/backend/vs2010backend.py | 15 +++++++++++++++ mesonbuild/coredata.py | 3 ++- mesonbuild/mesonmain.py | 4 +++- run_tests.py | 7 ++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 355798d9b..54ae35cc3 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -39,6 +39,7 @@ class Vs2010Backend(backends.Backend): super().__init__(build) self.project_file_version = '10.0.30319.1' self.sources_conflicts = {} + self.platform_toolset = None def object_filename_from_source(self, target, source): basename = os.path.basename(source.fname) @@ -309,6 +310,8 @@ class Vs2010Backend(backends.Backend): ET.SubElement(type_config, 'ConfigurationType') ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' + if self.platform_toolset: + ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') @@ -441,6 +444,8 @@ class Vs2010Backend(backends.Backend): type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') ET.SubElement(type_config, 'ConfigurationType').text = conftype ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' + if self.platform_toolset: + ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset ET.SubElement(type_config, 'WholeProgramOptimization').text = 'false' ET.SubElement(type_config, 'UseDebugLibraries').text = 'true' ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') @@ -691,6 +696,8 @@ class Vs2010Backend(backends.Backend): ET.SubElement(type_config, 'ConfigurationType').text = "Utility" ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' + if self.platform_toolset: + ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') @@ -768,6 +775,8 @@ if %%errorlevel%% neq 0 goto :VCEnd''' ET.SubElement(type_config, 'ConfigurationType') ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' ET.SubElement(type_config, 'UseOfMfc').text = 'false' + if self.platform_toolset: + ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') direlem = ET.SubElement(root, 'PropertyGroup') fver = ET.SubElement(direlem, '_ProjectFileVersion') @@ -811,3 +820,9 @@ if %%errorlevel%% neq 0 goto :VCEnd''' # ElementTree can not do prettyprinting so do it manually #doc = xml.dom.minidom.parse(ofname) #open(ofname, 'w').write(doc.toprettyxml()) + + +class Vs2015Backend(Vs2010Backend): + def __init__(self, build): + super().__init__(build) + self.platform_toolset = 'v140' diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 8227340fd..287d29a3c 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -16,6 +16,7 @@ import pickle, os, uuid from .mesonlib import MesonException, default_libdir, default_libexecdir, default_prefix version = '0.32.0.dev1' +backendlist = ['ninja', 'vs2010', 'vs2015', 'xcode'] class UserOption: def __init__(self, name, description, choices): @@ -209,7 +210,7 @@ builtin_options = { 'warning_level' : [ UserComboOption, 'Compiler warning level to use.', [ '1', '2', '3' ], '1'], 'layout' : [ UserComboOption, 'Build directory layout.', ['mirror', 'flat' ], 'mirror' ], 'default_library' : [ UserComboOption, 'Default library type.', [ 'shared', 'static' ], 'shared' ], - 'backend' : [ UserComboOption, 'Backend to use.', [ 'ninja', 'vs2010', 'xcode' ], 'ninja' ], + 'backend' : [ UserComboOption, 'Backend to use.', backendlist, 'ninja' ], 'stdsplit' : [ UserBooleanOption, 'Split stdout and stderr in test logs.', True ], 'errorlogs' : [ UserBooleanOption, "Whether to print the logs from failing tests.", False ], } diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 4f8314ca6..f840543ef 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -23,7 +23,6 @@ import platform from . import mlog, coredata from .mesonlib import MesonException -backendlist = ['ninja', 'vs2010', 'xcode'] parser = argparse.ArgumentParser() @@ -139,6 +138,9 @@ itself as required.''' elif self.options.backend == 'vs2010': from .backend import vs2010backend g = vs2010backend.Vs2010Backend(b) + elif self.options.backend == 'vs2015': + from .backend import vs2010backend + g = vs2010backend.Vs2015Backend(b) elif self.options.backend == 'xcode': from .backend import xcodebackend g = xcodebackend.XCodeBackend(b) diff --git a/run_tests.py b/run_tests.py index 131738099..abff831cd 100755 --- a/run_tests.py +++ b/run_tests.py @@ -31,7 +31,7 @@ import time import multiprocessing import concurrent.futures as conc -from mesonbuild.mesonmain import backendlist +from mesonbuild.coredata import backendlist class TestResult: def __init__(self, msg, stdo, stde, conftime=0, buildtime=0, testtime=0): @@ -100,6 +100,11 @@ def setup_commands(backend): compile_commands = ['msbuild'] test_commands = ['msbuild', 'RUN_TESTS.vcxproj'] install_commands = [] + elif backend == 'vs2015': + backend_flags = ['--backend=vs2015'] + compile_commands = ['msbuild'] + test_commands = ['msbuild', 'RUN_TESTS.vcxproj'] + install_commands = [] elif backend == 'xcode' or (backend is None and mesonlib.is_osx()): backend_flags = ['--backend=xcode'] compile_commands = ['xcodebuild']