forked from qt-creator/qt-creator
ProjectExplorer: Merge LinuxIccToolChain into GccToolChain
Change-Id: I181a98f534c6f3006f750f99190b2f81a3f5a13b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -47,6 +47,18 @@ using namespace Utils;
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static const QStringList languageOption(Id languageId)
|
||||||
|
{
|
||||||
|
if (languageId == Constants::C_LANGUAGE_ID)
|
||||||
|
return {"-x", "c"};
|
||||||
|
return {"-x", "c++"};
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStringList gccPredefinedMacrosOptions(Id languageId)
|
||||||
|
{
|
||||||
|
return languageOption(languageId) + QStringList({"-E", "-dM"});
|
||||||
|
}
|
||||||
|
|
||||||
class TargetTripleWidget;
|
class TargetTripleWidget;
|
||||||
class GccToolChainConfigWidget : public ToolChainConfigWidget
|
class GccToolChainConfigWidget : public ToolChainConfigWidget
|
||||||
{
|
{
|
||||||
@@ -296,7 +308,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 == MinGW) {
|
if (m_subType == LinuxIcc) {
|
||||||
|
setTypeDisplayName(Tr::tr("ICC"));
|
||||||
|
} else if (m_subType == MinGW) {
|
||||||
setTypeDisplayName(Tr::tr("MinGW"));
|
setTypeDisplayName(Tr::tr("MinGW"));
|
||||||
} else if (m_subType == Clang) {
|
} else if (m_subType == Clang) {
|
||||||
setTypeDisplayName(Tr::tr("Clang"));
|
setTypeDisplayName(Tr::tr("Clang"));
|
||||||
@@ -551,6 +565,23 @@ LanguageExtensions GccToolChain::languageExtensions(const QStringList &cxxflags)
|
|||||||
if (m_subType == Clang && cxxflags.contains("-fborland-extensions"))
|
if (m_subType == Clang && cxxflags.contains("-fborland-extensions"))
|
||||||
extensions |= LanguageExtension::Borland;
|
extensions |= LanguageExtension::Borland;
|
||||||
|
|
||||||
|
if (m_subType == LinuxIcc) {
|
||||||
|
// and "-fms-dialect[=ver]" instead of "-fms-extensions".
|
||||||
|
// see UNIX manual for "icc"
|
||||||
|
// FIXME: This copy seems unneeded.
|
||||||
|
QStringList copy = cxxflags;
|
||||||
|
copy.removeAll("-fopenmp");
|
||||||
|
copy.removeAll("-fms-extensions");
|
||||||
|
|
||||||
|
if (cxxflags.contains("-openmp"))
|
||||||
|
extensions |= LanguageExtension::OpenMP;
|
||||||
|
if (cxxflags.contains("-fms-dialect")
|
||||||
|
|| cxxflags.contains("-fms-dialect=8")
|
||||||
|
|| cxxflags.contains("-fms-dialect=9")
|
||||||
|
|| cxxflags.contains("-fms-dialect=10"))
|
||||||
|
extensions |= LanguageExtension::Microsoft;
|
||||||
|
}
|
||||||
|
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,6 +794,9 @@ void GccToolChain::addToEnvironment(Environment &env) const
|
|||||||
|
|
||||||
QStringList GccToolChain::suggestedMkspecList() const
|
QStringList GccToolChain::suggestedMkspecList() const
|
||||||
{
|
{
|
||||||
|
if (m_subType == LinuxIcc)
|
||||||
|
return {QString("linux-icc-%1").arg(targetAbi().wordWidth())};
|
||||||
|
|
||||||
if (m_subType == MinGW) {
|
if (m_subType == MinGW) {
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
return {"win32-g++"};
|
return {"win32-g++"};
|
||||||
@@ -850,6 +884,9 @@ FilePath GccToolChain::makeCommand(const Environment &environment) const
|
|||||||
|
|
||||||
QList<OutputLineParser *> GccToolChain::createOutputParsers() const
|
QList<OutputLineParser *> GccToolChain::createOutputParsers() const
|
||||||
{
|
{
|
||||||
|
if (m_subType == LinuxIcc)
|
||||||
|
return LinuxIccParser::iccParserSuite();
|
||||||
|
|
||||||
if (m_subType == Clang)
|
if (m_subType == Clang)
|
||||||
return ClangParser::clangParserSuite();
|
return ClangParser::clangParserSuite();
|
||||||
|
|
||||||
@@ -1906,48 +1943,6 @@ Toolchains MingwToolChainFactory::detectForImport(const ToolChainDescription &tc
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// LinuxIccToolChain
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
LinuxIccToolChain::LinuxIccToolChain() :
|
|
||||||
GccToolChain(Constants::LINUXICC_TOOLCHAIN_TYPEID)
|
|
||||||
{
|
|
||||||
setTypeDisplayName(Tr::tr("ICC"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to \a GccToolchain::languageExtensions, but uses "-openmp" instead of
|
|
||||||
* "-fopenmp" and "-fms-dialect[=ver]" instead of "-fms-extensions".
|
|
||||||
* @see UNIX manual for "icc"
|
|
||||||
*/
|
|
||||||
LanguageExtensions LinuxIccToolChain::languageExtensions(const QStringList &cxxflags) const
|
|
||||||
{
|
|
||||||
QStringList copy = cxxflags;
|
|
||||||
copy.removeAll("-fopenmp");
|
|
||||||
copy.removeAll("-fms-extensions");
|
|
||||||
|
|
||||||
LanguageExtensions extensions = GccToolChain::languageExtensions(cxxflags);
|
|
||||||
if (cxxflags.contains("-openmp"))
|
|
||||||
extensions |= LanguageExtension::OpenMP;
|
|
||||||
if (cxxflags.contains("-fms-dialect")
|
|
||||||
|| cxxflags.contains("-fms-dialect=8")
|
|
||||||
|| cxxflags.contains("-fms-dialect=9")
|
|
||||||
|| cxxflags.contains("-fms-dialect=10"))
|
|
||||||
extensions |= LanguageExtension::Microsoft;
|
|
||||||
return extensions;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<OutputLineParser *> LinuxIccToolChain::createOutputParsers() const
|
|
||||||
{
|
|
||||||
return LinuxIccParser::iccParserSuite();
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList LinuxIccToolChain::suggestedMkspecList() const
|
|
||||||
{
|
|
||||||
return {QString("linux-icc-%1").arg(targetAbi().wordWidth())};
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// LinuxIccToolChainFactory
|
// LinuxIccToolChainFactory
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -1957,7 +1952,9 @@ LinuxIccToolChainFactory::LinuxIccToolChainFactory()
|
|||||||
setDisplayName(Tr::tr("ICC"));
|
setDisplayName(Tr::tr("ICC"));
|
||||||
setSupportedToolChainType(Constants::LINUXICC_TOOLCHAIN_TYPEID);
|
setSupportedToolChainType(Constants::LINUXICC_TOOLCHAIN_TYPEID);
|
||||||
setSupportedLanguages({Constants::CXX_LANGUAGE_ID, Constants::C_LANGUAGE_ID});
|
setSupportedLanguages({Constants::CXX_LANGUAGE_ID, Constants::C_LANGUAGE_ID});
|
||||||
setToolchainConstructor([] { return new LinuxIccToolChain; });
|
setToolchainConstructor([] {
|
||||||
|
return new GccToolChain(Constants::LINUXICC_TOOLCHAIN_TYPEID, GccToolChain::LinuxIcc);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolchains LinuxIccToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
Toolchains LinuxIccToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
#include "abi.h"
|
#include "abi.h"
|
||||||
#include "headerpath.h"
|
#include "headerpath.h"
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -24,28 +22,19 @@ class GccToolChainConfigWidget;
|
|||||||
class GccToolChainFactory;
|
class GccToolChainFactory;
|
||||||
class MingwToolChainFactory;
|
class MingwToolChainFactory;
|
||||||
class LinuxIccToolChainFactory;
|
class LinuxIccToolChainFactory;
|
||||||
|
|
||||||
|
const QStringList gccPredefinedMacrosOptions(Utils::Id languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// GccToolChain
|
// GccToolChain
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
inline const QStringList languageOption(Utils::Id languageId)
|
|
||||||
{
|
|
||||||
if (languageId == Constants::C_LANGUAGE_ID)
|
|
||||||
return {"-x", "c"};
|
|
||||||
return {"-x", "c++"};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const QStringList gccPredefinedMacrosOptions(Utils::Id languageId)
|
|
||||||
{
|
|
||||||
return languageOption(languageId) + QStringList({"-E", "-dM"});
|
|
||||||
}
|
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum SubType { RealGcc, Clang, MinGW };
|
enum SubType { RealGcc, Clang, MinGW, LinuxIcc };
|
||||||
|
|
||||||
GccToolChain(Utils::Id typeId, SubType subType = RealGcc);
|
GccToolChain(Utils::Id typeId, SubType subType = RealGcc);
|
||||||
~GccToolChain() override;
|
~GccToolChain() override;
|
||||||
@@ -185,6 +174,7 @@ private:
|
|||||||
|
|
||||||
friend class Internal::GccToolChainConfigWidget;
|
friend class Internal::GccToolChainConfigWidget;
|
||||||
friend class Internal::GccToolChainFactory;
|
friend class Internal::GccToolChainFactory;
|
||||||
|
friend class Internal::LinuxIccToolChainFactory;
|
||||||
friend class Internal::MingwToolChainFactory;
|
friend class Internal::MingwToolChainFactory;
|
||||||
friend class Internal::ClangToolChainFactory;
|
friend class Internal::ClangToolChainFactory;
|
||||||
friend class ToolChainFactory;
|
friend class ToolChainFactory;
|
||||||
@@ -198,25 +188,6 @@ private:
|
|||||||
QMetaObject::Connection m_thisToolchainRemovedConnection;
|
QMetaObject::Connection m_thisToolchainRemovedConnection;
|
||||||
};
|
};
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// LinuxIccToolChain
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT LinuxIccToolChain : public GccToolChain
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
|
||||||
QList<Utils::OutputLineParser *> createOutputParsers() const override;
|
|
||||||
|
|
||||||
QStringList suggestedMkspecList() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
LinuxIccToolChain();
|
|
||||||
|
|
||||||
friend class Internal::LinuxIccToolChainFactory;
|
|
||||||
friend class ToolChainFactory;
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Factories
|
// Factories
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user