2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-03-20 14:57:12 +01:00
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
#ifndef TOOLCHAIN_H
|
|
|
|
|
#define TOOLCHAIN_H
|
|
|
|
|
|
2009-09-29 11:39:55 +02:00
|
|
|
#include "projectexplorer_export.h"
|
2013-08-09 17:49:30 +02:00
|
|
|
#include <coreplugin/id.h>
|
2011-11-25 13:19:58 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QVariantMap>
|
2011-02-01 18:36:00 +01:00
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
class Environment;
|
2013-03-25 17:13:18 +01:00
|
|
|
class FileName;
|
2011-02-01 18:36:00 +01:00
|
|
|
}
|
2009-02-10 15:34:25 +01:00
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Internal { class ToolChainPrivate; }
|
2011-02-01 18:36:00 +01:00
|
|
|
|
2011-02-28 16:50:14 +01:00
|
|
|
class Abi;
|
2013-03-25 17:13:18 +01:00
|
|
|
class HeaderPath;
|
2009-12-09 13:54:46 +01:00
|
|
|
class IOutputParser;
|
2011-02-01 18:36:00 +01:00
|
|
|
class ToolChainConfigWidget;
|
|
|
|
|
class ToolChainFactory;
|
2011-03-01 16:34:02 +01:00
|
|
|
class ToolChainManager;
|
2013-03-21 12:27:18 +01:00
|
|
|
class Task;
|
|
|
|
|
class Kit;
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
2011-04-14 12:58:14 +02:00
|
|
|
// ToolChain (documentation inside)
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
2009-02-10 15:34:25 +01:00
|
|
|
|
|
|
|
|
class PROJECTEXPLORER_EXPORT ToolChain
|
|
|
|
|
{
|
|
|
|
|
public:
|
2013-09-03 10:58:59 +02:00
|
|
|
enum Detection {
|
|
|
|
|
ManualDetection,
|
|
|
|
|
AutoDetection,
|
|
|
|
|
AutoDetectionFromSettings
|
|
|
|
|
};
|
|
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
virtual ~ToolChain();
|
2010-01-29 21:33:57 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QString displayName() const;
|
2011-03-24 13:27:26 +01:00
|
|
|
void setDisplayName(const QString &name);
|
2009-06-18 15:16:18 +02:00
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
inline bool isAutoDetected() const { return detection() != ManualDetection; }
|
|
|
|
|
Detection detection() const;
|
|
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray id() const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-03-25 17:13:18 +01:00
|
|
|
virtual QList<Utils::FileName> suggestedMkspecList() const;
|
2012-09-05 09:21:15 +02:00
|
|
|
virtual Utils::FileName suggestedDebugger() const;
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2015-07-09 11:34:37 +02:00
|
|
|
Core::Id typeId() const;
|
2012-01-30 11:55:21 +01:00
|
|
|
virtual QString typeDisplayName() const = 0;
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual Abi targetAbi() const = 0;
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual bool isValid() const = 0;
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2012-02-16 15:09:56 +01:00
|
|
|
virtual QByteArray predefinedMacros(const QStringList &cxxflags) const = 0;
|
|
|
|
|
|
2013-04-28 13:11:48 +04:00
|
|
|
enum CompilerFlag {
|
|
|
|
|
NoFlags = 0,
|
|
|
|
|
StandardCxx11 = 0x1,
|
|
|
|
|
StandardC99 = 0x2,
|
|
|
|
|
StandardC11 = 0x4,
|
|
|
|
|
GnuExtensions = 0x8,
|
|
|
|
|
MicrosoftExtensions = 0x10,
|
|
|
|
|
BorlandExtensions = 0x20,
|
2014-08-21 16:26:06 +02:00
|
|
|
OpenMP = 0x40,
|
|
|
|
|
ObjectiveC = 0x80,
|
|
|
|
|
StandardCxx14 = 0x100,
|
2015-04-14 14:50:14 +02:00
|
|
|
StandardCxx17 = 0x200,
|
|
|
|
|
StandardCxx98 = 0x400,
|
2012-02-16 15:09:56 +01:00
|
|
|
};
|
2013-04-28 13:11:48 +04:00
|
|
|
Q_DECLARE_FLAGS(CompilerFlags, CompilerFlag)
|
|
|
|
|
|
2012-02-16 15:09:56 +01:00
|
|
|
virtual CompilerFlags compilerFlags(const QStringList &cxxflags) const = 0;
|
2013-03-03 21:53:38 +04:00
|
|
|
|
|
|
|
|
enum WarningFlag {
|
|
|
|
|
// General settings
|
|
|
|
|
WarningsAsErrors,
|
|
|
|
|
WarningsDefault,
|
|
|
|
|
WarningsAll,
|
|
|
|
|
WarningsExtra,
|
|
|
|
|
WarningsPedantic,
|
|
|
|
|
|
|
|
|
|
// Any language
|
|
|
|
|
WarnUnusedLocals,
|
|
|
|
|
WarnUnusedParams,
|
|
|
|
|
WarnUnusedFunctions,
|
|
|
|
|
WarnUnusedResult,
|
|
|
|
|
WarnUnusedValue,
|
|
|
|
|
WarnDocumentation,
|
|
|
|
|
WarnUninitializedVars,
|
|
|
|
|
WarnHiddenLocals,
|
|
|
|
|
WarnUnknownPragma,
|
|
|
|
|
WarnDeprecated,
|
|
|
|
|
WarnSignedComparison,
|
|
|
|
|
WarnIgnoredQualfiers,
|
|
|
|
|
|
|
|
|
|
// C++
|
|
|
|
|
WarnOverloadedVirtual,
|
|
|
|
|
WarnEffectiveCxx,
|
|
|
|
|
WarnNonVirtualDestructor
|
|
|
|
|
};
|
|
|
|
|
Q_DECLARE_FLAGS(WarningFlags, WarningFlag)
|
|
|
|
|
|
|
|
|
|
virtual WarningFlags warningFlags(const QStringList &cflags) const = 0;
|
2012-11-20 17:30:05 +01:00
|
|
|
virtual QList<HeaderPath> systemHeaderPaths(const QStringList &cxxflags,
|
|
|
|
|
const Utils::FileName &sysRoot) const = 0;
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual void addToEnvironment(Utils::Environment &env) const = 0;
|
2012-09-11 15:59:17 +02:00
|
|
|
virtual QString makeCommand(const Utils::Environment &env) const = 0;
|
2011-02-22 17:32:22 +01:00
|
|
|
|
2012-01-30 13:07:51 +01:00
|
|
|
virtual Utils::FileName compilerCommand() const = 0;
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual IOutputParser *outputParser() const = 0;
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual bool operator ==(const ToolChain &) const;
|
2010-04-09 18:43:05 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual ToolChainConfigWidget *configurationWidget() = 0;
|
|
|
|
|
virtual bool canClone() const;
|
|
|
|
|
virtual ToolChain *clone() const = 0;
|
2010-04-09 18:43:05 +02:00
|
|
|
|
2011-03-16 17:59:43 +01:00
|
|
|
// Used by the toolchainmanager to save user-generated tool chains.
|
2013-10-07 13:34:40 +02:00
|
|
|
// Make sure to call this function when deriving!
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual QVariantMap toMap() const;
|
2013-03-21 12:27:18 +01:00
|
|
|
virtual QList<Task> validateKit(const Kit *k) const;
|
2009-02-10 15:34:25 +01:00
|
|
|
protected:
|
2015-07-09 11:34:37 +02:00
|
|
|
explicit ToolChain(Core::Id typeId, Detection d);
|
2011-02-01 18:36:00 +01:00
|
|
|
explicit ToolChain(const ToolChain &);
|
2010-03-04 15:23:02 +01:00
|
|
|
|
2011-03-24 13:27:26 +01:00
|
|
|
void toolChainUpdated();
|
|
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
// Make sure to call this function when deriving!
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual bool fromMap(const QVariantMap &data);
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
private:
|
2013-09-03 10:58:59 +02:00
|
|
|
void setDetection(Detection d);
|
2011-03-01 16:34:02 +01:00
|
|
|
|
2011-09-07 14:26:11 +02:00
|
|
|
Internal::ToolChainPrivate *const d;
|
2010-03-04 15:23:02 +01:00
|
|
|
|
2011-03-01 16:34:02 +01:00
|
|
|
friend class ToolChainManager;
|
2011-02-01 18:36:00 +01:00
|
|
|
friend class ToolChainFactory;
|
2009-02-10 15:34:25 +01:00
|
|
|
};
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
public:
|
2013-08-09 17:49:30 +02:00
|
|
|
QString displayName() const { return m_displayName; }
|
2010-03-04 15:23:02 +01:00
|
|
|
|
2015-07-19 10:59:06 +03:00
|
|
|
virtual QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual bool canCreate();
|
|
|
|
|
virtual ToolChain *create();
|
2009-12-09 13:54:46 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
virtual bool canRestore(const QVariantMap &data);
|
|
|
|
|
virtual ToolChain *restore(const QVariantMap &data);
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
static QByteArray idFromMap(const QVariantMap &data);
|
2015-07-07 14:20:12 +02:00
|
|
|
static Core::Id typeIdFromMap(const QVariantMap &data);
|
2012-06-20 15:45:37 +02:00
|
|
|
static void autoDetectionToMap(QVariantMap &data, bool detected);
|
2013-08-09 17:49:30 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void setDisplayName(const QString &name) { m_displayName = name; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_displayName;
|
2011-02-01 18:36:00 +01:00
|
|
|
};
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
} // namespace ProjectExplorer
|
2009-06-10 15:39:16 +02:00
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
#endif // TOOLCHAIN_H
|