forked from qt-creator/qt-creator
ProjectExplorer: Merge MingwToolChain into GccToolChain
Change-Id: I8f817aa69d54b58d9a0b865c1e081559fcf9799e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -296,7 +296,9 @@ GccToolChain::GccToolChain(Utils::Id typeId, SubType subType)
|
|||||||
setTypeDisplayName(Tr::tr("GCC"));
|
setTypeDisplayName(Tr::tr("GCC"));
|
||||||
setTargetAbiKey(targetAbiKeyC);
|
setTargetAbiKey(targetAbiKeyC);
|
||||||
setCompilerCommandKey("ProjectExplorer.GccToolChain.Path");
|
setCompilerCommandKey("ProjectExplorer.GccToolChain.Path");
|
||||||
if (m_subType == Clang) {
|
if (m_subType == MinGW) {
|
||||||
|
setTypeDisplayName(Tr::tr("MinGW"));
|
||||||
|
} else if (m_subType == Clang) {
|
||||||
setTypeDisplayName(Tr::tr("Clang"));
|
setTypeDisplayName(Tr::tr("Clang"));
|
||||||
syncAutodetectedWithParentToolchains();
|
syncAutodetectedWithParentToolchains();
|
||||||
}
|
}
|
||||||
@@ -366,14 +368,14 @@ static const Toolchains mingwToolChains()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MingwToolChain *mingwToolChainFromId(const QByteArray &id)
|
static const GccToolChain *mingwToolChainFromId(const QByteArray &id)
|
||||||
{
|
{
|
||||||
if (id.isEmpty())
|
if (id.isEmpty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (const ToolChain *tc : mingwToolChains()) {
|
for (const ToolChain *tc : mingwToolChains()) {
|
||||||
if (tc->id() == id)
|
if (tc->id() == id)
|
||||||
return static_cast<const MingwToolChain *>(tc);
|
return static_cast<const GccToolChain *>(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -382,7 +384,7 @@ static const MingwToolChain *mingwToolChainFromId(const QByteArray &id)
|
|||||||
QString GccToolChain::originalTargetTriple() const
|
QString GccToolChain::originalTargetTriple() const
|
||||||
{
|
{
|
||||||
if (m_subType == Clang) {
|
if (m_subType == Clang) {
|
||||||
if (const MingwToolChain *parentTC = mingwToolChainFromId(m_parentToolChainId))
|
if (const GccToolChain *parentTC = mingwToolChainFromId(m_parentToolChainId))
|
||||||
return parentTC->originalTargetTriple();
|
return parentTC->originalTargetTriple();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,6 +763,17 @@ void GccToolChain::addToEnvironment(Environment &env) const
|
|||||||
|
|
||||||
QStringList GccToolChain::suggestedMkspecList() const
|
QStringList GccToolChain::suggestedMkspecList() const
|
||||||
{
|
{
|
||||||
|
if (m_subType == MinGW) {
|
||||||
|
if (HostOsInfo::isWindowsHost())
|
||||||
|
return {"win32-g++"};
|
||||||
|
if (HostOsInfo::isLinuxHost()) {
|
||||||
|
if (version().startsWith("4.6."))
|
||||||
|
return {"win32-g++-4.6-cross", "unsupported/win32-g++-4.6-cross"};
|
||||||
|
return {"win32-g++-cross", "unsupported/win32-g++-cross"};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
if (m_subType == Clang) {
|
if (m_subType == Clang) {
|
||||||
if (const ToolChain * const parentTc = ToolChainManager::findToolChain(m_parentToolChainId))
|
if (const ToolChain * const parentTc = ToolChainManager::findToolChain(m_parentToolChainId))
|
||||||
return parentTc->suggestedMkspecList();
|
return parentTc->suggestedMkspecList();
|
||||||
@@ -828,7 +841,7 @@ static FilePath mingwAwareMakeCommand(const Environment &environment)
|
|||||||
|
|
||||||
FilePath GccToolChain::makeCommand(const Environment &environment) const
|
FilePath GccToolChain::makeCommand(const Environment &environment) const
|
||||||
{
|
{
|
||||||
if (m_subType == Clang)
|
if (m_subType == Clang || m_subType == MinGW)
|
||||||
return mingwAwareMakeCommand(environment);
|
return mingwAwareMakeCommand(environment);
|
||||||
|
|
||||||
const FilePath tmp = environment.searchInPath("make");
|
const FilePath tmp = environment.searchInPath("make");
|
||||||
@@ -1584,7 +1597,7 @@ bool GccToolChainConfigWidget::isDirtyImpl() const
|
|||||||
if (!m_parentToolchainCombo)
|
if (!m_parentToolchainCombo)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const MingwToolChain *parentTC = mingwToolChainFromId(tc->m_parentToolChainId);
|
const GccToolChain *parentTC = mingwToolChainFromId(tc->m_parentToolChainId);
|
||||||
const QByteArray parentId = parentTC ? parentTC->id() : QByteArray();
|
const QByteArray parentId = parentTC ? parentTC->id() : QByteArray();
|
||||||
return parentId != m_parentToolchainCombo->currentData();
|
return parentId != m_parentToolchainCombo->currentData();
|
||||||
}
|
}
|
||||||
@@ -1734,7 +1747,7 @@ bool GccToolChain::matchesCompilerCommand(const FilePath &command) const
|
|||||||
QString GccToolChain::sysRoot() const
|
QString GccToolChain::sysRoot() const
|
||||||
{
|
{
|
||||||
if (m_subType == Clang) {
|
if (m_subType == Clang) {
|
||||||
if (const MingwToolChain *parentTC = mingwToolChainFromId(m_parentToolChainId)) {
|
if (const GccToolChain *parentTC = mingwToolChainFromId(m_parentToolChainId)) {
|
||||||
const FilePath mingwCompiler = parentTC->compilerCommand();
|
const FilePath mingwCompiler = parentTC->compilerCommand();
|
||||||
return mingwCompiler.parentDir().parentDir().toString();
|
return mingwCompiler.parentDir().parentDir().toString();
|
||||||
}
|
}
|
||||||
@@ -1818,7 +1831,7 @@ void GccToolChainConfigWidget::updateParentToolChainComboBox()
|
|||||||
if (tc->isAutoDetected() || m_parentToolchainCombo->count() == 0)
|
if (tc->isAutoDetected() || m_parentToolchainCombo->count() == 0)
|
||||||
parentId = tc->m_parentToolChainId;
|
parentId = tc->m_parentToolChainId;
|
||||||
|
|
||||||
const MingwToolChain *parentTC = mingwToolChainFromId(parentId);
|
const GccToolChain *parentTC = mingwToolChainFromId(parentId);
|
||||||
|
|
||||||
m_parentToolchainCombo->clear();
|
m_parentToolchainCombo->clear();
|
||||||
m_parentToolchainCombo->addItem(parentTC ? parentTC->displayName() : QString(),
|
m_parentToolchainCombo->addItem(parentTC ? parentTC->displayName() : QString(),
|
||||||
@@ -1836,33 +1849,6 @@ void GccToolChainConfigWidget::updateParentToolChainComboBox()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// MingwToolChain
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
MingwToolChain::MingwToolChain() :
|
|
||||||
GccToolChain(Constants::MINGW_TOOLCHAIN_TYPEID)
|
|
||||||
{
|
|
||||||
setTypeDisplayName(Tr::tr("MinGW"));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList MingwToolChain::suggestedMkspecList() const
|
|
||||||
{
|
|
||||||
if (HostOsInfo::isWindowsHost())
|
|
||||||
return {"win32-g++"};
|
|
||||||
if (HostOsInfo::isLinuxHost()) {
|
|
||||||
if (version().startsWith("4.6."))
|
|
||||||
return {"win32-g++-4.6-cross", "unsupported/win32-g++-4.6-cross"};
|
|
||||||
return {"win32-g++-cross", "unsupported/win32-g++-cross"};
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath MingwToolChain::makeCommand(const Environment &environment) const
|
|
||||||
{
|
|
||||||
return mingwAwareMakeCommand(environment);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// MingwToolChainFactory
|
// MingwToolChainFactory
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -1872,7 +1858,9 @@ MingwToolChainFactory::MingwToolChainFactory()
|
|||||||
setDisplayName(Tr::tr("MinGW"));
|
setDisplayName(Tr::tr("MinGW"));
|
||||||
setSupportedToolChainType(Constants::MINGW_TOOLCHAIN_TYPEID);
|
setSupportedToolChainType(Constants::MINGW_TOOLCHAIN_TYPEID);
|
||||||
setSupportedLanguages({Constants::CXX_LANGUAGE_ID, Constants::C_LANGUAGE_ID});
|
setSupportedLanguages({Constants::CXX_LANGUAGE_ID, Constants::C_LANGUAGE_ID});
|
||||||
setToolchainConstructor([] { return new MingwToolChain; });
|
setToolchainConstructor([] {
|
||||||
|
return new GccToolChain(Constants::MINGW_TOOLCHAIN_TYPEID, GccToolChain::MinGW);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolchains MingwToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
Toolchains MingwToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ inline const QStringList gccPredefinedMacrosOptions(Utils::Id languageId)
|
|||||||
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum SubType { RealGcc, Clang };
|
enum SubType { RealGcc, Clang, MinGW };
|
||||||
|
|
||||||
GccToolChain(Utils::Id typeId, SubType subType = RealGcc);
|
GccToolChain(Utils::Id typeId, SubType subType = RealGcc);
|
||||||
~GccToolChain() override;
|
~GccToolChain() override;
|
||||||
@@ -185,6 +185,7 @@ private:
|
|||||||
|
|
||||||
friend class Internal::GccToolChainConfigWidget;
|
friend class Internal::GccToolChainConfigWidget;
|
||||||
friend class Internal::GccToolChainFactory;
|
friend class Internal::GccToolChainFactory;
|
||||||
|
friend class Internal::MingwToolChainFactory;
|
||||||
friend class Internal::ClangToolChainFactory;
|
friend class Internal::ClangToolChainFactory;
|
||||||
friend class ToolChainFactory;
|
friend class ToolChainFactory;
|
||||||
|
|
||||||
@@ -197,24 +198,6 @@ private:
|
|||||||
QMetaObject::Connection m_thisToolchainRemovedConnection;
|
QMetaObject::Connection m_thisToolchainRemovedConnection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// MingwToolChain
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT MingwToolChain : public GccToolChain
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Utils::FilePath makeCommand(const Utils::Environment &environment) const override;
|
|
||||||
|
|
||||||
QStringList suggestedMkspecList() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
MingwToolChain();
|
|
||||||
|
|
||||||
friend class Internal::MingwToolChainFactory;
|
|
||||||
friend class ToolChainFactory;
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// LinuxIccToolChain
|
// LinuxIccToolChain
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user