Commit 941d23a2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ProjectExplorer: Avoid execution of g++ on startup

Change-Id: I53719f58714b3dd0fcf21d8c7b1deb8d86190408
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent f2ca9eb1
......@@ -258,8 +258,9 @@ AndroidToolChainFactory::AndroidToolChainFactory()
setDisplayName(tr("Android GCC"));
}
QList<ToolChain *> AndroidToolChainFactory::autoDetect()
QList<ToolChain *> AndroidToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Q_UNUSED(alreadyKnown);
return createToolChainsForNdk(AndroidConfigurations::currentConfig().ndkLocation());
}
......
......@@ -101,7 +101,7 @@ class AndroidToolChainFactory : public ProjectExplorer::ToolChainFactory
public:
AndroidToolChainFactory();
QList<ProjectExplorer::ToolChain *> autoDetect() override;
QList<ProjectExplorer::ToolChain *> autoDetect(const QList<ProjectExplorer::ToolChain *> &alreadyKnown) override;
bool canRestore(const QVariantMap &data) override;
ProjectExplorer::ToolChain *restore(const QVariantMap &data) override;
......
......@@ -774,15 +774,15 @@ ToolChain *GccToolChainFactory::create()
return createToolChain(false);
}
QList<ToolChain *> GccToolChainFactory::autoDetect()
QList<ToolChain *> GccToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
QList<ToolChain *> tcs;
if (HostOsInfo::isMacHost()) {
// Old mac compilers needed to support macx-gccXY mkspecs:
tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi()));
tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi()));
tcs.append(autoDetectToolchains(QLatin1String("g++-4.0"), Abi::hostAbi(), alreadyKnown));
tcs.append(autoDetectToolchains(QLatin1String("g++-4.2"), Abi::hostAbi(), alreadyKnown));
}
tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi()));
tcs.append(autoDetectToolchains(QLatin1String("g++"), Abi::hostAbi(), alreadyKnown));
return tcs;
}
......@@ -809,7 +809,8 @@ GccToolChain *GccToolChainFactory::createToolChain(bool autoDetect)
}
QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &compiler,
const Abi &requiredAbi)
const Abi &requiredAbi,
const QList<ToolChain *> &alreadyKnown)
{
QList<ToolChain *> result;
......@@ -818,6 +819,9 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
if (compilerPath.isEmpty())
return result;
if (Utils::findOrDefault(alreadyKnown, Utils::equal(&ToolChain::compilerCommand, compilerPath)))
return result;
GccToolChain::addCommandPathToEnvironment(compilerPath, systemEnvironment);
QByteArray macros
= gccPredefinedMacros(compilerPath, gccPredefinedMacrosOptions(), systemEnvironment.toStringList());
......@@ -1107,10 +1111,9 @@ ClangToolChainFactory::ClangToolChainFactory()
setDisplayName(tr("Clang"));
}
QList<ToolChain *> ClangToolChainFactory::autoDetect()
QList<ToolChain *> ClangToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Abi ha = Abi::hostAbi();
return autoDetectToolchains(QLatin1String("clang++"), ha);
return autoDetectToolchains(QLatin1String("clang++"), Abi::hostAbi(), alreadyKnown);
}
bool ClangToolChainFactory::canRestore(const QVariantMap &data)
......@@ -1186,11 +1189,11 @@ MingwToolChainFactory::MingwToolChainFactory()
setDisplayName(tr("MinGW"));
}
QList<ToolChain *> MingwToolChainFactory::autoDetect()
QList<ToolChain *> MingwToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Abi ha = Abi::hostAbi();
return autoDetectToolchains(QLatin1String("g++"),
Abi(ha.architecture(), Abi::WindowsOS, Abi::WindowsMSysFlavor, Abi::PEFormat, ha.wordWidth()));
const Abi ha = Abi(Abi::hostAbi().architecture(), Abi::WindowsOS, Abi::WindowsMSysFlavor,
Abi::PEFormat, ha.wordWidth());
return autoDetectToolchains(QLatin1String("g++"), ha, alreadyKnown);
}
bool MingwToolChainFactory::canRestore(const QVariantMap &data)
......@@ -1263,9 +1266,9 @@ LinuxIccToolChainFactory::LinuxIccToolChainFactory()
setDisplayName(tr("Linux ICC"));
}
QList<ToolChain *> LinuxIccToolChainFactory::autoDetect()
QList<ToolChain *> LinuxIccToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
return autoDetectToolchains(QLatin1String("icpc"), Abi::hostAbi());
return autoDetectToolchains(QLatin1String("icpc"), Abi::hostAbi(), alreadyKnown);
}
bool LinuxIccToolChainFactory::canRestore(const QVariantMap &data)
......
......@@ -56,7 +56,7 @@ class GccToolChainFactory : public ToolChainFactory
public:
GccToolChainFactory();
QList<ToolChain *> autoDetect();
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
bool canCreate();
ToolChain *create();
......@@ -67,7 +67,8 @@ public:
protected:
virtual GccToolChain *createToolChain(bool autoDetect);
QList<ToolChain *> autoDetectToolchains(const QString &compiler,
const Abi &);
const Abi &,
const QList<ToolChain *> &alreadyKnown);
};
// --------------------------------------------------------------------------
......@@ -114,7 +115,7 @@ class ClangToolChainFactory : public GccToolChainFactory
public:
ClangToolChainFactory();
QList<ToolChain *> autoDetect();
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
bool canRestore(const QVariantMap &data);
......@@ -133,7 +134,7 @@ class MingwToolChainFactory : public GccToolChainFactory
public:
MingwToolChainFactory();
QList<ToolChain *> autoDetect();
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
bool canRestore(const QVariantMap &data);
......@@ -152,7 +153,7 @@ class LinuxIccToolChainFactory : public GccToolChainFactory
public:
LinuxIccToolChainFactory();
QList<ToolChain *> autoDetect();
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
bool canRestore(const QVariantMap &data);
......
......@@ -526,8 +526,9 @@ QString MsvcToolChainFactory::vcVarsBatFor(const QString &basePath, MsvcToolChai
return vcVarsBatFor(basePath, platformName(platform));
}
QList<ToolChain *> MsvcToolChainFactory::autoDetect()
QList<ToolChain *> MsvcToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Q_UNUSED(alreadyKnown);
QList<ToolChain *> results;
// 1) Installed SDKs preferred over standalone Visual studio
......
......@@ -100,7 +100,7 @@ class MsvcToolChainFactory : public ToolChainFactory
public:
MsvcToolChainFactory();
QList<ToolChain *> autoDetect() override;
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown) override;
bool canRestore(const QVariantMap &data) override;
ToolChain *restore(const QVariantMap &data) override
......
......@@ -239,8 +239,9 @@ QList<Task> ToolChain::validateKit(const Kit *) const
Used by the tool chain manager to restore user-generated tool chains.
*/
QList<ToolChain *> ToolChainFactory::autoDetect()
QList<ToolChain *> ToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Q_UNUSED(alreadyKnown);
return QList<ToolChain *>();
}
......
......@@ -181,7 +181,7 @@ class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
public:
QString displayName() const { return m_displayName; }
virtual QList<ToolChain *> autoDetect();
virtual QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
virtual bool canCreate();
virtual ToolChain *create();
......
......@@ -219,7 +219,7 @@ void ToolChainManager::restoreToolChains()
QList<ToolChain *> detectedTcs;
QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
foreach (ToolChainFactory *f, factories)
detectedTcs.append(f->autoDetect());
detectedTcs.append(f->autoDetect(tcsToCheck));
// Find/update autodetected tool chains:
ToolChain *toStore = 0;
......
......@@ -353,8 +353,9 @@ WinCEToolChainFactory::WinCEToolChainFactory()
}
QList<ToolChain *> WinCEToolChainFactory::autoDetect()
QList<ToolChain *> WinCEToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
{
Q_UNUSED(alreadyKnown);
QList<ToolChain *> results;
// 1) Installed WinCEs
......
......@@ -107,7 +107,7 @@ class WinCEToolChainFactory : public ToolChainFactory
public:
WinCEToolChainFactory();
QList<ToolChain *> autoDetect() override;
QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown) override;
bool canRestore(const QVariantMap &data) override;
ToolChain *restore(const QVariantMap &data) override;
......
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