Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/QtDialog/FirstConfigure.h
5000 views
1
2
#pragma once
3
4
#include <QWizard>
5
#include <QWizardPage>
6
7
#include "cmake.h"
8
9
#include "ui_Compilers.h"
10
#include "ui_CrossCompiler.h"
11
12
class QRadioButton;
13
class QComboBox;
14
15
//! the wizard pages we'll use for the first configure of a build
16
enum FirstConfigurePages
17
{
18
Start,
19
NativeSetup,
20
ToolchainSetup,
21
CrossSetup,
22
Done
23
};
24
25
enum class CompilerOption
26
{
27
DefaultPreset,
28
DefaultNative,
29
SpecifyNative,
30
ToolchainFile,
31
Options,
32
};
33
34
//! the first page that gives basic options for what compilers setup to choose
35
//! from
36
class StartCompilerSetup : public QWizardPage
37
{
38
Q_OBJECT
39
public:
40
StartCompilerSetup(QString defaultGeneratorPlatform,
41
QString defaultGeneratorToolset, QWidget* p);
42
~StartCompilerSetup();
43
void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
44
void setCurrentGenerator(QString const& gen);
45
void setToolset(QString const& toolset);
46
void setPlatform(QString const& platform);
47
void setCompilerOption(CompilerOption option);
48
QString getGenerator() const;
49
QString getToolset() const;
50
QString getPlatform() const;
51
52
bool defaultSetup() const;
53
bool compilerSetup() const;
54
bool crossCompilerSetup() const;
55
bool crossCompilerToolChainFile() const;
56
57
int nextId() const;
58
59
signals:
60
void selectionChanged();
61
62
protected slots:
63
void onSelectionChanged(bool);
64
void onGeneratorChanged(int index);
65
66
protected:
67
QComboBox* GeneratorOptions;
68
QRadioButton* CompilerSetupOptions[4];
69
QFrame* ToolsetFrame;
70
QLineEdit* Toolset;
71
QLabel* ToolsetLabel;
72
QFrame* PlatformFrame;
73
QComboBox* PlatformOptions;
74
QLabel* PlatformLabel;
75
QStringList GeneratorsSupportingToolset;
76
QStringList GeneratorsSupportingPlatform;
77
QMultiMap<QString, QString> GeneratorSupportedPlatforms;
78
QMap<QString, QString> GeneratorDefaultPlatform;
79
QString DefaultGeneratorPlatform, DefaultGeneratorToolset;
80
81
private:
82
QFrame* CreateToolsetWidgets();
83
QFrame* CreatePlatformWidgets();
84
};
85
86
//! the page that gives basic options for native compilers
87
class NativeCompilerSetup
88
: public QWizardPage
89
, protected Ui::Compilers
90
{
91
Q_OBJECT
92
public:
93
NativeCompilerSetup(QWidget* p);
94
~NativeCompilerSetup();
95
96
QString getCCompiler() const;
97
void setCCompiler(QString const&);
98
99
QString getCXXCompiler() const;
100
void setCXXCompiler(QString const&);
101
102
QString getFortranCompiler() const;
103
void setFortranCompiler(QString const&);
104
105
int nextId() const { return -1; }
106
};
107
108
//! the page that gives options for cross compilers
109
class CrossCompilerSetup
110
: public QWizardPage
111
, protected Ui::CrossCompiler
112
{
113
Q_OBJECT
114
public:
115
CrossCompilerSetup(QWidget* p);
116
~CrossCompilerSetup();
117
118
QString getSystem() const;
119
void setSystem(QString const&);
120
121
QString getVersion() const;
122
void setVersion(QString const&);
123
124
QString getProcessor() const;
125
void setProcessor(QString const&);
126
127
QString getCCompiler() const;
128
void setCCompiler(QString const&);
129
130
QString getCXXCompiler() const;
131
void setCXXCompiler(QString const&);
132
133
QString getFortranCompiler() const;
134
void setFortranCompiler(QString const&);
135
136
QString getFindRoot() const;
137
void setFindRoot(QString const&);
138
139
enum CrossMode
140
{
141
BOTH,
142
ONLY,
143
NEVER
144
};
145
146
int getProgramMode() const;
147
void setProgramMode(int);
148
int getLibraryMode() const;
149
void setLibraryMode(int);
150
int getIncludeMode() const;
151
void setIncludeMode(int);
152
153
int nextId() const { return -1; }
154
};
155
156
//! the page that gives options for a toolchain file
157
class ToolchainCompilerSetup : public QWizardPage
158
{
159
Q_OBJECT
160
public:
161
ToolchainCompilerSetup(QWidget* p);
162
~ToolchainCompilerSetup();
163
164
QString toolchainFile() const;
165
void setToolchainFile(QString const&);
166
167
int nextId() const { return -1; }
168
169
protected:
170
QCMakeFilePathEditor* ToolchainFile;
171
};
172
173
//! the wizard with the pages
174
class FirstConfigure : public QWizard
175
{
176
Q_OBJECT
177
public:
178
FirstConfigure();
179
~FirstConfigure();
180
181
void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
182
void setCurrentGenerator(QString const& gen);
183
void setToolset(QString const& toolset);
184
void setPlatform(QString const& platform);
185
void setCompilerOption(CompilerOption option);
186
QString getGenerator() const;
187
QString getPlatform() const;
188
QString getToolset() const;
189
190
bool defaultSetup() const;
191
bool compilerSetup() const;
192
bool crossCompilerSetup() const;
193
bool crossCompilerToolChainFile() const;
194
195
QString getCCompiler() const;
196
QString getCXXCompiler() const;
197
QString getFortranCompiler() const;
198
199
QString getSystemName() const;
200
QString getSystemVersion() const;
201
QString getSystemProcessor() const;
202
QString getCrossRoot() const;
203
QString getCrossProgramMode() const;
204
QString getCrossLibraryMode() const;
205
QString getCrossIncludeMode() const;
206
207
QString getCrossCompilerToolChainFile() const;
208
209
void loadFromSettings();
210
void saveToSettings();
211
212
protected:
213
StartCompilerSetup* mStartCompilerSetupPage;
214
NativeCompilerSetup* mNativeCompilerSetupPage;
215
CrossCompilerSetup* mCrossCompilerSetupPage;
216
ToolchainCompilerSetup* mToolchainCompilerSetupPage;
217
QString mDefaultGenerator;
218
};
219
220