2014-03-05 65 views
2

有谁知道scons何时会支持Visual Studio 2013?SCons支持Visual Studio 2013

最新版本2.3.1被硬编码为查找6.0到11.0。但没有12.0的条目。

VS 2013已经发布了几个月。我很惊讶,这是缺乏。

感谢 巴蒂尔

回答

0

的Visual Studio是目前最新版本的scons的一部分。如果这不适合你,我建议看看hplate的答案。

5

我也一直在寻找的VS 2013(VS12)支持(烤饼2.3.0),我发现这个链接:

D146 SCons visual studio 2013 support

我做相同的简单变化到那里描述的3个文件,并且,瞧,vs12现在可以工作...

2

取消标记作为答案。结果发现只有VS2013的机器存在问题。

我设法通过调用

SCons.Tool.MSCommon.vc.​__INSTALLED_VCS_RUN=['12.0'] 

它的工作原理来解决它。但这种不好的做法,我不能真诚地鼓励它。


事实证明,官方的支持仍然悬而未决。我已经和开发者谈过了,他们认为它应该成为下一个版本的一部分。

和hplate一样,我遇到了scons的补丁。

https://bitbucket.org/scons/scons/pull-request/104/support-visual-studio-2013/diff

这里的代码只支持VS2013快。但对VS2013进行修改很简单。

工作得很好。但我并不想强迫其他开发人员使用scons的补丁版本。

幸运的是,我们的构建系统根据需要创建一个环境&克隆。我的解决方案

def RegGetValue(root, key, _32bit = True): 
    """This utility function returns a value in the registry 
    without having to open the key first. Only available on 
    Windows platforms with a version of Python that can read the 
    registry. 
    """ 
    if not SCons.Util.can_read_reg: 
     print "ERROR: Python cannot read the Windows registry! - Crashing out..." 
     sys.exit(-1) 

    p = key.rfind('\\') + 1 
    keyp = key[:p-1]   # -1 to omit trailing slash 
    val = key[p:] 

    if _32bit: 
     flags = 0x20219 # KEY_READ (0x20019), KEY_WOW64_32KEY (0x0200) 
    else: 
     flags = 0x20119 # KEY_READ (0x20019), KEY_WOW64_64KEY (0x0100) 

    try: 
     k = SCons.Util.RegOpenKeyEx(root, keyp, 0, flags) 
    except Exception as e: 
     import traceback 
     traceback.print_stack() 
     print "ERROR: Python cannot read the Windows registry (" + key + ")" 
     print "Please ensure you have the correct Visual Studio, Micrsoft SDK, and ​.NET installed" 
     print "Crashing out....." 
     sys.exit(-1) 
    return str(SCons.Util.RegQueryValueEx(k,val)[​0]) 

# As of version 2.3.1 scon's does not have built in support for Visual Studio 2013. 
# Manually setting the appropriate environmental settings after the env has been created. 
# Once scons officially supports 2013 consider removing these. 

# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client\InstallPath 
# C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ 
dot_net4_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Client\\InstallPath", _32bit=False) 
# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Setup\VS 
# C:\Program Files (x86)\Microsoft Visual Studio 12.0\ 
vs_2013_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VS\\ProductDir") 
# HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots\KitsRoot81 
# C:\Program Files (x86)\Windows Kits\8.1\ 
kit8_1_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots\\KitsRoot81") 
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A\InstallationFolder 
# C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\ 
# Need to investigate if this should be 8.1A 
sdk_8_1_directory = RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1\\InstallationFolder") 

LIBPATH = (
    dot_net4_directory + ';' 
    + vs_2013_directory + 'VC\\LIB\\amd64;' 
    + vs_2013_directory + 'VC\\ATLMFC\\LIB\\amd64;' 
    + kit8_1_directory + 'References\\CommonConfiguration\\Neutral;' 
    + '\\Microsoft.VCLibs\\12.0\\References\\CommonConfiguration\\neutral' 
) 

LIB = (
    vs_2013_directory + 'VC\\LIB\\amd64;' 
    + vs_2013_directory + 'VC\\ATLMFC\\LIB\\amd64;' 
    + kit8_1_directory + 'lib\\winv6.3\\um\\x64' 
) 

PATH = (
    vs_2013_directory + 'Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;' 
    + vs_2013_directory + 'VC\\BIN\\amd64;' 
    + dot_net4_directory + ';' 
    + vs_2013_directory + 'VC\\VCPackages;' 
    + vs_2013_directory + 'Common7\\IDE;' 
    + vs_2013_directory + 'Common7\\Tools;' 
    + vs_2013_directory + 'Team Tools\\Performance Tools\\x64;' 
    + vs_2013_directory + 'Team Tools\\Performance Tools;' 
    + kit8_1_directory + 'bin\\x64;' 
    + kit8_1_directory + 'bin\\x86;' 
    + sdk_8_1_directory + 'bin\\NETFX 4.5.1 Tools\\x64\\;' 
    + 'C:\\Windows\\System32' 
) 

INCLUDE = (
    vs_2013_directory + 'VC\\INCLUDE;' 
    + vs_2013_directory + 'VC\\ATLMFC\\INCLUDE;' 
    + kit8_1_directory + 'include\\shared;' 
    + kit8_1_directory + 'include\\um;' 
    + kit8_1_directory + 'include\\winrt' 
) 

# Setup the Visual Studio 2013 variables 
# Note: The default 'ENV' values are fine 
# on a machine with VS2008 & VS2010 installed 
# Unclear about machines with just VS2013. 
# Needs investigation. 
# env['ENV']['TMP'] = default 
# env['ENV']['COMSPEC'] = default 
# env['ENV']['TEMP'] = default 
# env['ENV']['SystemDrive'] = default 
# env['ENV']['PATHEXT'] = default 
env['ENV']['LIBPATH'] = LIBPATH 
env['ENV']['LIB'] = LIB 
env['ENV']['PATH'] = PATH 
# env['ENV']['SystemRoot'] = default 
env['ENV']['INCLUDE'] = INCLUDE 

env['MSVC_VERSION'] = '12.0' 
env['GET_MSVSPROJECTSUFFIX'] = '.vcxproj' 
env['MSVSPROJECTSUFFIX'] = '.vcxproj' 
env['MSVS'] = {'SOLUTIONSUFFIX': '.sln', 'PROJECTSUFFIX': '.vcxproj'} 
env['MSVSENCODING'] = 'utf-8' 
env['MSVS_VERSION'] = '12.0' 

警告:到目前为止,我只能用VS2008,VS2010,& 2013安装测试此一台机器上。我将在VS2013唯一的机器上测试它,如果有任何问题,我会更新这篇文章。