SCons支持visual studio 2013

时间:2014-03-05 19:15:16

标签: visual-studio-2013 scons

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

最新版本2.3.1经过硬编码,可以查找6.0到11.0。但没有12.0的条目。

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

由于 沙恩

4 个答案:

答案 0 :(得分:5)

我也在寻找VS 2013(vs12)支持(对于scone 2.3.0),我找到了这个链接:

D146 SCons visual studio 2013 support

我对那里描述的3个文件进行了相同的简单更改,并且,瞧,vs12现在有效...

答案 1 :(得分: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 Express。但是为VS2013修改它很简单。

这很好用。但我不想强迫约300名其他开发人员使用修补版本的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和VS的机器上进行了测试。 2013安装。我将在仅限VS2013的机器上进行测试,如果有任何问题,我会更新这篇文章。

答案 2 :(得分:1)

答案 3 :(得分:0)

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