ProjectExplorer: Add MSVC2019 flavor support

It is promised to be compatible with prior versions.

Change-Id: I85e433382a66c82e9880401c3a983fef06c03606
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-02-04 10:29:04 +01:00
parent 90e432aa05
commit 1f804e7fc7
5 changed files with 32 additions and 10 deletions

View File

@@ -112,6 +112,7 @@ static void setupPreregisteredOsFlavors() {
registerOsFlavor(Abi::WindowsMsvc2013Flavor, "msvc2013", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2015Flavor, "msvc2015", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2017Flavor, "msvc2017", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMsvc2019Flavor, "msvc2019", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsMSysFlavor, "msys", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::WindowsCEFlavor, "ce", {Abi::OS::WindowsOS});
registerOsFlavor(Abi::VxWorksFlavor, "vxworks", {Abi::OS::VxWorks});
@@ -279,12 +280,15 @@ static QList<Abi> parseCoffHeader(const QByteArray &data)
flavor = Abi::WindowsMsvc2013Flavor;
break;
case 14:
flavor = minorLinker >= quint8(10)
? Abi::WindowsMsvc2017Flavor // MSVC2017 RC
: Abi::WindowsMsvc2015Flavor;
if (minorLinker >= quint8(20))
flavor = Abi::WindowsMsvc2019Flavor;
else if (minorLinker >= quint8(10))
flavor = Abi::WindowsMsvc2017Flavor;
else
flavor = Abi::WindowsMsvc2015Flavor;
break;
case 15:
flavor = Abi::WindowsMsvc2017Flavor;
flavor = Abi::WindowsMsvc2019Flavor;
break;
default: // Keep unknown flavor
if (minorLinker != 0)
@@ -589,6 +593,13 @@ bool Abi::operator == (const Abi &other) const
&& m_wordWidth == other.m_wordWidth;
}
static bool compatibleMSVCFlavors(const Abi::OSFlavor &left, const Abi ::OSFlavor &right)
{
// MSVC 2019, 2017 and 2015 are compatible
return left >= Abi::WindowsMsvc2015Flavor && left <= Abi::WindowsMsvc2019Flavor
&& right >= Abi::WindowsMsvc2015Flavor && right <= Abi::WindowsMsvc2019Flavor;
}
bool Abi::isCompatibleWith(const Abi &other) const
{
// Generic match: If stuff is identical or the other side is unknown, then this is a match.
@@ -615,12 +626,9 @@ bool Abi::isCompatibleWith(const Abi &other) const
if (isCompat && (osFlavor() == AndroidLinuxFlavor || other.osFlavor() == AndroidLinuxFlavor))
isCompat = (architecture() == other.architecture()) && (osFlavor() == other.osFlavor());
// MSVC2017 is compatible with MSVC2015
if (!isCompat
&& ((osFlavor() == WindowsMsvc2015Flavor && other.osFlavor() == WindowsMsvc2017Flavor)
|| (osFlavor() == WindowsMsvc2017Flavor && other.osFlavor() == WindowsMsvc2015Flavor))) {
if (!isCompat && compatibleMSVCFlavors(osFlavor(), other.osFlavor()))
isCompat = true;
}
return isCompat;
}
@@ -896,6 +904,8 @@ bool Abi::osSupportsFlavor(const Abi::OS &os, const Abi::OSFlavor &flavor)
Abi::OSFlavor Abi::flavorForMsvcVersion(int version)
{
if (version >= 1920)
return WindowsMsvc2019Flavor;
if (version >= 1910)
return WindowsMsvc2017Flavor;
switch (version) {

View File

@@ -89,6 +89,7 @@ public:
WindowsMsvc2013Flavor,
WindowsMsvc2015Flavor,
WindowsMsvc2017Flavor,
WindowsMsvc2019Flavor,
WindowsMSysFlavor,
WindowsCEFlavor,

View File

@@ -384,7 +384,9 @@ static Abi findAbiOfMsvc(MsvcToolChain::Type type,
else if (version == QLatin1String("v7.0A") || version == QLatin1String("v7.1"))
msvcVersionString = QLatin1String("10.0");
}
if (msvcVersionString.startsWith(QLatin1String("15.")))
if (msvcVersionString.startsWith(QLatin1String("16.")))
flavor = Abi::WindowsMsvc2019Flavor;
else if (msvcVersionString.startsWith(QLatin1String("15.")))
flavor = Abi::WindowsMsvc2017Flavor;
else if (msvcVersionString.startsWith(QLatin1String("14.")))
flavor = Abi::WindowsMsvc2015Flavor;
@@ -955,6 +957,12 @@ Utils::FileNameList MsvcToolChain::suggestedMkspecList() const
<< Utils::FileName::fromLatin1("winrt-x86-msvc2017")
<< Utils::FileName::fromLatin1("winrt-x64-msvc2017");
break;
case Abi::WindowsMsvc2019Flavor:
result << Utils::FileName::fromLatin1("win32-msvc2019")
<< Utils::FileName::fromLatin1("winrt-arm-msvc2019")
<< Utils::FileName::fromLatin1("winrt-x86-msvc2019")
<< Utils::FileName::fromLatin1("winrt-x64-msvc2019");
break;
default:
result.clear();
break;

View File

@@ -1963,6 +1963,8 @@ static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &pr
flavor = Abi::WindowsMsvc2015Flavor;
} else if (compiler.startsWith("MSVC 2017") && os == Abi::WindowsOS) {
flavor = Abi::WindowsMsvc2017Flavor;
} else if (compiler.startsWith("MSVC 2019") && os == Abi::WindowsOS) {
flavor = Abi::WindowsMsvc2019Flavor;
}
return Abi(arch, os, flavor, format, wordWidth);

View File

@@ -49,6 +49,7 @@ public:
WindowsMsvc2013Flavor,
WindowsMsvc2015Flavor,
WindowsMsvc2017Flavor,
WindowsMsvc2019Flavor,
WindowsMSysFlavor,
WindowsCEFlavor,