Commit 9d2ca0e8 authored by Friedemann Kleint's avatar Friedemann Kleint

MSVC: Try to determine version if none is set.

Try to find matching version for mkspec.
Rubber-stamped-by: default avatarJoerg Bornemann <qtc-committer@nokia.com>
parent ed27cffc
......@@ -459,7 +459,40 @@ MSVCToolChain::InstallationList MSVCToolChain::installations()
return installs;
}
MSVCToolChain::Installation MSVCToolChain::findInstallation(bool is64Bit,
// Return a substring to match the MSVC official version against by mkSpec name.
static inline const QString msvcVersionStringFromMkSpec(const QString &mkSpec)
{
if (mkSpec.isEmpty())
return QString();
if (mkSpec.endsWith(QLatin1String("msvc2002")))
return QLatin1String(" 7.0");
if (mkSpec.endsWith(QLatin1String("msvc2003")))
return QLatin1String(" 7.1");
if (mkSpec.endsWith(QLatin1String("msvc2005")))
return QLatin1String(" 8.0");
if (mkSpec.endsWith(QLatin1String("msvc2008")))
return QLatin1String(" 9.0");
if (mkSpec.endsWith(QLatin1String("msvc2010")))
return QLatin1String(" 10.0");
return QString();
}
MSVCToolChain::Installation MSVCToolChain::findInstallationByMkSpec(bool is64Bit,
const QString &mkSpec,
bool excludeSDK)
{
const QString mkSpecMatchString = msvcVersionStringFromMkSpec(mkSpec);
if (!mkSpecMatchString.isEmpty()) {
foreach(const Installation &i, installations()) {
if ((i.type == Installation::VS) && (i.is64bit() == is64Bit)
&& (i.name.indexOf(mkSpecMatchString) != -1))
return i;
}
}
return findInstallationByName(is64Bit, QString(), excludeSDK);
}
MSVCToolChain::Installation MSVCToolChain::findInstallationByName(bool is64Bit,
const QString &name,
bool excludeSDK)
{
......@@ -488,7 +521,7 @@ PROJECTEXPLORER_EXPORT QDebug operator<<(QDebug in, const MSVCToolChain::Install
MSVCToolChain *MSVCToolChain::create(const QString &name, bool amd64)
{
return new MSVCToolChain(MSVCToolChain::findInstallation(amd64, name));
return new MSVCToolChain(MSVCToolChain::findInstallationByName(amd64, name));
}
MSVCToolChain::MSVCToolChain(const Installation &in) :
......@@ -740,7 +773,7 @@ IOutputParser *MSVCToolChain::outputParser() const
WinCEToolChain *WinCEToolChain::create(const QString &name, const QString &platform)
{
const bool excludeSDK = true;
return new WinCEToolChain(findInstallation(false, name, excludeSDK), platform);
return new WinCEToolChain(findInstallationByName(false, name, excludeSDK), platform);
}
WinCEToolChain::WinCEToolChain(const Installation &in, const QString &platform) :
......
......@@ -194,9 +194,12 @@ public:
typedef QList<Installation> InstallationList;
static InstallationList installations();
// Return matching installation or empty one
static Installation findInstallation(bool is64Bit,
const QString &name = QString(),
bool excludeSDK = false);
static Installation findInstallationByName(bool is64Bit,
const QString &name = QString(),
bool excludeSDK = false);
static Installation findInstallationByMkSpec(bool is64Bit,
const QString &mkSpec,
bool excludeSDK = false);
static MSVCToolChain *create(const QString &name,
bool amd64 = false);
......
......@@ -316,7 +316,7 @@ void QtVersionManager::addNewVersionsFromInstaller()
{
// Add new versions which may have been installed by the WB installer in the form:
// NewQtVersions="qt 4.3.2=c:\\qt\\qt432\bin\qmake.exe;qt embedded=c:\\qtembedded;"
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432bin\qmake.exe=c:\\qtcreator\\mingw\\;
// or NewQtVersions="qt 4.3.2=c:\\qt\\qt432bin\qmake.exe=c:\\qtcreator\\mingw\\=MSVCName;
// i.e.
// NewQtVersions="versionname=pathtoversion=mingw=s60sdk=gcce=carbide;"
// Duplicate entries are not added, the first new version is set as default.
......@@ -355,6 +355,8 @@ void QtVersionManager::addNewVersionsFromInstaller()
version->setGcceDirectory(QDir::fromNativeSeparators(newVersionData[4]));
if (newVersionData.count() >= 6)
version->setMwcDirectory(QDir::fromNativeSeparators(newVersionData[5]));
if (newVersionData.count() >= 7)
version->setMsvcVersion(newVersionData[6]);
bool versionWasAlreadyInList = false;
foreach(const QtVersion * const it, m_versions) {
......@@ -1367,9 +1369,11 @@ void QtVersion::updateToolChainAndMkspec() const
m_toolChains << ToolChainPtr(MaemoManager::instance().maemoToolChain(this));
m_targetIds.insert(QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID));
} else if (qmakeCXX == "cl" || qmakeCXX == "icl") {
// TODO proper support for intel cl
// TODO proper support for intel cl. Detect matching VC version unless set.
if (m_msvcVersion.isEmpty())
m_msvcVersion = ProjectExplorer::MSVCToolChain::findInstallationByMkSpec(isQt64Bit(), mkspec).name;
m_toolChains << ToolChainPtr(
ProjectExplorer::ToolChain::createMSVCToolChain(msvcVersion(), isQt64Bit()));
ProjectExplorer::ToolChain::createMSVCToolChain(m_msvcVersion, isQt64Bit()));
m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID));
} else if (qmakeCXX == "g++" && makefileGenerator == "MINGW") {
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
......
......@@ -157,7 +157,7 @@ private:
QString m_displayName;
QString m_sourcePath;
QString m_mingwDirectory;
QString m_msvcVersion;
mutable QString m_msvcVersion;
int m_id;
bool m_isAutodetected;
QString m_autodetectionSource;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment