diff options
Diffstat (limited to 'src/engine/SCons/Tool/MSCommon')
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/__init__.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/arch.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/common.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/netframework.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/sdk.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vc.py | 30 | ||||
-rw-r--r-- | src/engine/SCons/Tool/MSCommon/vs.py | 105 |
7 files changed, 83 insertions, 72 deletions
diff --git a/src/engine/SCons/Tool/MSCommon/__init__.py b/src/engine/SCons/Tool/MSCommon/__init__.py index 6efdcce..9d09b66 100644 --- a/src/engine/SCons/Tool/MSCommon/__init__.py +++ b/src/engine/SCons/Tool/MSCommon/__init__.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2014/07/05 09:42:21 garyo" __doc__ = """ Common functions for Microsoft Visual Studio and Visual C/C++. diff --git a/src/engine/SCons/Tool/MSCommon/arch.py b/src/engine/SCons/Tool/MSCommon/arch.py index 3fc4eed..4edeea7 100644 --- a/src/engine/SCons/Tool/MSCommon/arch.py +++ b/src/engine/SCons/Tool/MSCommon/arch.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 2014/07/05 09:42:21 garyo" __doc__ = """Module to define supported Windows chip architectures. """ diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index 006e17e..4bccae7 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2014/07/05 09:42:21 garyo" __doc__ = """ Common helper functions for working with the Microsoft tool chain. diff --git a/src/engine/SCons/Tool/MSCommon/netframework.py b/src/engine/SCons/Tool/MSCommon/netframework.py index fef75eb..1ff9654 100644 --- a/src/engine/SCons/Tool/MSCommon/netframework.py +++ b/src/engine/SCons/Tool/MSCommon/netframework.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,7 +20,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 2014/07/05 09:42:21 garyo" __doc__ = """ """ diff --git a/src/engine/SCons/Tool/MSCommon/sdk.py b/src/engine/SCons/Tool/MSCommon/sdk.py index 320ef4c..fcf25e9 100644 --- a/src/engine/SCons/Tool/MSCommon/sdk.py +++ b/src/engine/SCons/Tool/MSCommon/sdk.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 2014/07/05 09:42:21 garyo" __doc__ = """Module to detect the Platform/Windows SDK diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 582bf23..19bcc7d 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -30,7 +30,7 @@ # * test on 64 bits XP + VS 2005 (and VS 6 if possible) # * SDK # * Assembly -__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 2014/07/05 09:42:21 garyo" __doc__ = """Module for Visual C/C++ detection and configuration. """ @@ -89,6 +89,7 @@ _ARCH_TO_CANONICAL = { _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "x86"): "x86", ("x86", "amd64"): "x86_amd64", + ("x86", "x86_amd64"): "x86_amd64", ("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", @@ -131,9 +132,15 @@ def get_host_target(env): return (host, target,req_target_platform) -_VCVER = ["11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] +# If you update this, update SupportedVSList in Tool/MSCommon/vs.py, and the +# MSVC_VERSION documentation in Tool/msvc.xml. +_VCVER = ["12.0", "12.0Exp", "11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] _VCVER_TO_PRODUCT_DIR = { + '12.0' : [ + r'Microsoft\VisualStudio\12.0\Setup\VC\ProductDir'], + '12.0Exp' : [ + r'Microsoft\VCExpress\12.0\Setup\VC\ProductDir'], '11.0': [ r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'], '11.0Exp' : [ @@ -298,8 +305,21 @@ def reset_installed_vcs(): """Make it try again to find VC. This is just for the tests.""" __INSTALLED_VCS_RUN = None +# Running these batch files isn't cheap: most of the time spent in +# msvs.generate() is due to vcvars*.bat. In a build that uses "tools='msvs'" +# in multiple environments, for example: +# env1 = Environment(tools='msvs') +# env2 = Environment(tools='msvs') +# we can greatly improve the speed of the second and subsequent Environment +# (or Clone) calls by memoizing the environment variables set by vcvars*.bat. +script_env_stdout_cache = {} def script_env(script, args=None): - stdout = common.get_output(script, args) + cache_key = (script, args) + stdout = script_env_stdout_cache.get(cache_key, None) + if stdout is None: + stdout = common.get_output(script, args) + script_env_stdout_cache[cache_key] = stdout + # Stupid batch files do not set return code: we take a look at the # beginning of the output for an error message instead olines = stdout.splitlines() @@ -416,7 +436,7 @@ def msvc_find_valid_batch_script(env,version): if not vc_script and sdk_script: debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) try: - d = script_env(sdk_script,args=[]) + d = script_env(sdk_script) except BatchFileExecutionError,e: debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) continue diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py index 783ca2e..78697cc 100644 --- a/src/engine/SCons/Tool/MSCommon/vs.py +++ b/src/engine/SCons/Tool/MSCommon/vs.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation +# Copyright (c) 2001 - 2014 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 2014/03/02 14:18:15 garyo" +__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 2014/07/05 09:42:21 garyo" __doc__ = """Module to detect Visual Studio and/or Visual C/C++ """ @@ -73,7 +73,7 @@ class VisualStudio(object): debug('find_vs_dir(): no installed VC %s' % self.vc_version) return None return dir - + def find_vs_dir_by_reg(self): root = 'Software\\' @@ -91,13 +91,13 @@ class VisualStudio(object): debug('find_vs_dir_by_reg(): found VS in registry: %s' % comps) return comps return None - + def find_vs_dir(self): """ Can use registry or location of VC to find vs dir First try to find by registry, and if that fails find via VC dir """ - - + + if True: vs_dir=self.find_vs_dir_by_reg() return vs_dir @@ -115,7 +115,7 @@ class VisualStudio(object): debug('find_executable(): %s not on file system' % executable) return None return executable - + # def get_batch_file(self): @@ -199,102 +199,96 @@ class VisualStudio(object): # good money for in preference to whatever Microsoft makes available # for free. # -# If you update this list, update the documentation in Tool/msvs.xml. +# If you update this list, update _VCVER and _VCVER_TO_PRODUCT_DIR in +# Tool/MSCommon/vc.py, and the MSVC_VERSION documentation in Tool/msvc.xml. SupportedVSList = [ - # Visual Studio 2010 - # TODO: find the settings, perhaps from someone with a CTP copy? - #VisualStudio('TBD', - # hkey_root=r'TBD', - # common_tools_var='TBD', - # executable_path=r'TBD', - # default_dirname='TBD', - #), - - # Visual Studio 11 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. + # Visual Studio 2013 + VisualStudio('12.0', + vc_version='12.0', + sdk_version='8.1A', + hkeys=[r'Microsoft\VisualStudio\12.0\Setup\VS\ProductDir'], + common_tools_var='VS120COMNTOOLS', + executable_path=r'Common7\IDE\devenv.com', + batch_file_path=r'Common7\Tools\vsvars32.bat', + supported_arch=['x86', 'amd64'], + ), + + # Visual C++ 2013 Express Edition (for Desktop) + VisualStudio('12.0Exp', + vc_version='12.0', + sdk_version='8.1A', + hkeys=[r'Microsoft\VisualStudio\12.0\Setup\VS\ProductDir'], + common_tools_var='VS120COMNTOOLS', + executable_path=r'Common7\IDE\WDExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + supported_arch=['x86', 'amd64'], + ), + + # Visual Studio 2012 VisualStudio('11.0', - sdk_version='6.1', + sdk_version='8.0A', hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', supported_arch=['x86', 'amd64'], ), - # Visual C++ 11 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + # Visual C++ 2012 Express Edition (for Desktop) VisualStudio('11.0Exp', vc_version='11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], + sdk_version='8.0A', + hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', + executable_path=r'Common7\IDE\WDExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86'], + supported_arch=['x86', 'amd64'], ), # Visual Studio 2010 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VisualStudio\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86', 'amd64'], ), # Visual C++ 2010 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('10.0Exp', vc_version='10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VCExpress\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86'], ), # Visual Studio 2008 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86', 'amd64'], ), # Visual C++ 2008 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('9.0Exp', vc_version='9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VCExpress\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86'], ), # Visual Studio 2005 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('8.0', sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\8.0\Setup\VS\ProductDir'], @@ -306,8 +300,6 @@ SupportedVSList = [ ), # Visual C++ 2005 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('8.0Exp', vc_version='8.0Exp', sdk_version='6.0A', @@ -320,8 +312,6 @@ SupportedVSList = [ ), # Visual Studio .NET 2003 - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.1', sdk_version='6.0', hkeys=[r'Microsoft\VisualStudio\7.1\Setup\VS\ProductDir'], @@ -333,8 +323,6 @@ SupportedVSList = [ ), # Visual Studio .NET - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.0', sdk_version='2003R2', hkeys=[r'Microsoft\VisualStudio\7.0\Setup\VS\ProductDir'], @@ -393,11 +381,11 @@ def reset_installed_visual_studios(): InstalledVSMap = None for vs in SupportedVSList: vs.reset() - + # Need to clear installed VC's as well as they are used in finding # installed VS's SCons.Tool.MSCommon.vc.reset_installed_vcs() - + # We may be asked to update multiple construction environments with # SDK information. When doing this, we check on-disk for whether @@ -462,7 +450,7 @@ def get_default_version(env): If no version was requested by the user through the MSVS environment variable, query all the available the visual studios through - query_versions, and take the highest one. + get_installed_visual_studios, and take the highest one. Return ------ @@ -470,6 +458,7 @@ def get_default_version(env): the default version. """ if 'MSVS' not in env or not SCons.Util.is_Dict(env['MSVS']): + # get all versions, and remember them for speed later versions = [vs.version for vs in get_installed_visual_studios()] env['MSVS'] = {'VERSIONS' : versions} else: @@ -479,6 +468,8 @@ def get_default_version(env): if versions: env['MSVS_VERSION'] = versions[0] #use highest version by default else: + debug('get_default_version: WARNING: no installed versions found, ' + 'using first in SupportedVSList (%s)'%SupportedVSList[0].version) env['MSVS_VERSION'] = SupportedVSList[0].version env['MSVS']['VERSION'] = env['MSVS_VERSION'] |