Detect MSVC 2010.

Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
Task-number: QTCREATORBUG-1710
This commit is contained in:
Friedemann Kleint
2010-06-23 10:58:40 +02:00
parent 1c79e2de21
commit e8373b9dbe

View File

@@ -431,25 +431,40 @@ MSVCToolChain::InstallationList MSVCToolChain::installations()
// 2) Installed MSVCs // 2) Installed MSVCs
const QSettings vsRegistry(MSVC_RegKey, QSettings::NativeFormat); const QSettings vsRegistry(MSVC_RegKey, QSettings::NativeFormat);
foreach(const QString &vsName, vsRegistry.allKeys()) { foreach(const QString &vsName, vsRegistry.allKeys()) {
if (vsName.contains(QLatin1Char('.'))) { // Scan for version major.minor const int dotPos = vsName.indexOf(QLatin1Char('.'));
if (dotPos != -1) { // Scan for version major.minor
const QString path = vsRegistry.value(vsName).toString(); const QString path = vsRegistry.value(vsName).toString();
const int version = vsName.left(dotPos).toInt();
// Check existence of various install scripts // Check existence of various install scripts
const QString vcvars32bat = path + QLatin1String("bin\\vcvars32.bat"); const QString vcvars32bat = path + QLatin1String("bin\\vcvars32.bat");
if (QFileInfo(vcvars32bat).isFile()) if (QFileInfo(vcvars32bat).isFile())
installs.push_back(Installation(Installation::VS, vsName, Installation::s32, vcvars32bat)); installs.push_back(Installation(Installation::VS, vsName, Installation::s32, vcvars32bat));
// Amd 64 is the preferred 64bit platform if (version >= 10) {
const QString vcvarsAmd64bat = path + QLatin1String("bin\\amd64\\vcvarsamd64.bat"); // Just one common file
if (QFileInfo(vcvarsAmd64bat).isFile()) const QString vcvarsAllbat = path + QLatin1String("vcvarsall.bat");
installs.push_back(Installation(Installation::VS, vsName, Installation::amd64, vcvarsAmd64bat)); if (QFileInfo(vcvarsAllbat).isFile()) {
const QString vcvarsAmd64bat2 = path + QLatin1String("bin\\vcvarsx86_amd64.bat"); installs.push_back(Installation(Installation::VS, vsName, Installation::s32, vcvarsAllbat, QLatin1String("x86")));
if (QFileInfo(vcvarsAmd64bat2).isFile()) installs.push_back(Installation(Installation::VS, vsName, Installation::amd64, vcvarsAllbat, QLatin1String("amd64")));
installs.push_back(Installation(Installation::VS, vsName, Installation::amd64, vcvarsAmd64bat2)); installs.push_back(Installation(Installation::VS, vsName, Installation::s64, vcvarsAllbat, QLatin1String("x64")));
const QString vcvars64bat = path + QLatin1String("bin\\vcvars64.bat"); installs.push_back(Installation(Installation::VS, vsName, Installation::ia64, vcvarsAllbat, QLatin1String("ia64")));
if (QFileInfo(vcvars64bat).isFile()) } else {
installs.push_back(Installation(Installation::VS, vsName, Installation::s64, vcvars64bat)); qWarning("Unable to find MSVC setup script %s in version %d", qPrintable(vcvarsAllbat), version);
const QString vcvarsIA64bat = path + QLatin1String("bin\\vcvarsx86_ia64.bat"); }
if (QFileInfo(vcvarsIA64bat).isFile()) } else {
installs.push_back(Installation(Installation::VS, vsName, Installation::ia64, vcvarsIA64bat)); // Amd 64 is the preferred 64bit platform
const QString vcvarsAmd64bat = path + QLatin1String("bin\\amd64\\vcvarsamd64.bat");
if (QFileInfo(vcvarsAmd64bat).isFile())
installs.push_back(Installation(Installation::VS, vsName, Installation::amd64, vcvarsAmd64bat));
const QString vcvarsAmd64bat2 = path + QLatin1String("bin\\vcvarsx86_amd64.bat");
if (QFileInfo(vcvarsAmd64bat2).isFile())
installs.push_back(Installation(Installation::VS, vsName, Installation::amd64, vcvarsAmd64bat2));
const QString vcvars64bat = path + QLatin1String("bin\\vcvars64.bat");
if (QFileInfo(vcvars64bat).isFile())
installs.push_back(Installation(Installation::VS, vsName, Installation::s64, vcvars64bat));
const QString vcvarsIA64bat = path + QLatin1String("bin\\vcvarsx86_ia64.bat");
if (QFileInfo(vcvarsIA64bat).isFile())
installs.push_back(Installation(Installation::VS, vsName, Installation::ia64, vcvarsIA64bat));
}
} }
} }
} }