2014-03-05 66 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唯一的機器上測試它,如果有任何問題,我會更新這篇文章。