2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-03-20 14:57:12 +01:00
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
#include "toolchain.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
#include "abi.h"
|
2013-03-25 17:13:18 +01:00
|
|
|
#include "headerpath.h"
|
2016-12-16 00:43:14 +01:00
|
|
|
#include "projectexplorerconstants.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
#include "toolchainmanager.h"
|
2013-03-21 12:27:18 +01:00
|
|
|
#include "task.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
|
2013-03-25 17:13:18 +01:00
|
|
|
#include <utils/fileutils.h>
|
2015-07-09 11:34:37 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2009-03-16 18:13:45 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QCoreApplication>
|
2018-06-11 12:52:04 +02:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileInfo>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QUuid>
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2022-01-18 15:42:02 +01:00
|
|
|
#include <utility>
|
|
|
|
|
|
2020-11-13 09:39:32 +01:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2011-05-10 15:19:38 +02:00
|
|
|
static const char ID_KEY[] = "ProjectExplorer.ToolChain.Id";
|
|
|
|
|
static const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ToolChain.DisplayName";
|
2011-12-19 12:06:44 +01:00
|
|
|
static const char AUTODETECT_KEY[] = "ProjectExplorer.ToolChain.Autodetect";
|
2021-07-12 14:19:23 +02:00
|
|
|
static const char DETECTION_SOURCE_KEY[] = "ProjectExplorer.ToolChain.DetectionSource";
|
2021-04-30 10:11:16 +02:00
|
|
|
static const char LANGUAGE_KEY_V1[] = "ProjectExplorer.ToolChain.Language"; // For QtCreator <= 4.2
|
2016-12-16 00:43:14 +01:00
|
|
|
static const char LANGUAGE_KEY_V2[] = "ProjectExplorer.ToolChain.LanguageV2"; // For QtCreator > 4.2
|
2022-01-20 16:53:55 +01:00
|
|
|
const char CODE_MODEL_TRIPLE_KEY[] = "ExplicitCodeModelTargetTriple";
|
2012-02-07 18:05:09 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
namespace Internal {
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2019-05-13 16:18:25 +02:00
|
|
|
static QList<ToolChainFactory *> g_toolChainFactories;
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// ToolChainPrivate
|
|
|
|
|
// --------------------------------------------------------------------------
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
class ToolChainPrivate
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
public:
|
2018-07-12 22:17:17 +02:00
|
|
|
using Detection = ToolChain::Detection;
|
2013-09-03 10:58:59 +02:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
explicit ToolChainPrivate(Utils::Id typeId) :
|
2015-07-09 11:34:37 +02:00
|
|
|
m_id(QUuid::createUuid().toByteArray()),
|
|
|
|
|
m_typeId(typeId),
|
2019-05-09 11:24:54 +02:00
|
|
|
m_predefinedMacrosCache(new ToolChain::MacrosCache::element_type()),
|
|
|
|
|
m_headerPathsCache(new ToolChain::HeaderPathsCache::element_type())
|
2015-07-07 15:37:50 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_typeId.isValid(), return);
|
|
|
|
|
QTC_ASSERT(!m_typeId.toString().contains(QLatin1Char(':')), return);
|
|
|
|
|
}
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray m_id;
|
2020-11-13 09:39:32 +01:00
|
|
|
FilePath m_compilerCommand;
|
|
|
|
|
QString m_compilerCommandKey;
|
2020-11-10 14:05:58 +01:00
|
|
|
Abi m_targetAbi;
|
|
|
|
|
QString m_targetAbiKey;
|
2020-06-26 13:59:38 +02:00
|
|
|
QSet<Utils::Id> m_supportedLanguages;
|
2016-04-13 15:52:14 +02:00
|
|
|
mutable QString m_displayName;
|
2019-06-19 17:28:20 +02:00
|
|
|
QString m_typeDisplayName;
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id m_typeId;
|
|
|
|
|
Utils::Id m_language;
|
2019-05-08 19:03:15 +02:00
|
|
|
Detection m_detection = ToolChain::UninitializedDetection;
|
2021-07-12 14:19:23 +02:00
|
|
|
QString m_detectionSource;
|
2022-01-20 16:53:55 +01:00
|
|
|
QString m_explicitCodeModelTargetTriple;
|
2019-05-09 11:24:54 +02:00
|
|
|
|
|
|
|
|
ToolChain::MacrosCache m_predefinedMacrosCache;
|
|
|
|
|
ToolChain::HeaderPathsCache m_headerPathsCache;
|
2011-02-01 18:36:00 +01:00
|
|
|
};
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
|
2021-04-30 10:11:16 +02:00
|
|
|
// Deprecated used from QtCreator <= 4.2
|
|
|
|
|
|
|
|
|
|
Utils::Id fromLanguageV1(int language)
|
|
|
|
|
{
|
|
|
|
|
switch (language)
|
|
|
|
|
{
|
|
|
|
|
case Deprecated::Toolchain::C :
|
|
|
|
|
return Utils::Id(Constants::C_LANGUAGE_ID);
|
|
|
|
|
case Deprecated::Toolchain::Cxx:
|
|
|
|
|
return Utils::Id(Constants::CXX_LANGUAGE_ID);
|
|
|
|
|
case Deprecated::Toolchain::None:
|
|
|
|
|
default:
|
|
|
|
|
return Utils::Id();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
namespace Deprecated {
|
|
|
|
|
namespace Toolchain {
|
|
|
|
|
QString languageId(Language l)
|
|
|
|
|
{
|
|
|
|
|
switch (l) {
|
|
|
|
|
case Language::None:
|
|
|
|
|
return QStringLiteral("None");
|
|
|
|
|
case Language::C:
|
|
|
|
|
return QStringLiteral("C");
|
|
|
|
|
case Language::Cxx:
|
|
|
|
|
return QStringLiteral("Cxx");
|
|
|
|
|
};
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
} // namespace Toolchain
|
|
|
|
|
} // namespace Deprecated
|
2016-12-16 00:43:14 +01:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ToolChain
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The ToolChain class represents a tool chain.
|
2011-04-14 12:58:14 +02:00
|
|
|
\sa ProjectExplorer::ToolChainManager
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
ToolChain::ToolChain(Utils::Id typeId) :
|
2019-05-08 19:03:15 +02:00
|
|
|
d(std::make_unique<Internal::ToolChainPrivate>(typeId))
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
|
|
|
|
}
|
2010-04-09 18:43:05 +02:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
void ToolChain::setLanguage(Utils::Id language)
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
2017-05-26 16:53:09 +03:00
|
|
|
QTC_ASSERT(!d->m_language.isValid() || isAutoDetected(), return);
|
2016-12-16 00:43:14 +01:00
|
|
|
QTC_ASSERT(language.isValid(), return);
|
|
|
|
|
QTC_ASSERT(ToolChainManager::isLanguageSupported(language), return);
|
2016-07-12 10:22:09 +02:00
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
d->m_language = language;
|
2016-07-12 10:22:09 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-16 13:59:39 +02:00
|
|
|
ToolChain::~ToolChain() = default;
|
2010-04-09 18:43:05 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QString ToolChain::displayName() const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
if (d->m_displayName.isEmpty())
|
2012-01-30 11:55:21 +01:00
|
|
|
return typeDisplayName();
|
2011-09-07 14:26:11 +02:00
|
|
|
return d->m_displayName;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 13:27:26 +01:00
|
|
|
void ToolChain::setDisplayName(const QString &name)
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
if (d->m_displayName == name)
|
2011-03-24 13:27:26 +01:00
|
|
|
return;
|
|
|
|
|
|
2011-09-07 14:26:11 +02:00
|
|
|
d->m_displayName = name;
|
2011-03-24 13:27:26 +01:00
|
|
|
toolChainUpdated();
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2020-09-08 16:54:11 +02:00
|
|
|
bool ToolChain::isAutoDetected() const
|
|
|
|
|
{
|
|
|
|
|
return detection() == AutoDetection || detection() == AutoDetectionFromSdk;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
ToolChain::Detection ToolChain::detection() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2013-09-03 10:58:59 +02:00
|
|
|
return d->m_detection;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-12 14:19:23 +02:00
|
|
|
QString ToolChain::detectionSource() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_detectionSource;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray ToolChain::id() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
return d->m_id;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-27 14:22:15 +02:00
|
|
|
QStringList ToolChain::suggestedMkspecList() const
|
2013-03-25 17:13:18 +01:00
|
|
|
{
|
2019-05-27 14:22:15 +02:00
|
|
|
return {};
|
2013-03-25 17:13:18 +01:00
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id ToolChain::typeId() const
|
2015-07-09 11:34:37 +02:00
|
|
|
{
|
|
|
|
|
return d->m_typeId;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-27 11:04:18 +02:00
|
|
|
Abis ToolChain::supportedAbis() const
|
2016-09-20 15:59:56 +02:00
|
|
|
{
|
2017-02-22 15:09:35 +01:00
|
|
|
return {targetAbi()};
|
2016-09-20 15:59:56 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-13 12:53:14 +01:00
|
|
|
bool ToolChain::isValid() const
|
|
|
|
|
{
|
|
|
|
|
if (compilerCommand().isEmpty())
|
|
|
|
|
return false;
|
2021-04-29 07:44:01 +02:00
|
|
|
return compilerCommand().isExecutableFile();
|
2020-11-13 12:53:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-06-11 12:52:04 +02:00
|
|
|
QStringList ToolChain::includedFiles(const QStringList &flags, const QString &directory) const
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(flags)
|
|
|
|
|
Q_UNUSED(directory)
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id ToolChain::language() const
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
|
|
|
|
return d->m_language;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChain::operator == (const ToolChain &tc) const
|
2010-04-21 17:24:37 +02:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
if (this == &tc)
|
|
|
|
|
return true;
|
2010-09-08 15:22:58 +02:00
|
|
|
|
2011-12-19 12:06:44 +01:00
|
|
|
// We ignore displayname
|
2016-10-30 12:01:38 +02:00
|
|
|
return typeId() == tc.typeId()
|
|
|
|
|
&& isAutoDetected() == tc.isAutoDetected()
|
|
|
|
|
&& language() == tc.language();
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-13 16:18:25 +02:00
|
|
|
ToolChain *ToolChain::clone() const
|
|
|
|
|
{
|
2021-02-16 22:43:21 +01:00
|
|
|
for (ToolChainFactory *f : qAsConst(Internal::g_toolChainFactories)) {
|
2019-05-13 16:18:25 +02:00
|
|
|
if (f->supportedToolChainType() == d->m_typeId) {
|
|
|
|
|
ToolChain *tc = f->create();
|
|
|
|
|
QTC_ASSERT(tc, return nullptr);
|
|
|
|
|
tc->fromMap(toMap());
|
|
|
|
|
// New ID for the clone. It's different.
|
|
|
|
|
tc->d->m_id = QUuid::createUuid().toByteArray();
|
|
|
|
|
return tc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QTC_CHECK(false);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to save user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
Make sure to call this function when deriving.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QVariantMap ToolChain::toMap() const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
QVariantMap result;
|
2015-07-09 11:34:37 +02:00
|
|
|
QString idToSave = d->m_typeId.toString() + QLatin1Char(':') + QString::fromUtf8(id());
|
|
|
|
|
result.insert(QLatin1String(ID_KEY), idToSave);
|
2011-02-01 18:36:00 +01:00
|
|
|
result.insert(QLatin1String(DISPLAY_NAME_KEY), displayName());
|
2011-12-19 12:06:44 +01:00
|
|
|
result.insert(QLatin1String(AUTODETECT_KEY), isAutoDetected());
|
2021-07-12 14:19:23 +02:00
|
|
|
result.insert(QLatin1String(DETECTION_SOURCE_KEY), d->m_detectionSource);
|
2022-01-20 16:53:55 +01:00
|
|
|
result.insert(CODE_MODEL_TRIPLE_KEY, d->m_explicitCodeModelTargetTriple);
|
2021-04-30 10:11:16 +02:00
|
|
|
// <Compatibility with QtC 4.2>
|
|
|
|
|
int oldLanguageId = -1;
|
|
|
|
|
if (language() == ProjectExplorer::Constants::C_LANGUAGE_ID)
|
|
|
|
|
oldLanguageId = 1;
|
|
|
|
|
else if (language() == ProjectExplorer::Constants::CXX_LANGUAGE_ID)
|
|
|
|
|
oldLanguageId = 2;
|
|
|
|
|
if (oldLanguageId >= 0)
|
|
|
|
|
result.insert(LANGUAGE_KEY_V1, oldLanguageId);
|
|
|
|
|
// </Compatibility>
|
2016-12-16 00:43:14 +01:00
|
|
|
result.insert(QLatin1String(LANGUAGE_KEY_V2), language().toSetting());
|
2020-11-10 14:05:58 +01:00
|
|
|
if (!d->m_targetAbiKey.isEmpty())
|
|
|
|
|
result.insert(d->m_targetAbiKey, d->m_targetAbi.toString());
|
2020-11-13 09:39:32 +01:00
|
|
|
if (!d->m_compilerCommandKey.isEmpty())
|
2021-04-29 07:44:32 +02:00
|
|
|
result.insert(d->m_compilerCommandKey, d->m_compilerCommand.toVariant());
|
2011-02-01 18:36:00 +01:00
|
|
|
return result;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 13:27:26 +01:00
|
|
|
void ToolChain::toolChainUpdated()
|
|
|
|
|
{
|
2019-05-09 11:24:54 +02:00
|
|
|
d->m_predefinedMacrosCache->invalidate();
|
|
|
|
|
d->m_headerPathsCache->invalidate();
|
|
|
|
|
|
2013-08-29 13:14:19 +02:00
|
|
|
ToolChainManager::notifyAboutUpdate(this);
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
void ToolChain::setDetection(ToolChain::Detection de)
|
2011-03-01 16:34:02 +01:00
|
|
|
{
|
2021-05-18 14:32:26 +02:00
|
|
|
d->m_detection = de;
|
2011-03-01 16:34:02 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-12 14:19:23 +02:00
|
|
|
void ToolChain::setDetectionSource(const QString &source)
|
|
|
|
|
{
|
|
|
|
|
d->m_detectionSource = source;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 17:28:20 +02:00
|
|
|
QString ToolChain::typeDisplayName() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_typeDisplayName;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-10 14:05:58 +01:00
|
|
|
Abi ToolChain::targetAbi() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_targetAbi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setTargetAbi(const Abi &abi)
|
|
|
|
|
{
|
|
|
|
|
if (abi == d->m_targetAbi)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
d->m_targetAbi = abi;
|
|
|
|
|
toolChainUpdated();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setTargetAbiNoSignal(const Abi &abi)
|
|
|
|
|
{
|
|
|
|
|
d->m_targetAbi = abi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setTargetAbiKey(const QString &abiKey)
|
|
|
|
|
{
|
|
|
|
|
d->m_targetAbiKey = abiKey;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-13 09:39:32 +01:00
|
|
|
FilePath ToolChain::compilerCommand() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_compilerCommand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setCompilerCommand(const FilePath &command)
|
|
|
|
|
{
|
|
|
|
|
if (command == d->m_compilerCommand)
|
|
|
|
|
return;
|
|
|
|
|
d->m_compilerCommand = command;
|
|
|
|
|
toolChainUpdated();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setCompilerCommandKey(const QString &commandKey)
|
|
|
|
|
{
|
|
|
|
|
d->m_compilerCommandKey = commandKey;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-19 17:28:20 +02:00
|
|
|
void ToolChain::setTypeDisplayName(const QString &typeName)
|
|
|
|
|
{
|
|
|
|
|
d->m_typeDisplayName = typeName;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to load user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
Make sure to call this function when deriving.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChain::fromMap(const QVariantMap &data)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
d->m_displayName = data.value(QLatin1String(DISPLAY_NAME_KEY)).toString();
|
2015-07-09 11:34:37 +02:00
|
|
|
|
2011-12-19 12:06:44 +01:00
|
|
|
// make sure we have new style ids:
|
2015-07-09 11:34:37 +02:00
|
|
|
const QString id = data.value(QLatin1String(ID_KEY)).toString();
|
|
|
|
|
int pos = id.indexOf(QLatin1Char(':'));
|
|
|
|
|
QTC_ASSERT(pos > 0, return false);
|
2020-06-26 13:59:38 +02:00
|
|
|
d->m_typeId = Utils::Id::fromString(id.left(pos));
|
2015-07-14 11:12:14 +02:00
|
|
|
d->m_id = id.mid(pos + 1).toUtf8();
|
2015-07-09 11:34:37 +02:00
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
|
2019-05-10 16:58:30 +02:00
|
|
|
d->m_detection = autoDetect ? AutoDetection : ManualDetection;
|
2021-07-12 14:19:23 +02:00
|
|
|
d->m_detectionSource = data.value(DETECTION_SOURCE_KEY).toString();
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2022-01-20 16:53:55 +01:00
|
|
|
d->m_explicitCodeModelTargetTriple = data.value(CODE_MODEL_TRIPLE_KEY).toString();
|
|
|
|
|
|
2017-01-23 16:30:06 +01:00
|
|
|
if (data.contains(LANGUAGE_KEY_V2)) {
|
|
|
|
|
// remove hack to trim language id in 4.4: This is to fix up broken language
|
|
|
|
|
// ids that happened in 4.3 master branch
|
|
|
|
|
const QString langId = data.value(QLatin1String(LANGUAGE_KEY_V2)).toString();
|
|
|
|
|
const int pos = langId.lastIndexOf('.');
|
|
|
|
|
if (pos >= 0)
|
2020-06-26 13:59:38 +02:00
|
|
|
d->m_language = Utils::Id::fromString(langId.mid(pos + 1));
|
2017-01-23 16:30:06 +01:00
|
|
|
else
|
2020-06-26 13:59:38 +02:00
|
|
|
d->m_language = Utils::Id::fromString(langId);
|
2021-04-30 10:11:16 +02:00
|
|
|
} else if (data.contains(LANGUAGE_KEY_V1)) { // Import from old settings
|
|
|
|
|
d->m_language = Internal::fromLanguageV1(data.value(QLatin1String(LANGUAGE_KEY_V1)).toInt());
|
2017-01-23 16:30:06 +01:00
|
|
|
}
|
2016-12-16 00:43:14 +01:00
|
|
|
|
|
|
|
|
if (!d->m_language.isValid())
|
2020-06-26 13:59:38 +02:00
|
|
|
d->m_language = Utils::Id(Constants::CXX_LANGUAGE_ID);
|
2016-07-12 10:22:09 +02:00
|
|
|
|
2020-11-10 14:05:58 +01:00
|
|
|
if (!d->m_targetAbiKey.isEmpty())
|
|
|
|
|
d->m_targetAbi = Abi::fromString(data.value(d->m_targetAbiKey).toString());
|
|
|
|
|
|
2021-04-29 07:44:32 +02:00
|
|
|
d->m_compilerCommand = FilePath::fromVariant(data.value(d->m_compilerCommandKey));
|
2020-11-13 09:39:32 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
return true;
|
2009-12-09 13:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-09 11:24:54 +02:00
|
|
|
const ToolChain::HeaderPathsCache &ToolChain::headerPathsCache() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_headerPathsCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ToolChain::MacrosCache &ToolChain::predefinedMacrosCache() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_predefinedMacrosCache;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-27 10:18:44 +02:00
|
|
|
static long toLanguageVersionAsLong(QByteArray dateAsByteArray)
|
|
|
|
|
{
|
|
|
|
|
dateAsByteArray.chop(1); // Strip 'L'.
|
2018-11-26 12:22:57 +01:00
|
|
|
|
|
|
|
|
bool success = false;
|
|
|
|
|
const int result = dateAsByteArray.toLong(&success);
|
|
|
|
|
QTC_CHECK(success);
|
|
|
|
|
|
|
|
|
|
return result;
|
2018-09-27 10:18:44 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-09 18:31:20 +01:00
|
|
|
Utils::LanguageVersion ToolChain::cxxLanguageVersion(const QByteArray &cplusplusMacroValue)
|
2018-09-27 10:18:44 +02:00
|
|
|
{
|
2019-01-09 18:31:20 +01:00
|
|
|
using Utils::LanguageVersion;
|
2018-09-27 10:18:44 +02:00
|
|
|
const long version = toLanguageVersionAsLong(cplusplusMacroValue);
|
|
|
|
|
|
|
|
|
|
if (version > 201703L)
|
2018-10-08 09:49:02 +02:00
|
|
|
return LanguageVersion::LatestCxx;
|
2018-10-09 09:16:26 +02:00
|
|
|
if (version > 201402L)
|
|
|
|
|
return LanguageVersion::CXX17;
|
|
|
|
|
if (version > 201103L)
|
|
|
|
|
return LanguageVersion::CXX14;
|
|
|
|
|
if (version == 201103L)
|
|
|
|
|
return LanguageVersion::CXX11;
|
|
|
|
|
|
|
|
|
|
return LanguageVersion::CXX03;
|
2018-09-27 10:18:44 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::LanguageVersion ToolChain::languageVersion(const Utils::Id &language, const Macros ¯os)
|
2018-09-27 10:18:44 +02:00
|
|
|
{
|
2019-01-09 18:31:20 +01:00
|
|
|
using Utils::LanguageVersion;
|
|
|
|
|
|
2018-09-27 10:18:44 +02:00
|
|
|
if (language == Constants::CXX_LANGUAGE_ID) {
|
|
|
|
|
for (const ProjectExplorer::Macro ¯o : macros) {
|
|
|
|
|
if (macro.key == "__cplusplus") // Check for the C++ identifying macro
|
|
|
|
|
return cxxLanguageVersion(macro.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTC_CHECK(false && "__cplusplus is not predefined, assuming latest C++ we support.");
|
2018-10-08 09:49:02 +02:00
|
|
|
return LanguageVersion::LatestCxx;
|
2018-09-27 10:18:44 +02:00
|
|
|
} else if (language == Constants::C_LANGUAGE_ID) {
|
|
|
|
|
for (const ProjectExplorer::Macro ¯o : macros) {
|
|
|
|
|
if (macro.key == "__STDC_VERSION__") {
|
|
|
|
|
const long version = toLanguageVersionAsLong(macro.value);
|
|
|
|
|
|
|
|
|
|
if (version > 201710L)
|
2018-10-08 09:49:02 +02:00
|
|
|
return LanguageVersion::LatestC;
|
2018-10-09 09:16:26 +02:00
|
|
|
if (version > 201112L)
|
|
|
|
|
return LanguageVersion::C18;
|
|
|
|
|
if (version > 199901L)
|
|
|
|
|
return LanguageVersion::C11;
|
|
|
|
|
if (version > 199409L)
|
|
|
|
|
return LanguageVersion::C99;
|
|
|
|
|
|
|
|
|
|
return LanguageVersion::C89;
|
2018-09-27 10:18:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The __STDC_VERSION__ macro was introduced after C89.
|
|
|
|
|
// We haven't seen it, so it must be C89.
|
|
|
|
|
return LanguageVersion::C89;
|
|
|
|
|
} else {
|
|
|
|
|
QTC_CHECK(false && "Unexpected toolchain language, assuming latest C++ we support.");
|
2018-10-08 09:49:02 +02:00
|
|
|
return LanguageVersion::LatestCxx;
|
2018-09-27 10:18:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-11 12:52:04 +02:00
|
|
|
QStringList ToolChain::includedFiles(const QString &option,
|
|
|
|
|
const QStringList &flags,
|
|
|
|
|
const QString &directoryPath)
|
|
|
|
|
{
|
|
|
|
|
QStringList result;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < flags.size(); ++i) {
|
|
|
|
|
if (flags[i] == option && i + 1 < flags.size()) {
|
|
|
|
|
QString includeFile = flags[++i];
|
|
|
|
|
if (!QFileInfo(includeFile).isAbsolute())
|
|
|
|
|
includeFile = directoryPath + "/" + includeFile;
|
|
|
|
|
result.append(QDir::cleanPath(includeFile));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-21 12:27:18 +01:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain kit information to validate the kit.
|
2013-03-21 12:27:18 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-05-27 16:09:44 +02:00
|
|
|
Tasks ToolChain::validateKit(const Kit *) const
|
2013-03-21 12:27:18 +01:00
|
|
|
{
|
2019-05-27 16:09:44 +02:00
|
|
|
return {};
|
2013-03-21 12:27:18 +01:00
|
|
|
}
|
|
|
|
|
|
2019-01-07 12:15:40 +01:00
|
|
|
QString ToolChain::sysRoot() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 16:53:55 +01:00
|
|
|
QString ToolChain::explicitCodeModelTargetTriple() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_explicitCodeModelTargetTriple;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ToolChain::effectiveCodeModelTargetTriple() const
|
|
|
|
|
{
|
|
|
|
|
const QString overridden = explicitCodeModelTargetTriple();
|
|
|
|
|
if (!overridden.isEmpty())
|
|
|
|
|
return overridden;
|
|
|
|
|
return originalTargetTriple();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChain::setExplicitCodeModelTargetTriple(const QString &triple)
|
|
|
|
|
{
|
|
|
|
|
d->m_explicitCodeModelTargetTriple = triple;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ToolChainFactory
|
2013-09-10 17:16:10 +02:00
|
|
|
\brief The ToolChainFactory class creates tool chains from settings or
|
|
|
|
|
autodetects them.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QString ProjectExplorer::ToolChainFactory::displayName() const = 0
|
2013-09-10 17:16:10 +02:00
|
|
|
Contains the name used to display the name of the tool chain that will be
|
|
|
|
|
created.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2013-03-03 21:53:38 +04:00
|
|
|
/*!
|
|
|
|
|
\fn QStringList ProjectExplorer::ToolChain::clangParserFlags(const QStringList &cxxflags) const = 0
|
2013-09-10 17:16:10 +02:00
|
|
|
Converts tool chain specific flags to list flags that tune the libclang
|
|
|
|
|
parser.
|
2013-03-03 21:53:38 +04:00
|
|
|
*/
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\fn bool ProjectExplorer::ToolChainFactory::canRestore(const QVariantMap &data)
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to restore user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
2009-03-16 18:13:45 +01:00
|
|
|
|
2017-12-08 17:20:48 +01:00
|
|
|
ToolChainFactory::ToolChainFactory()
|
|
|
|
|
{
|
2019-05-13 16:18:25 +02:00
|
|
|
Internal::g_toolChainFactories.append(this);
|
2017-12-08 17:20:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ToolChainFactory::~ToolChainFactory()
|
|
|
|
|
{
|
2019-05-13 16:18:25 +02:00
|
|
|
Internal::g_toolChainFactories.removeOne(this);
|
2017-12-08 17:20:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QList<ToolChainFactory *> ToolChainFactory::allToolChainFactories()
|
|
|
|
|
{
|
2019-05-13 16:18:25 +02:00
|
|
|
return Internal::g_toolChainFactories;
|
2017-12-08 17:20:48 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-14 17:29:02 +01:00
|
|
|
Toolchains ToolChainFactory::autoDetect(const ToolchainDetector &detector) const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2022-01-14 17:29:02 +01:00
|
|
|
Q_UNUSED(detector)
|
2019-07-02 11:31:12 +02:00
|
|
|
return {};
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2022-01-14 17:29:02 +01:00
|
|
|
Toolchains ToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
2017-02-07 13:13:06 +01:00
|
|
|
{
|
2019-07-02 11:31:12 +02:00
|
|
|
Q_UNUSED(tcd)
|
|
|
|
|
return {};
|
2017-02-07 13:13:06 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-10 18:22:58 +02:00
|
|
|
bool ToolChainFactory::canCreate() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2019-05-10 18:22:58 +02:00
|
|
|
return m_userCreatable;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-14 17:29:02 +01:00
|
|
|
ToolChain *ToolChainFactory::create() const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2019-05-10 17:35:04 +02:00
|
|
|
return m_toolchainConstructor ? m_toolchainConstructor() : nullptr;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-10 17:35:04 +02:00
|
|
|
ToolChain *ToolChainFactory::restore(const QVariantMap &data)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2019-05-10 17:35:04 +02:00
|
|
|
if (!m_toolchainConstructor)
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
|
|
ToolChain *tc = m_toolchainConstructor();
|
|
|
|
|
QTC_ASSERT(tc, return nullptr);
|
|
|
|
|
|
|
|
|
|
if (tc->fromMap(data))
|
|
|
|
|
return tc;
|
|
|
|
|
|
|
|
|
|
delete tc;
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-07 14:20:12 +02:00
|
|
|
static QPair<QString, QString> rawIdData(const QVariantMap &data)
|
|
|
|
|
{
|
|
|
|
|
const QString raw = data.value(QLatin1String(ID_KEY)).toString();
|
|
|
|
|
const int pos = raw.indexOf(QLatin1Char(':'));
|
|
|
|
|
QTC_ASSERT(pos > 0, return qMakePair(QString::fromLatin1("unknown"), QString::fromLatin1("unknown")));
|
|
|
|
|
return qMakePair(raw.mid(0, pos), raw.mid(pos + 1));
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray ToolChainFactory::idFromMap(const QVariantMap &data)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2015-07-07 14:20:12 +02:00
|
|
|
return rawIdData(data).second.toUtf8();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id ToolChainFactory::typeIdFromMap(const QVariantMap &data)
|
2015-07-07 14:20:12 +02:00
|
|
|
{
|
2020-06-26 13:59:38 +02:00
|
|
|
return Utils::Id::fromString(rawIdData(data).first);
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-20 15:45:37 +02:00
|
|
|
void ToolChainFactory::autoDetectionToMap(QVariantMap &data, bool detected)
|
|
|
|
|
{
|
|
|
|
|
data.insert(QLatin1String(AUTODETECT_KEY), detected);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
ToolChain *ToolChainFactory::createToolChain(Utils::Id toolChainType)
|
2019-06-14 12:06:26 +02:00
|
|
|
{
|
|
|
|
|
for (ToolChainFactory *factory : qAsConst(Internal::g_toolChainFactories)) {
|
|
|
|
|
if (factory->m_supportedToolChainType == toolChainType) {
|
|
|
|
|
if (ToolChain *tc = factory->create()) {
|
|
|
|
|
tc->d->m_typeId = toolChainType;
|
|
|
|
|
return tc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-17 16:25:04 +02:00
|
|
|
QList<Utils::Id> ToolChainFactory::supportedLanguages() const
|
2019-05-08 15:36:57 +02:00
|
|
|
{
|
|
|
|
|
return m_supportsAllLanguages ? ToolChainManager::allLanguages() : m_supportedLanguages;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id ToolChainFactory::supportedToolChainType() const
|
2019-05-08 14:56:26 +02:00
|
|
|
{
|
|
|
|
|
return m_supportedToolChainType;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
void ToolChainFactory::setSupportedToolChainType(const Utils::Id &supportedToolChain)
|
2019-05-08 14:56:26 +02:00
|
|
|
{
|
|
|
|
|
m_supportedToolChainType = supportedToolChain;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-17 16:25:04 +02:00
|
|
|
void ToolChainFactory::setSupportedLanguages(const QList<Utils::Id> &supportedLanguages)
|
2019-05-08 15:36:57 +02:00
|
|
|
{
|
|
|
|
|
m_supportedLanguages = supportedLanguages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ToolChainFactory::setSupportsAllLanguages(bool supportsAllLanguages)
|
|
|
|
|
{
|
|
|
|
|
m_supportsAllLanguages = supportsAllLanguages;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 17:35:04 +02:00
|
|
|
void ToolChainFactory::setToolchainConstructor
|
|
|
|
|
(const std::function<ToolChain *()> &toolchainContructor)
|
|
|
|
|
{
|
|
|
|
|
m_toolchainConstructor = toolchainContructor;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-10 18:22:58 +02:00
|
|
|
void ToolChainFactory::setUserCreatable(bool userCreatable)
|
|
|
|
|
{
|
|
|
|
|
m_userCreatable = userCreatable;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 16:37:57 +01:00
|
|
|
ToolchainDetector::ToolchainDetector(const Toolchains &alreadyKnown,
|
|
|
|
|
const IDevice::ConstPtr &device,
|
|
|
|
|
const FilePaths &searchPaths)
|
|
|
|
|
: alreadyKnown(alreadyKnown), device(device), searchPaths(searchPaths)
|
2022-01-14 17:29:02 +01:00
|
|
|
{}
|
|
|
|
|
|
2022-01-18 15:42:02 +01:00
|
|
|
BadToolchain::BadToolchain(const Utils::FilePath &filePath)
|
|
|
|
|
: BadToolchain(filePath, filePath.symLinkTarget(), filePath.lastModified())
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
BadToolchain::BadToolchain(const Utils::FilePath &filePath, const Utils::FilePath &symlinkTarget,
|
|
|
|
|
const QDateTime ×tamp)
|
|
|
|
|
: filePath(filePath), symlinkTarget(symlinkTarget), timestamp(timestamp)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static QString badToolchainFilePathKey() { return {"FilePath"}; }
|
|
|
|
|
static QString badToolchainSymlinkTargetKey() { return {"TargetFilePath"}; }
|
|
|
|
|
static QString badToolchainTimestampKey() { return {"Timestamp"}; }
|
|
|
|
|
|
|
|
|
|
QVariantMap BadToolchain::toMap() const
|
|
|
|
|
{
|
|
|
|
|
return {
|
|
|
|
|
std::make_pair(badToolchainFilePathKey(), filePath.toVariant()),
|
|
|
|
|
std::make_pair(badToolchainSymlinkTargetKey(), symlinkTarget.toVariant()),
|
|
|
|
|
std::make_pair(badToolchainTimestampKey(), timestamp.toMSecsSinceEpoch()),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BadToolchain BadToolchain::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
return {
|
|
|
|
|
FilePath::fromVariant(map.value(badToolchainFilePathKey())),
|
|
|
|
|
FilePath::fromVariant(map.value(badToolchainSymlinkTargetKey())),
|
|
|
|
|
QDateTime::fromMSecsSinceEpoch(map.value(badToolchainTimestampKey()).toLongLong())
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BadToolchains::BadToolchains(const QList<BadToolchain> &toolchains)
|
|
|
|
|
: toolchains(Utils::filtered(toolchains, [](const BadToolchain &badTc) {
|
|
|
|
|
return badTc.filePath.lastModified() == badTc.timestamp
|
|
|
|
|
&& badTc.filePath.symLinkTarget() == badTc.symlinkTarget;
|
|
|
|
|
}))
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
bool BadToolchains::isBadToolchain(const FilePath &toolchain) const
|
|
|
|
|
{
|
|
|
|
|
return Utils::contains(toolchains, [toolchain](const BadToolchain &badTc) {
|
|
|
|
|
return badTc.filePath == toolchain.absoluteFilePath()
|
|
|
|
|
|| badTc.symlinkTarget == toolchain.absoluteFilePath();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant BadToolchains::toVariant() const
|
|
|
|
|
{
|
|
|
|
|
return Utils::transform<QVariantList>(toolchains, &BadToolchain::toMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BadToolchains BadToolchains::fromVariant(const QVariant &v)
|
|
|
|
|
{
|
|
|
|
|
return Utils::transform<QList<BadToolchain>>(v.toList(),
|
|
|
|
|
[](const QVariant &e) { return BadToolchain::fromMap(e.toMap()); });
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
} // namespace ProjectExplorer
|