forked from qt-creator/qt-creator
MSVC: Fix Microsoft Visual Cpp Build Tools
Backport of bc4a24db00
from master branch for 4.0.1
Change-Id: I5db3d0dda0b92c1ed26655f39df05d9667bfbd04
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
committed by
Tobias Hunger
parent
646bf84c60
commit
2be4d2643a
@@ -69,7 +69,10 @@ Abi AbstractMsvcToolChain::targetAbi() const
|
|||||||
|
|
||||||
bool AbstractMsvcToolChain::isValid() const
|
bool AbstractMsvcToolChain::isValid() const
|
||||||
{
|
{
|
||||||
return !m_vcvarsBat.isEmpty();
|
if (m_vcvarsBat.isEmpty())
|
||||||
|
return false;
|
||||||
|
QFileInfo fi(m_vcvarsBat);
|
||||||
|
return fi.isFile() && fi.isExecutable();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AbstractMsvcToolChain::predefinedMacros(const QStringList &cxxflags) const
|
QByteArray AbstractMsvcToolChain::predefinedMacros(const QStringList &cxxflags) const
|
||||||
|
|||||||
@@ -354,14 +354,6 @@ MsvcToolChain::MsvcToolChain(Core::Id typeId, const QString &name, const Abi &ab
|
|||||||
setDisplayName(name);
|
setDisplayName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MsvcToolChain::isValid() const
|
|
||||||
{
|
|
||||||
if (!AbstractMsvcToolChain::isValid())
|
|
||||||
return false;
|
|
||||||
QString vcVarsBat = MsvcToolChainFactory::vcVarsBatFor(QFileInfo(m_vcvarsBat).absolutePath(), m_varsBatArg);
|
|
||||||
return QFileInfo::exists(vcVarsBat);
|
|
||||||
}
|
|
||||||
|
|
||||||
MsvcToolChain::MsvcToolChain(Core::Id typeId)
|
MsvcToolChain::MsvcToolChain(Core::Id typeId)
|
||||||
: AbstractMsvcToolChain(typeId, ManualDetection)
|
: AbstractMsvcToolChain(typeId, ManualDetection)
|
||||||
{
|
{
|
||||||
@@ -610,8 +602,10 @@ bool MsvcToolChainFactory::checkForVisualStudioInstallation(const QString &vsNam
|
|||||||
return vsRegistry.contains(vsName);
|
return vsRegistry.contains(vsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, const QString &toolchainName)
|
QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform)
|
||||||
{
|
{
|
||||||
|
const QString toolchainName = platformName(platform);
|
||||||
|
|
||||||
if (toolchainName.startsWith(QLatin1Char('/'))) // windows sdk case, all use SetEnv.cmd
|
if (toolchainName.startsWith(QLatin1Char('/'))) // windows sdk case, all use SetEnv.cmd
|
||||||
return basePath + QLatin1String("/SetEnv.cmd");
|
return basePath + QLatin1String("/SetEnv.cmd");
|
||||||
if (toolchainName == QLatin1String("x86"))
|
if (toolchainName == QLatin1String("x86"))
|
||||||
@@ -634,11 +628,6 @@ QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, const QStrin
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform)
|
|
||||||
{
|
|
||||||
return vcVarsBatFor(basePath, platformName(platform));
|
|
||||||
}
|
|
||||||
|
|
||||||
static ToolChain *findOrCreateToolChain(const QList<ToolChain *> &alreadyKnown,
|
static ToolChain *findOrCreateToolChain(const QList<ToolChain *> &alreadyKnown,
|
||||||
const QString &name, const Abi &abi,
|
const QString &name, const Abi &abi,
|
||||||
const QString &varsBat, const QString &varsBatArg,
|
const QString &varsBat, const QString &varsBatArg,
|
||||||
@@ -814,13 +803,13 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &al
|
|||||||
<< MsvcToolChain::arm << MsvcToolChain::x86_arm << MsvcToolChain::amd64_arm
|
<< MsvcToolChain::arm << MsvcToolChain::x86_arm << MsvcToolChain::amd64_arm
|
||||||
<< MsvcToolChain::ia64 << MsvcToolChain::x86_ia64;
|
<< MsvcToolChain::ia64 << MsvcToolChain::x86_ia64;
|
||||||
foreach (const MsvcToolChain::Platform &platform, platforms) {
|
foreach (const MsvcToolChain::Platform &platform, platforms) {
|
||||||
if (hostSupportsPlatform(platform)
|
QString vcvarsBat = vcVarsBatFor(path, platform);
|
||||||
&& QFileInfo(vcVarsBatFor(path, platform)).isFile()) {
|
if (hostSupportsPlatform(platform) && QFileInfo(vcvarsBat).isFile()) {
|
||||||
results.append(findOrCreateToolChain(
|
results.append(findOrCreateToolChain(
|
||||||
alreadyKnown,
|
alreadyKnown,
|
||||||
generateDisplayName(vsName, MsvcToolChain::VS, platform),
|
generateDisplayName(vsName, MsvcToolChain::VS, platform),
|
||||||
findAbiOfMsvc(MsvcToolChain::VS, platform, vsName),
|
findAbiOfMsvc(MsvcToolChain::VS, platform, vsName),
|
||||||
vcvarsAllbat, platformName(platform),
|
vcvarsBat, platformName(platform),
|
||||||
ToolChain::AutoDetection));
|
ToolChain::AutoDetection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ public:
|
|||||||
Detection d = ManualDetection);
|
Detection d = ManualDetection);
|
||||||
MsvcToolChain();
|
MsvcToolChain();
|
||||||
|
|
||||||
bool isValid() const override;
|
|
||||||
Utils::FileNameList suggestedMkspecList() const override;
|
Utils::FileNameList suggestedMkspecList() const override;
|
||||||
|
|
||||||
QString typeDisplayName() const override;
|
QString typeDisplayName() const override;
|
||||||
@@ -131,7 +130,6 @@ public:
|
|||||||
ToolChain *restore(const QVariantMap &data) override;
|
ToolChain *restore(const QVariantMap &data) override;
|
||||||
|
|
||||||
ToolChainConfigWidget *configurationWidget(ToolChain *);
|
ToolChainConfigWidget *configurationWidget(ToolChain *);
|
||||||
static QString vcVarsBatFor(const QString &basePath, const QString &toolchainName);
|
|
||||||
static QString vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform);
|
static QString vcVarsBatFor(const QString &basePath, MsvcToolChain::Platform platform);
|
||||||
private:
|
private:
|
||||||
static bool checkForVisualStudioInstallation(const QString &vsName);
|
static bool checkForVisualStudioInstallation(const QString &vsName);
|
||||||
|
|||||||
Reference in New Issue
Block a user