|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the tools applications of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
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 |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
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 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include <qmap.h> |
|
43 #include <qstring.h> |
|
44 #include <qstringlist.h> |
|
45 #include <qlist.h> |
|
46 #include <qtextstream.h> |
|
47 #include <qdir.h> |
|
48 |
|
49 QT_BEGIN_NAMESPACE |
|
50 |
|
51 class MakeItem; |
|
52 |
|
53 class Configure |
|
54 { |
|
55 public: |
|
56 Configure( int& argc, char** argv ); |
|
57 ~Configure(); |
|
58 |
|
59 void parseCmdLine(); |
|
60 #if !defined(EVAL) |
|
61 void validateArgs(); |
|
62 #endif |
|
63 bool displayHelp(); |
|
64 |
|
65 QString defaultTo(const QString &option); |
|
66 bool checkAvailability(const QString &part); |
|
67 void autoDetection(); |
|
68 bool verifyConfiguration(); |
|
69 |
|
70 void generateOutputVars(); |
|
71 #if !defined(EVAL) |
|
72 void generateHeaders(); |
|
73 void generateBuildKey(); |
|
74 void generateCachefile(); |
|
75 void displayConfig(); |
|
76 void buildQmake(); |
|
77 void buildHostTools(); |
|
78 #endif |
|
79 void generateMakefiles(); |
|
80 void appendMakeItem(int inList, const QString &item); |
|
81 #if !defined(EVAL) |
|
82 void generateConfigfiles(); |
|
83 #endif |
|
84 void showSummary(); |
|
85 void findProjects( const QString& dirName ); |
|
86 QString firstLicensePath(); |
|
87 |
|
88 #if !defined(EVAL) |
|
89 bool showLicense(QString licenseFile); |
|
90 void readLicense(); |
|
91 #endif |
|
92 |
|
93 QString addDefine(QString def); |
|
94 |
|
95 enum ProjectType { |
|
96 App, |
|
97 Lib, |
|
98 Subdirs |
|
99 }; |
|
100 |
|
101 ProjectType projectType( const QString& proFileName ); |
|
102 bool isDone(); |
|
103 bool isOk(); |
|
104 private: |
|
105 // Our variable dictionaries |
|
106 QMap<QString,QString> dictionary; |
|
107 QStringList licensedModules; |
|
108 QStringList allSqlDrivers; |
|
109 QStringList allConfigs; |
|
110 QStringList disabledModules; |
|
111 QStringList enabledModules; |
|
112 QStringList modules; |
|
113 QStringList disabledBuildParts; |
|
114 // QStringList sqlDrivers; |
|
115 QStringList configCmdLine; |
|
116 QStringList qmakeConfig; |
|
117 QStringList qtConfig; |
|
118 |
|
119 QStringList qmakeSql; |
|
120 QStringList qmakeSqlPlugins; |
|
121 |
|
122 QStringList qmakeStyles; |
|
123 QStringList qmakeStylePlugins; |
|
124 |
|
125 QStringList qmakeFormatPlugins; |
|
126 |
|
127 QStringList qmakeVars; |
|
128 QStringList qmakeDefines; |
|
129 // makeList[0] for qt and qtmain |
|
130 // makeList[1] for subdirs and libs |
|
131 // makeList[2] for the rest |
|
132 QList<MakeItem*> makeList[3]; |
|
133 QStringList qmakeIncludes; |
|
134 QStringList qmakeLibs; |
|
135 QString opensslLibs; |
|
136 |
|
137 QMap<QString,QString> licenseInfo; |
|
138 QString outputLine; |
|
139 |
|
140 QTextStream outStream; |
|
141 QString sourcePath, buildPath; |
|
142 QDir sourceDir, buildDir; |
|
143 |
|
144 // Variables for usage output |
|
145 int optionIndent; |
|
146 int descIndent; |
|
147 int outputWidth; |
|
148 |
|
149 bool useUnixSeparators; |
|
150 QString fixSeparators(QString somePath); |
|
151 bool filesDiffer(const QString &file1, const QString &file2); |
|
152 |
|
153 bool findFile(const QString &fileName); |
|
154 static QString findFileInPaths(const QString &fileName, const QString &paths); |
|
155 #if !defined(EVAL) |
|
156 void reloadCmdLine(); |
|
157 void saveCmdLine(); |
|
158 #endif |
|
159 |
|
160 void desc(const char *description, int startingAt = 0, int wrapIndent = 0); |
|
161 void desc(const char *option, const char *description, bool skipIndent = false, char fillChar = '.'); |
|
162 void desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar = '.'); |
|
163 void applySpecSpecifics(); |
|
164 static QString locateFile(const QString &fileName); |
|
165 static QString locateFileInPaths(const QString &fileName, const QStringList &paths); |
|
166 }; |
|
167 |
|
168 class MakeItem |
|
169 { |
|
170 public: |
|
171 MakeItem( const QString &d, const QString &p, const QString &t, Configure::ProjectType qt ) |
|
172 : directory( d ), |
|
173 proFile( p ), |
|
174 target( t ), |
|
175 qmakeTemplate( qt ) |
|
176 { } |
|
177 |
|
178 QString directory; |
|
179 QString proFile; |
|
180 QString target; |
|
181 Configure::ProjectType qmakeTemplate; |
|
182 }; |
|
183 |
|
184 |
|
185 QT_END_NAMESPACE |