Commit b2df065b authored by Tobias Hunger's avatar Tobias Hunger

Use distinct ABIs for MSVC versions

Use a distinct ABI OS flavor for each of the supported MSVC versions.

Task-number: QTCREATORBUG-4129
parent 6b8eb847
......@@ -409,7 +409,9 @@ void CMakeRunPage::initializePage()
ProjectExplorer::Abi targetAbi = tc->targetAbi();
QVariant tcVariant = qVariantFromValue(static_cast<void *>(tc));
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor)
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor)
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(tc->displayName()), tcVariant);
else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor)
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(tc->displayName()), tcVariant);
......@@ -450,10 +452,10 @@ void CMakeRunPage::runCMake()
QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles");
if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS) {
if (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor)
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
else
if (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor)
generator = QLatin1String("-GCodeBlocks - MinGW Makefiles");
else
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
}
......
......@@ -349,7 +349,9 @@ static QString cdbBinary(const DebuggerStartParameters &sp)
if (!sp.debuggerCommand.isEmpty()) {
// Do not use a GDB binary if we got started for a project with MinGW runtime.
const bool abiMatch = sp.toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS
&& sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor;
&& (sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|| sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|| sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor);
if (abiMatch)
return sp.debuggerCommand;
}
......
......@@ -1474,7 +1474,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
Abi hostAbi = Abi::hostAbi();
sp.toolChainAbi = ProjectExplorer::Abi(hostAbi.architecture(),
ProjectExplorer::Abi::WindowsOS,
ProjectExplorer::Abi::WindowsMsvcFlavor,
ProjectExplorer::Abi::WindowsMsvc2010Flavor,
ProjectExplorer::Abi::PEFormat,
true);
sp.startMode = AttachToRemote;
......@@ -2461,7 +2461,7 @@ QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType
if (searchAbi.os() == ProjectExplorer::Abi::WindowsOS) {
switch (et) {
case CdbEngineType:
searchAbi = Abi(abi.architecture(), abi.os(), Abi::WindowsMsvcFlavor,
searchAbi = Abi(abi.architecture(), abi.os(), Abi::WindowsMsvc2010Flavor,
abi.binaryFormat(), abi.wordWidth());
break;
case GdbEngineType:
......
......@@ -93,10 +93,24 @@ static QList<Abi> parseCoffHeader(const QByteArray &data)
if (data.size() >= 68) {
// Get Major and Minor Image Version from optional header fields
quint32 image = (data.at(67) << 24) + (data.at(66) << 16) + (data.at(65) << 8) + data.at(64);
if (image == 1) // Image is 1 for mingw and higher for MSVC (4.something in some encoding)
if (image == 1) { // Image is 1 for mingw and higher for MSVC (4.something in some encoding)
flavor = Abi::WindowsMSysFlavor;
else
flavor = Abi::WindowsMsvcFlavor;
} else {
switch (data.at(22)) {
case 8:
flavor = Abi::WindowsMsvc2005Flavor;
break;
case 9:
flavor = Abi::WindowsMsvc2008Flavor;
break;
case 10:
flavor = Abi::WindowsMsvc2010Flavor;
break;
default:
// Keep unknown flavor
break;
}
}
}
if (arch != Abi::UnknownArchitecture && width != 0)
......@@ -196,7 +210,7 @@ Abi::Abi(const Architecture &a, const OS &o,
m_osFlavor = UnknownFlavor;
break;
case ProjectExplorer::Abi::WindowsOS:
if (m_osFlavor < WindowsMsvcFlavor || m_osFlavor > WindowsCEFlavor)
if (m_osFlavor < WindowsMsvc2005Flavor || m_osFlavor > WindowsCEFlavor)
m_osFlavor = UnknownFlavor;
break;
}
......@@ -258,8 +272,12 @@ Abi::Abi(const QString &abiString) :
m_osFlavor = SymbianEmulatorFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == UnixOS)
m_osFlavor = GenericUnixFlavor;
else if (abiParts.at(2) == QLatin1String("msvc") && m_os == WindowsOS)
m_osFlavor = WindowsMsvcFlavor;
else if (abiParts.at(2) == QLatin1String("msvc2005") && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2005Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2008") && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2008Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2010") && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2010Flavor;
else if (abiParts.at(2) == QLatin1String("msys") && m_os == WindowsOS)
m_osFlavor = WindowsMSysFlavor;
else if (abiParts.at(2) == QLatin1String("ce") && m_os == WindowsOS)
......@@ -399,8 +417,12 @@ QString Abi::toString(const OSFlavor &of)
return QLatin1String("emulator");
case ProjectExplorer::Abi::GenericUnixFlavor:
return QLatin1String("generic");
case ProjectExplorer::Abi::WindowsMsvcFlavor:
return QLatin1String("msvc");
case ProjectExplorer::Abi::WindowsMsvc2005Flavor:
return QLatin1String("msvc2005");
case ProjectExplorer::Abi::WindowsMsvc2008Flavor:
return QLatin1String("msvc2008");
case ProjectExplorer::Abi::WindowsMsvc2010Flavor:
return QLatin1String("msvc2010");
case ProjectExplorer::Abi::WindowsMSysFlavor:
return QLatin1String("msys");
case ProjectExplorer::Abi::WindowsCEFlavor:
......@@ -445,7 +467,15 @@ Abi Abi::hostAbi()
#if defined (Q_OS_WIN)
os = WindowsOS;
subos = WindowsMsvcFlavor;
#if _MSC_VER == 1600
subos = WindowsMsvc2010Flavor;
#elif _MSC_VER == 1500
subos = WindowsMsvc2008Flavor;
#elif _MSC_VER == 1400
subos = WindowsMsvc2005Flavor;
#elif defined (mingw32)
subos = WindowsMSysFlavor;
#endif
format = PEFormat;
#elif defined (Q_OS_LINUX)
os = LinuxOS;
......
......@@ -85,7 +85,9 @@ public:
GenericUnixFlavor,
// Windows
WindowsMsvcFlavor,
WindowsMsvc2005Flavor,
WindowsMsvc2008Flavor,
WindowsMsvc2010Flavor,
WindowsMSysFlavor,
WindowsCEFlavor
};
......
......@@ -55,8 +55,8 @@ public:
enum Type { WindowsSDK, VS };
enum Platform { s32, s64, ia64, amd64 };
MsvcToolChain(Type type, const QString &name, Platform platform, const QString &varsBat,
const QString &varsBatArg, bool autodetect = false);
MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBat, const QString &varsBatArg, bool autodetect = false);
QString typeName() const;
Abi targetAbi() const;
......@@ -89,8 +89,7 @@ private:
mutable Utils::Environment m_lastEnvironment; // Last checked 'incoming' environment.
mutable Utils::Environment m_resultEnvironment; // Resulting environment for VC
mutable QList<HeaderPath> m_headerPaths;
bool m_is64bit;
Abi::Architecture m_architecture;
Abi m_abi;
};
// --------------------------------------------------------------------------
......
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