gcctoolchain.h 5.38 KB
Newer Older
1
2
3
4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
8
9
10
11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
19
**
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
30
31
32
33
34
35
36
37
38
**
**************************************************************************/

#ifndef GCCTOOLCHAIN_H
#define GCCTOOLCHAIN_H

#include "projectexplorer_export.h"

#include "toolchain.h"
39
#include "abi.h"
40
41
42
43

namespace ProjectExplorer {

namespace Internal {
Tobias Hunger's avatar
Tobias Hunger committed
44
class ClangToolChainFactory;
45
46
47
48
49
50
51
52
53
54
55
56
class GccToolChainFactory;
class MingwToolChainFactory;
class LinuxIccToolChainFactory;
}

// --------------------------------------------------------------------------
// GccToolChain
// --------------------------------------------------------------------------

class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
{
public:
57
58
    QString legacyId() const;

Tobias Hunger's avatar
Tobias Hunger committed
59
60
    QString type() const;
    QString typeDisplayName() const;
61
    Abi targetAbi() const;
62
    QString version() const;
Tobias Hunger's avatar
Tobias Hunger committed
63
64
    QList<Abi> supportedAbis() const;
    void setTargetAbi(const Abi &);
65
66
67

    bool isValid() const;

68
69
70
    QByteArray predefinedMacros(const QStringList &cxxflags) const;
    CompilerFlags compilerFlags(const QStringList &cxxflags) const;

71
72
73
    QList<HeaderPath> systemHeaderPaths() const;
    void addToEnvironment(Utils::Environment &env) const;
    QString makeCommand() const;
74
75
    void setDebuggerCommand(const Utils::FileName &);
    Utils::FileName debuggerCommand() const;
76
    QList<Utils::FileName> suggestedMkspecList() const;
77
78
79
80
81
82
83
84
85
    IOutputParser *outputParser() const;

    QVariantMap toMap() const;
    bool fromMap(const QVariantMap &data);

    ToolChainConfigWidget *configurationWidget();

    bool operator ==(const ToolChain &) const;

86
87
    void setCompilerCommand(const Utils::FileName &);
    Utils::FileName compilerCommand() const;
88
89
90
91
92
93
94

    ToolChain *clone() const;

protected:
    GccToolChain(const QString &id, bool autodetect);
    GccToolChain(const GccToolChain &);

95
    virtual QString defaultDisplayName() const;
96

97
    virtual QList<Abi> detectSupportedAbis() const;
98
    virtual QString detectVersion() const;
99

100
101
    static QList<HeaderPath> gccHeaderPaths(const Utils::FileName &gcc, const QStringList &env, const QString &sysrootPath = QString());

102
103
104
105
106
    mutable QByteArray m_predefinedMacros;

private:
    GccToolChain(bool autodetect);

Tobias Hunger's avatar
Tobias Hunger committed
107
108
    void updateSupportedAbis() const;

109
    Utils::FileName m_compilerCommand;
110
    Utils::FileName m_debuggerCommand;
111

Tobias Hunger's avatar
Tobias Hunger committed
112
113
    Abi m_targetAbi;
    mutable QList<Abi> m_supportedAbis;
114
    mutable QList<HeaderPath> m_headerPaths;
115
    mutable QString m_version;
116
117
118
119
120
121

    friend class Internal::GccToolChainFactory;
    friend class ToolChainFactory;
};

// --------------------------------------------------------------------------
Tobias Hunger's avatar
Tobias Hunger committed
122
123
124
125
126
127
// ClangToolChain
// --------------------------------------------------------------------------

class PROJECTEXPLORER_EXPORT ClangToolChain : public GccToolChain
{
public:
Tobias Hunger's avatar
Tobias Hunger committed
128
129
    QString type() const;
    QString typeDisplayName() const;
Tobias Hunger's avatar
Tobias Hunger committed
130
131
    QString makeCommand() const;

132
133
    IOutputParser *outputParser() const;

Tobias Hunger's avatar
Tobias Hunger committed
134
135
    ToolChain *clone() const;

136
    QList<Utils::FileName> suggestedMkspecList() const;
137

Tobias Hunger's avatar
Tobias Hunger committed
138
139
140
141
142
143
144
145
private:
    ClangToolChain(bool autodetect);

    friend class Internal::ClangToolChainFactory;
    friend class ToolChainFactory;
};

// --------------------------------------------------------------------------
146
147
148
149
150
151
// MingwToolChain
// --------------------------------------------------------------------------

class PROJECTEXPLORER_EXPORT MingwToolChain : public GccToolChain
{
public:
Tobias Hunger's avatar
Tobias Hunger committed
152
153
    QString type() const;
    QString typeDisplayName() const;
154
155
156
157
    QString makeCommand() const;

    ToolChain *clone() const;

158
    QList<Utils::FileName> suggestedMkspecList() const;
159

160
161
162
163
164
165
166
167
168
169
170
171
172
173
private:
    MingwToolChain(bool autodetect);

    friend class Internal::MingwToolChainFactory;
    friend class ToolChainFactory;
};

// --------------------------------------------------------------------------
// LinuxIccToolChain
// --------------------------------------------------------------------------

class PROJECTEXPLORER_EXPORT LinuxIccToolChain : public GccToolChain
{
public:
Tobias Hunger's avatar
Tobias Hunger committed
174
175
    QString type() const;
    QString typeDisplayName() const;
176
177
178
179
180

    IOutputParser *outputParser() const;

    ToolChain *clone() const;

181
    QList<Utils::FileName> suggestedMkspecList() const;
182

183
184
185
186
187
188
189
190
191
192
private:
    LinuxIccToolChain(bool autodetect);

    friend class Internal::LinuxIccToolChainFactory;
    friend class ToolChainFactory;
};

} // namespace ProjectExplorer

#endif // GCCTOOLCHAIN_H