1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "projectexplorer_export.h"
39 #include <QtCore/QObject>
40 #include <QtCore/QString>
41 #include <QtCore/QVariantMap>
47 namespace ProjectExplorer {
50 class ToolChainPrivate;
56 class ToolChainConfigWidget;
57 class ToolChainFactory;
58 class ToolChainManager;
60 // --------------------------------------------------------------------------
62 // --------------------------------------------------------------------------
64 class PROJECTEXPLORER_EXPORT ToolChain
69 QString displayName() const;
70 void setDisplayName(const QString &name);
72 bool isAutoDetected() const;
75 virtual QString typeName() const = 0;
76 virtual Abi targetAbi() const = 0;
78 virtual bool isValid() const = 0;
80 /// Returns a list of target ids that this tool chain is restricted to.
81 /// An empty list is shows that the toolchain is compatible with all targets.
82 virtual QStringList restrictedToTargets() const;
84 virtual QByteArray predefinedMacros() const = 0;
85 virtual QList<HeaderPath> systemHeaderPaths() const = 0;
86 virtual void addToEnvironment(Utils::Environment &env) const = 0;
87 virtual QString makeCommand() const = 0;
89 virtual QString debuggerCommand() const = 0;
90 virtual QString defaultMakeTarget() const;
91 virtual IOutputParser *outputParser() const = 0;
93 virtual bool operator ==(const ToolChain &) const;
95 virtual ToolChainConfigWidget *configurationWidget() = 0;
96 virtual bool canClone() const;
97 virtual ToolChain *clone() const = 0;
99 // Used by the toolchainmanager to save user-generated tool chains.
100 // Make sure to call this method when deriving!
101 virtual QVariantMap toMap() const;
104 ToolChain(const QString &id, bool autoDetect);
105 explicit ToolChain(const ToolChain &);
107 void setId(const QString &id);
109 void toolChainUpdated();
111 // Make sure to call this method when deriving!
112 virtual bool fromMap(const QVariantMap &data);
115 void setAutoDetected(bool);
117 Internal::ToolChainPrivate *const m_d;
119 friend class ToolChainManager;
120 friend class ToolChainFactory;
123 // --------------------------------------------------------------------------
125 // --------------------------------------------------------------------------
127 class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
132 // Name used to display the name of the tool chain that will be created.
133 virtual QString displayName() const = 0;
134 virtual QString id() const = 0;
136 virtual QList<ToolChain *> autoDetect();
138 virtual bool canCreate();
139 virtual ToolChain *create();
141 // Used by the ToolChainManager to restore user-generated tool chains
142 virtual bool canRestore(const QVariantMap &data);
143 virtual ToolChain *restore(const QVariantMap &data);
145 static QString idFromMap(const QVariantMap &data);
148 } // namespace ProjectExplorer
150 #endif // TOOLCHAIN_H