author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 29 | b72c6db6890b |
child 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the qmake application 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 "symmake.h" |
|
43 |
||
44 |
#include <qstring.h> |
|
45 |
#include <qhash.h> |
|
46 |
#include <qstringlist.h> |
|
47 |
#include <qdir.h> |
|
48 |
#include <qdatetime.h> |
|
49 |
#include <stdlib.h> |
|
50 |
#include <qdebug.h> |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
51 |
#include <QSettings> |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
52 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
53 |
// Included from tools/shared |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
54 |
#include <symbian/epocroot.h> |
0 | 55 |
|
56 |
#define RESOURCE_DIRECTORY_MMP "/resource/apps" |
|
57 |
#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" |
|
58 |
#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
59 |
#define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonu.def" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
60 |
#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) |
0 | 61 |
|
62 |
#define BLD_INF_RULES_BASE "BLD_INF_RULES." |
|
63 |
#define BLD_INF_TAG_PLATFORMS "prj_platforms" |
|
64 |
#define BLD_INF_TAG_MMPFILES "prj_mmpfiles" |
|
65 |
#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" |
|
66 |
#define BLD_INF_TAG_EXTENSIONS "prj_extensions" |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
67 |
#define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions" |
0 | 68 |
|
69 |
#define MMP_TARGET "TARGET" |
|
70 |
#define MMP_TARGETTYPE "TARGETTYPE" |
|
71 |
#define MMP_SECUREID "SECUREID" |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
72 |
#define MMP_OPTION "OPTION" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
73 |
#define MMP_LINKEROPTION "LINKEROPTION" |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
#define MMP_CAPABILITY "CAPABILITY" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
#define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
#define MMP_EPOCSTACKSIZE "EPOCSTACKSIZE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
#define MMP_UID "UID" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
#define MMP_VENDORID "VENDORID" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
#define MMP_VERSION "VERSION" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
#define MMP_START_RESOURCE "START RESOURCE" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
#define MMP_END_RESOURCE "END" |
0 | 83 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
84 |
#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
85 |
#define VAR_CFLAGS "QMAKE_CFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
86 |
#define VAR_LFLAGS "QMAKE_LFLAGS" |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
87 |
|
0 | 88 |
QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) |
89 |
{ |
|
90 |
static QString epocRootStr; |
|
91 |
if (epocRootStr.isEmpty()) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
92 |
epocRootStr = epocRoot(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
93 |
QFileInfo efi(epocRootStr); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
94 |
if (!efi.exists() || epocRootStr.isEmpty()) { |
0 | 95 |
fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); |
96 |
epocRootStr = "/"; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
97 |
} else { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
98 |
epocRootStr = efi.absoluteFilePath(); |
0 | 99 |
} |
100 |
if (!epocRootStr.endsWith("/")) |
|
101 |
epocRootStr += "/"; |
|
102 |
||
103 |
epocRootStr += "epoc32/"; |
|
104 |
} |
|
105 |
||
106 |
QString resultPath = origPath; |
|
107 |
||
108 |
// Make it relative, unless it starts with "%epocroot%/epoc32/" |
|
109 |
if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { |
|
110 |
resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); |
|
111 |
} else { |
|
112 |
resultPath = parentDir.relativeFilePath(resultPath); |
|
113 |
} |
|
114 |
resultPath = QDir::cleanPath(resultPath); |
|
115 |
||
116 |
if (resultPath.isEmpty()) |
|
117 |
resultPath = "."; |
|
118 |
||
119 |
return resultPath; |
|
120 |
} |
|
121 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
122 |
QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) |
0 | 123 |
{ |
124 |
// Prepend epocroot to any paths beginning with "/epoc32/" |
|
125 |
QString resultPath = QDir::fromNativeSeparators(origPath); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
126 |
if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) |
0 | 127 |
resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); |
128 |
||
129 |
QFileInfo fi(fileInfo(resultPath)); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
130 |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
131 |
// Since origPath can be something given in HEADERS, we need to check if we are dealing |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
132 |
// with a file or a directory. In case the origPath doesn't yet exist, isFile() returns |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
133 |
// false and we default to assuming it is a dir. |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
134 |
if (fi.isFile()) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
135 |
resultPath = fi.absolutePath(); |
0 | 136 |
} else { |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
137 |
resultPath = fi.absoluteFilePath(); |
0 | 138 |
} |
139 |
||
140 |
resultPath = QDir::cleanPath(resultPath); |
|
141 |
||
142 |
return resultPath; |
|
143 |
} |
|
144 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
145 |
SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator(), SymbianCommonGenerator(this) { } |
0 | 146 |
SymbianMakefileGenerator::~SymbianMakefileGenerator() { } |
147 |
||
148 |
void SymbianMakefileGenerator::writeHeader(QTextStream &t) |
|
149 |
{ |
|
150 |
t << "// ============================================================================" << endl; |
|
151 |
t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; |
0 | 153 |
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
154 |
t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
155 |
t << "// * user." << endl; |
|
156 |
t << "// * Project: " << fileFixify(project->projectFile()) << endl; |
|
157 |
t << "// * Template: " << var("TEMPLATE") << endl; |
|
158 |
t << "// ============================================================================" << endl; |
|
159 |
t << endl; |
|
160 |
||
161 |
// Defining define for bld.inf |
|
162 |
||
163 |
QString shortProFilename = project->projectFile(); |
|
164 |
shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
165 |
shortProFilename.replace(Option::pro_ext, QString("")); |
|
166 |
||
167 |
QString bldinfDefine = shortProFilename; |
|
168 |
bldinfDefine.append("_"); |
|
169 |
bldinfDefine.append(generate_uid(project->projectFile())); |
|
170 |
||
171 |
bldinfDefine.prepend("BLD_INF_"); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
172 |
removeEpocSpecialCharacters(bldinfDefine); |
0 | 173 |
|
174 |
t << "#define " << bldinfDefine.toUpper() << endl << endl; |
|
175 |
} |
|
176 |
||
177 |
bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) |
|
178 |
{ |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
179 |
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
180 |
fprintf(stderr, "Project files not generated because all requirements are not met:\n\t%s\n", |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
181 |
qPrintable(var("QMAKE_FAILED_REQUIREMENTS"))); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
182 |
return false; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
183 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
184 |
|
0 | 185 |
writeHeader(t); |
186 |
||
187 |
QString numberOfIcons; |
|
188 |
QString iconFile; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
189 |
QMap<QString, QStringList> userRssRules; |
0 | 190 |
readRssRules(numberOfIcons, iconFile, userRssRules); |
191 |
||
192 |
// Get the application translations and convert to symbian OS lang code, i.e. decical number |
|
193 |
QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); |
|
194 |
||
195 |
// Generate pkg files if there are any actual files to deploy |
|
196 |
bool generatePkg = false; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
197 |
|
0 | 198 |
if (targetType == TypeExe) { |
199 |
generatePkg = true; |
|
200 |
} else { |
|
201 |
foreach(QString item, project->values("DEPLOYMENT")) { |
|
202 |
if (!project->values(item + ".sources").isEmpty()) { |
|
203 |
generatePkg = true; |
|
204 |
break; |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
||
209 |
if (generatePkg) { |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
210 |
generatePkgFile(iconFile, true); |
0 | 211 |
} |
212 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
213 |
writeBldInfContent(t, generatePkg, iconFile); |
0 | 214 |
|
215 |
// Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, |
|
216 |
// but all required data is not yet available. |
|
217 |
bool isPrimaryMakefile = true; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
218 |
QString wrapperFileName = Option::output_dir + QLatin1Char('/') + QLatin1String("Makefile"); |
0 | 219 |
QString outputFileName = fileInfo(Option::output.fileName()).fileName(); |
220 |
if (outputFileName != BLD_INF_FILENAME) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
221 |
wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
222 |
? outputFileName.mid(sizeof(BLD_INF_FILENAME)) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
223 |
: outputFileName); |
0 | 224 |
isPrimaryMakefile = false; |
225 |
} |
|
226 |
||
227 |
QFile wrapperMakefile(wrapperFileName); |
|
228 |
if (wrapperMakefile.open(QIODevice::WriteOnly)) { |
|
229 |
generatedFiles << wrapperFileName; |
|
230 |
if (Option::mkfile::listgen) { |
|
231 |
generatePrint(fileInfo(wrapperMakefile.fileName()).absoluteFilePath()); |
|
232 |
} |
|
233 |
||
234 |
} else { |
|
235 |
PRINT_FILE_CREATE_ERROR(wrapperFileName); |
|
236 |
return false; |
|
237 |
} |
|
238 |
||
239 |
if (targetType == TypeSubdirs) { |
|
240 |
// If we have something to deploy, generate extension makefile for just that, since |
|
241 |
// normal extension makefile is not getting generated and we need emulator deployment to be done. |
|
242 |
if (generatePkg) |
|
243 |
writeMkFile(wrapperFileName, true); |
|
244 |
writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
245 |
return true; |
|
246 |
} |
|
247 |
||
248 |
writeMkFile(wrapperFileName, false); |
|
249 |
||
250 |
QString shortProFilename = project->projectFile(); |
|
251 |
shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
252 |
shortProFilename.replace(Option::pro_ext, QString("")); |
|
253 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
254 |
QString mmpFilename = Option::output_dir + QLatin1Char('/') + shortProFilename + QLatin1Char('_') |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
255 |
+ uid3 + Option::mmp_ext; |
0 | 256 |
writeMmpFile(mmpFilename, symbianLangCodes); |
257 |
||
258 |
if (targetType == TypeExe) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
259 |
if (!project->isActiveConfig("no_icon")) { |
0 | 260 |
writeRegRssFile(userRssRules); |
261 |
writeRssFile(numberOfIcons, iconFile); |
|
262 |
writeLocFile(symbianLangCodes); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
263 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
264 |
writeSymbianLocFile(symbianLangCodes); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
265 |
|
0 | 266 |
} |
267 |
} |
|
268 |
||
269 |
writeCustomDefFile(); |
|
270 |
writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
271 |
||
272 |
return true; |
|
273 |
} |
|
274 |
||
275 |
void SymbianMakefileGenerator::writeCustomDefFile() |
|
276 |
{ |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
277 |
if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { |
0 | 278 |
// Create custom def file for plugin |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
279 |
QFile ft(Option::output_dir + QLatin1Char('/') + QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); |
0 | 280 |
|
281 |
if (ft.open(QIODevice::WriteOnly)) { |
|
282 |
if (Option::mkfile::listgen) { |
|
283 |
generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
284 |
} |
|
285 |
generatedFiles << ft.fileName(); |
|
286 |
QTextStream t(&ft); |
|
287 |
||
288 |
t << "; ==============================================================================" << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
289 |
t << "; Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; |
0 | 290 |
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
291 |
t << "; This file is generated by qmake and should not be modified by the" << endl; |
|
292 |
t << "; user." << endl; |
|
293 |
t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl; |
|
294 |
t << "; Part of : " << project->values("TARGET").join(" ") << endl; |
|
295 |
t << "; Description : Fixes common plugin symbols to known ordinals" << endl; |
|
296 |
t << "; Version : " << endl; |
|
297 |
t << ";" << endl; |
|
298 |
t << "; ==============================================================================" << "\n" << endl; |
|
299 |
||
300 |
t << endl; |
|
301 |
||
302 |
t << "EXPORTS" << endl; |
|
303 |
t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl; |
|
304 |
t << "\tqt_plugin_instance @ 2 NONAME" << endl; |
|
305 |
t << endl; |
|
306 |
} else { |
|
307 |
PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) |
|
308 |
} |
|
309 |
} |
|
310 |
} |
|
311 |
||
312 |
void SymbianMakefileGenerator::init() |
|
313 |
{ |
|
314 |
MakefileGenerator::init(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
315 |
SymbianCommonGenerator::init(); |
0 | 316 |
|
317 |
if (0 != project->values("QMAKE_PLATFORM").size()) |
|
318 |
platform = varGlue("QMAKE_PLATFORM", "", " ", ""); |
|
319 |
||
320 |
if (0 == project->values("QMAKESPEC").size()) |
|
321 |
project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); |
|
322 |
||
323 |
project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); |
|
324 |
project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); |
|
325 |
||
326 |
// bld.inf |
|
327 |
project->values("MAKEFILE") += BLD_INF_FILENAME; |
|
328 |
||
329 |
// .mmp |
|
330 |
initMmpVariables(); |
|
331 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
332 |
uid2 = project->first("TARGET.UID2"); |
0 | 333 |
|
334 |
uid2 = uid2.trimmed(); |
|
335 |
} |
|
336 |
||
337 |
QString SymbianMakefileGenerator::getTargetExtension() |
|
338 |
{ |
|
339 |
QString ret; |
|
340 |
if (targetType == TypeExe) { |
|
341 |
ret.append("exe"); |
|
342 |
} else if (targetType == TypeLib) { |
|
343 |
ret.append("lib"); |
|
344 |
} else if (targetType == TypeDll || targetType == TypePlugin) { |
|
345 |
ret.append("dll"); |
|
346 |
} else if (targetType == TypeSubdirs) { |
|
347 |
// Not actually usable, so return empty |
|
348 |
} else { |
|
349 |
// If nothing else set, default to exe |
|
350 |
ret.append("exe"); |
|
351 |
} |
|
352 |
||
353 |
return ret; |
|
354 |
} |
|
355 |
||
356 |
QString SymbianMakefileGenerator::generateUID3() |
|
357 |
{ |
|
358 |
QString target = project->first("TARGET"); |
|
359 |
QString currPath = qmake_getpwd(); |
|
360 |
target.prepend("/").prepend(currPath); |
|
361 |
return generate_test_uid(target); |
|
362 |
} |
|
363 |
||
364 |
void SymbianMakefileGenerator::initMmpVariables() |
|
365 |
{ |
|
366 |
QStringList sysincspaths; |
|
367 |
QStringList srcincpaths; |
|
368 |
QStringList srcpaths; |
|
369 |
||
370 |
srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); |
|
371 |
srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); |
|
372 |
srcpaths << project->values("UI_DIR"); |
|
373 |
||
374 |
QDir current = QDir::current(); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
375 |
QString absolutizedCurrent = absolutizePath("."); |
0 | 376 |
|
377 |
for (int j = 0; j < srcpaths.size(); ++j) { |
|
378 |
QFileInfo fi(fileInfo(srcpaths.at(j))); |
|
379 |
// Sometimes sources have other than *.c* files (e.g. *.moc); prune them. |
|
380 |
if (fi.suffix().startsWith("c")) { |
|
381 |
if (fi.filePath().length() > fi.fileName().length()) { |
|
382 |
appendIfnotExist(srcincpaths, fi.path()); |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
383 |
sources[absolutizePath(fi.path())] += fi.fileName(); |
0 | 384 |
} else { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
385 |
sources[absolutizedCurrent] += fi.fileName(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
386 |
appendIfnotExist(srcincpaths, absolutizedCurrent); |
0 | 387 |
} |
388 |
} |
|
389 |
} |
|
390 |
||
391 |
QStringList incpaths; |
|
392 |
incpaths << project->values("INCLUDEPATH"); |
|
393 |
incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); |
|
394 |
incpaths << project->values("HEADERS"); |
|
395 |
incpaths << srcincpaths; |
|
396 |
incpaths << project->values("UI_HEADERS_DIR"); |
|
397 |
incpaths << project->values("UI_DIR"); |
|
398 |
||
399 |
for (int j = 0; j < incpaths.size(); ++j) { |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
400 |
QString includepath = absolutizePath(incpaths.at(j)); |
0 | 401 |
appendIfnotExist(sysincspaths, includepath); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
402 |
appendAbldTempDirs(sysincspaths, includepath); |
0 | 403 |
} |
404 |
||
405 |
// Remove duplicate include path entries |
|
406 |
QStringList temporary; |
|
407 |
for (int i = 0; i < sysincspaths.size(); ++i) { |
|
408 |
QString origPath = sysincspaths.at(i); |
|
409 |
QFileInfo origPathInfo(fileInfo(origPath)); |
|
410 |
bool bFound = false; |
|
411 |
||
412 |
for (int j = 0; j < temporary.size(); ++j) { |
|
413 |
QString tmpPath = temporary.at(j); |
|
414 |
QFileInfo tmpPathInfo(fileInfo(tmpPath)); |
|
415 |
||
416 |
if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { |
|
417 |
bFound = true; |
|
418 |
if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { |
|
419 |
// We keep the relative notation |
|
420 |
temporary.removeOne(tmpPath); |
|
421 |
temporary << origPath; |
|
422 |
} |
|
423 |
} |
|
424 |
} |
|
425 |
||
426 |
if (!bFound) |
|
427 |
temporary << origPath; |
|
428 |
||
429 |
} |
|
430 |
||
431 |
sysincspaths.clear(); |
|
432 |
sysincspaths << temporary; |
|
433 |
||
434 |
systeminclude.insert("SYSTEMINCLUDE", sysincspaths); |
|
435 |
||
436 |
// Check MMP_RULES for singleton keywords that are overridden |
|
437 |
QStringList overridableMmpKeywords; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
438 |
QStringList restrictableMmpKeywords; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
QStringList restrictedMmpKeywords; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
bool inResourceBlock = false; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
442 |
overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
444 |
<< QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
445 |
<< QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
446 |
<< QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
447 |
<< QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); |
0 | 448 |
|
449 |
foreach (QString item, project->values("MMP_RULES")) { |
|
450 |
if (project->values(item).isEmpty()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
451 |
handleMmpRulesOverrides(item, inResourceBlock, restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
restrictableMmpKeywords, overridableMmpKeywords); |
0 | 453 |
} else { |
454 |
foreach (QString itemRow, project->values(item)) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
handleMmpRulesOverrides(itemRow, inResourceBlock, restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
456 |
restrictableMmpKeywords, overridableMmpKeywords); |
0 | 457 |
} |
458 |
} |
|
459 |
} |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
461 |
if (restrictedMmpKeywords.size()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
462 |
fprintf(stderr, "Warning: Restricted statements detected in MMP_RULES:\n" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
" (%s)\n" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
" Use corresponding qmake variable(s) instead.\n", |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
qPrintable(restrictedMmpKeywords.join(", "))); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
void SymbianMakefileGenerator::handleMmpRulesOverrides(QString &checkString, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
bool &inResourceBlock, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
QStringList &restrictedMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
472 |
const QStringList &restrictableMmpKeywords, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
473 |
const QStringList &overridableMmpKeywords) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
474 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
475 |
QString simplifiedString = checkString.simplified(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
476 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
477 |
if (!inResourceBlock && simplifiedString.startsWith(MMP_START_RESOURCE, Qt::CaseInsensitive)) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
478 |
inResourceBlock = true; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
else if (inResourceBlock && simplifiedString.startsWith(MMP_END_RESOURCE, Qt::CaseInsensitive)) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
inResourceBlock = false; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
481 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
482 |
// Allow restricted and overridable items in RESOURCE blocks as those do not actually |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
483 |
// override anything. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
if (!inResourceBlock) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
485 |
appendKeywordIfMatchFound(overriddenMmpKeywords, overridableMmpKeywords, simplifiedString); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
486 |
appendKeywordIfMatchFound(restrictedMmpKeywords, restrictableMmpKeywords, simplifiedString); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
488 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
489 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
void SymbianMakefileGenerator::appendKeywordIfMatchFound(QStringList &list, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
491 |
const QStringList &keywordList, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
492 |
QString &checkString) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
493 |
{ |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
// Check if checkString starts with any supplied keyword and |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
495 |
// add the found keyword to list if it does. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
496 |
foreach (QString item, keywordList) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
497 |
if (checkString.startsWith(QString(item).append(" "), Qt::CaseInsensitive) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
|| checkString.compare(item, Qt::CaseInsensitive) == 0) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
499 |
appendIfnotExist(list, item); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
500 |
} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
} |
0 | 502 |
} |
503 |
||
504 |
||
505 |
bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList) |
|
506 |
{ |
|
507 |
QStringList tmpStringList; |
|
508 |
||
509 |
for (int i = 0; i < stringList.size(); ++i) { |
|
510 |
QString string = stringList.at(i); |
|
511 |
if (tmpStringList.contains(string)) |
|
512 |
continue; |
|
513 |
else |
|
514 |
tmpStringList.append(string); |
|
515 |
} |
|
516 |
||
517 |
stringList.clear(); |
|
518 |
stringList = tmpStringList; |
|
519 |
return true; |
|
520 |
} |
|
521 |
||
522 |
void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) |
|
523 |
{ |
|
524 |
t << "// ==============================================================================" << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
525 |
t << "// Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; |
0 | 526 |
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
527 |
t << "// This file is generated by qmake and should not be modified by the" << endl; |
|
528 |
t << "// user." << endl; |
|
529 |
t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length() - 4, 4))) << Option::mmp_ext << endl; |
|
530 |
t << "// ==============================================================================" << endl << endl; |
|
531 |
} |
|
532 |
||
533 |
void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) |
|
534 |
{ |
|
535 |
QFile ft(filename); |
|
536 |
if (ft.open(QIODevice::WriteOnly)) { |
|
537 |
if (Option::mkfile::listgen) { |
|
538 |
generatePrint(fileInfo(ft.fileName()).absoluteFilePath()); |
|
539 |
} |
|
540 |
||
541 |
generatedFiles << ft.fileName(); |
|
542 |
||
543 |
QTextStream t(&ft); |
|
544 |
||
545 |
writeMmpFileHeader(t); |
|
546 |
||
547 |
writeMmpFileTargetPart(t); |
|
548 |
||
549 |
writeMmpFileResourcePart(t, symbianLangCodes); |
|
550 |
||
551 |
writeMmpFileMacrosPart(t); |
|
552 |
||
553 |
writeMmpFileIncludePart(t); |
|
554 |
||
555 |
QDir current = QDir::current(); |
|
556 |
||
557 |
for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { |
|
558 |
QStringList values = it.value(); |
|
559 |
QString currentSourcePath = it.key(); |
|
560 |
||
561 |
if (values.size()) |
|
562 |
t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; |
|
563 |
||
564 |
for (int i = 0; i < values.size(); ++i) { |
|
565 |
QString sourceFileName = values.at(i); |
|
566 |
t << "SOURCE\t\t" << sourceFileName << endl; |
|
567 |
} |
|
568 |
t << endl; |
|
569 |
} |
|
570 |
t << endl; |
|
571 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
572 |
if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) { |
0 | 573 |
writeMmpFileLibraryPart(t); |
574 |
} |
|
575 |
||
576 |
writeMmpFileCapabilityPart(t); |
|
577 |
||
578 |
writeMmpFileCompilerOptionPart(t); |
|
579 |
||
580 |
writeMmpFileBinaryVersionPart(t); |
|
581 |
||
582 |
writeMmpFileRulesPart(t); |
|
583 |
} else { |
|
584 |
PRINT_FILE_CREATE_ERROR(filename) |
|
585 |
} |
|
586 |
} |
|
587 |
||
588 |
void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) |
|
589 |
{ |
|
590 |
t << endl; |
|
591 |
||
592 |
QStringList &defines = project->values("DEFINES"); |
|
593 |
if (defines.size()) |
|
594 |
t << "// Qt Macros" << endl; |
|
595 |
for (int i = 0; i < defines.size(); ++i) { |
|
596 |
QString def = defines.at(i); |
|
597 |
addMacro(t, def); |
|
598 |
} |
|
599 |
||
600 |
// These are required in order that all methods will be correctly exported e.g from qtestlib |
|
601 |
QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); |
|
602 |
if (exp_defines.size()) |
|
603 |
t << endl << "// Qt Export Defines" << endl; |
|
604 |
for (int i = 0; i < exp_defines.size(); ++i) { |
|
605 |
QString def = exp_defines.at(i); |
|
606 |
addMacro(t, def); |
|
607 |
} |
|
608 |
||
609 |
t << endl; |
|
610 |
} |
|
611 |
||
612 |
void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) |
|
613 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
614 |
t << "MACRO\t\t" << value << endl; |
0 | 615 |
} |
616 |
||
617 |
||
618 |
void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) |
|
619 |
{ |
|
620 |
bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
621 |
bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); |
0 | 622 |
|
623 |
if (targetType == TypeExe) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
624 |
t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; |
0 | 625 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
626 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
627 |
t << MMP_TARGETTYPE "\t\tSTDEXE" << endl; |
0 | 628 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
629 |
t << MMP_TARGETTYPE "\t\tEXE" << endl; |
0 | 630 |
} |
631 |
} else if (targetType == TypeDll || targetType == TypePlugin) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
632 |
t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl; |
0 | 633 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
634 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
635 |
t << MMP_TARGETTYPE "\t\tSTDDLL" << endl; |
0 | 636 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
637 |
t << MMP_TARGETTYPE "\t\tDLL" << endl; |
0 | 638 |
} |
639 |
} else if (targetType == TypeLib) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
640 |
t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl; |
0 | 641 |
if (!skipTargetType) { |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
642 |
if (project->isActiveConfig("stdbinary")) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
643 |
t << MMP_TARGETTYPE "\t\tSTDLIB" << endl; |
0 | 644 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
645 |
t << MMP_TARGETTYPE "\t\tLIB" << endl; |
0 | 646 |
} |
647 |
} else { |
|
648 |
fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); |
|
649 |
} |
|
650 |
||
651 |
t << endl; |
|
652 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
653 |
t << MMP_UID "\t\t" << uid2 << " " << uid3 << endl; |
0 | 654 |
|
655 |
if (0 != project->values("TARGET.SID").size()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
656 |
t << MMP_SECUREID "\t\t" << project->values("TARGET.SID").join(" ") << endl; |
0 | 657 |
} else { |
658 |
if (0 == uid3.size()) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
659 |
t << MMP_SECUREID "\t\t0" << endl; |
0 | 660 |
else |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
661 |
t << MMP_SECUREID "\t\t" << uid3 << endl; |
0 | 662 |
} |
663 |
||
664 |
// default value used from mkspecs is 0 |
|
665 |
if (0 != project->values("TARGET.VID").size()) { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
666 |
t << MMP_VENDORID "\t\t" << project->values("TARGET.VID").join(" ") << endl; |
0 | 667 |
} |
668 |
||
669 |
t << endl; |
|
670 |
||
671 |
if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
673 |
if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
674 |
t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; |
0 | 675 |
if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
t << MMP_EPOCALLOWDLLDATA << endl; |
0 | 677 |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
678 |
if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { |
0 | 679 |
// Use custom def file for Qt plugins |
680 |
t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; |
|
681 |
} |
|
682 |
||
683 |
t << endl; |
|
684 |
} |
|
685 |
||
686 |
||
687 |
/* |
|
688 |
Application registration resource files should be installed to the |
|
689 |
\private\10003a3f\import\apps directory. |
|
690 |
*/ |
|
691 |
void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) |
|
692 |
{ |
|
693 |
if ((targetType == TypeExe) && |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
694 |
!project->isActiveConfig("no_icon")) { |
0 | 695 |
|
696 |
QString locTarget = fixedTarget; |
|
697 |
locTarget.append(".rss"); |
|
698 |
||
699 |
t << "SOURCEPATH\t\t\t. " << endl; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
700 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
701 |
//QTP: org 47 start |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
702 |
/* t << "LANG SC "; // no endl |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
703 |
foreach(QString lang, symbianLangCodes) { |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
704 |
t << lang << " "; // no endl |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
705 |
} |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
706 |
t << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
707 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
708 |
t << "HEADER" << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
709 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
710 |
t << MMP_END_RESOURCE << endl << endl;*/ |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
711 |
//QTP: org 47 end |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
712 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
713 |
//QTP: loc change start |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
714 |
if (!project->values("SYMBIANTRANSLATIONS").isEmpty()) { |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
716 |
t << "LANGUAGE_IDS" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
717 |
t << "HEADER" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
718 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
719 |
t << MMP_END_RESOURCE << endl << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
720 |
} else { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
721 |
t << "LANG SC "; // no endl |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
722 |
foreach(QString lang, symbianLangCodes) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
723 |
t << lang << " "; // no endl |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
724 |
} |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
725 |
t << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
726 |
t << MMP_START_RESOURCE "\t\t" << locTarget << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
727 |
t << "HEADER" << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
728 |
t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
729 |
t << MMP_END_RESOURCE << endl << endl; |
0 | 730 |
} |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
731 |
//QTP: loc change end |
0 | 732 |
QString regTarget = fixedTarget; |
733 |
regTarget.append("_reg.rss"); |
|
734 |
||
735 |
t << "SOURCEPATH\t\t\t." << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
736 |
t << MMP_START_RESOURCE "\t\t" << regTarget << endl; |
0 | 737 |
if (isForSymbianSbsv2()) |
738 |
t << "DEPENDS " << fixedTarget << ".rsg" << endl; |
|
739 |
t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
740 |
t << MMP_END_RESOURCE << endl << endl; |
0 | 741 |
} |
742 |
} |
|
743 |
||
744 |
void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) |
|
745 |
{ |
|
746 |
QDir current = QDir::current(); |
|
747 |
||
748 |
for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
749 |
QStringList values = it.value(); |
|
750 |
for (int i = 0; i < values.size(); ++i) { |
|
751 |
QString handledPath = values.at(i); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
752 |
t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl; |
0 | 753 |
} |
754 |
} |
|
755 |
||
756 |
t << endl; |
|
757 |
} |
|
758 |
||
759 |
void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) |
|
760 |
{ |
|
761 |
writeMmpFileSystemIncludePart(t); |
|
762 |
} |
|
763 |
||
764 |
void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) |
|
765 |
{ |
|
766 |
QStringList &libs = project->values("LIBS"); |
|
767 |
libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE"); |
|
768 |
||
769 |
removeDuplicatedStrings(libs); |
|
770 |
||
771 |
for (int i = 0; i < libs.size(); ++i) { |
|
772 |
QString lib = libs.at(i); |
|
773 |
// The -L flag is uninteresting, since all symbian libraries exist in the same directory. |
|
774 |
if (lib.startsWith("-l")) { |
|
775 |
lib.remove(0, 2); |
|
776 |
QString mmpStatement; |
|
777 |
if (lib.endsWith(".dll")) { |
|
778 |
lib.chop(4); |
|
779 |
mmpStatement = "LIBRARY\t\t"; |
|
780 |
} else if (lib.endsWith(".lib")) { |
|
781 |
lib.chop(4); |
|
782 |
mmpStatement = "STATICLIBRARY\t"; |
|
783 |
} else { |
|
784 |
// Hacky way to find out what kind of library it is. Check the |
|
785 |
// ARMV5 build directory for library type. We default to shared |
|
786 |
// library, since that is more common. |
|
787 |
QString udebStaticLibLocation(epocRoot()); |
|
788 |
QString urelStaticLibLocation(udebStaticLibLocation); |
|
789 |
udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); |
|
790 |
urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); |
|
791 |
if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) { |
|
792 |
mmpStatement = "STATICLIBRARY\t"; |
|
793 |
} else { |
|
794 |
mmpStatement = "LIBRARY\t\t"; |
|
795 |
} |
|
796 |
} |
|
797 |
t << mmpStatement << lib << ".lib" << endl; |
|
798 |
} |
|
799 |
} |
|
800 |
||
801 |
t << endl; |
|
802 |
} |
|
803 |
||
804 |
void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) |
|
805 |
{ |
|
806 |
if (0 != project->first("TARGET.CAPABILITY").size()) { |
|
807 |
QStringList &capabilities = project->values("TARGET.CAPABILITY"); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
808 |
t << MMP_CAPABILITY "\t\t"; |
0 | 809 |
|
810 |
for (int i = 0; i < capabilities.size(); ++i) { |
|
811 |
QString cap = capabilities.at(i); |
|
812 |
t << cap << " "; |
|
813 |
} |
|
814 |
} else { |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
815 |
t << MMP_CAPABILITY "\t\tNone"; |
0 | 816 |
} |
817 |
t << endl << endl; |
|
818 |
} |
|
819 |
||
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
820 |
void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
821 |
const QString &optionType, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
822 |
const QString &optionTag, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
823 |
const QString &variableBase) |
0 | 824 |
{ |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
825 |
foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
826 |
QStringList currentValues = project->values(variableBase + "." + compilerVersion); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
827 |
if (currentValues.size()) { |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
828 |
t << "#if defined(" << compilerVersion << ")" << endl; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
829 |
t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
830 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
831 |
} |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
832 |
} |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
833 |
} |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
834 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
835 |
void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
836 |
const QString &optionType, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
837 |
const QString &optionTag, |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
838 |
const QString &options) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
839 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
840 |
QString trimmedOptions = options.trimmed(); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
841 |
if (!trimmedOptions.isEmpty()) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
842 |
t << optionType << " " << optionTag << " " << trimmedOptions << endl; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
843 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
844 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
845 |
void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
846 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
847 |
if (list.size()) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
848 |
options.append(list.join(" ")); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
849 |
options.append(" "); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
850 |
} |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
851 |
} |
0 | 852 |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
853 |
void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
854 |
{ |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
855 |
QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
856 |
QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
857 |
QStringList commonCFlags = project->values(VAR_CFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
858 |
QStringList commonLFlags = project->values(VAR_LFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
859 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
860 |
foreach(QString item, keywords) { |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
861 |
QString compilerOption; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
862 |
QString linkerOption; |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
863 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
864 |
appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
865 |
appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
866 |
appendMmpFileOptions(compilerOption, commonCxxFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
867 |
appendMmpFileOptions(compilerOption, commonCFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
868 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
869 |
appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
870 |
appendMmpFileOptions(linkerOption, commonLFlags); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
871 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
872 |
writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
873 |
writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
874 |
|
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
875 |
writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
876 |
writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); |
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
877 |
} |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
878 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
t << endl; |
0 | 880 |
} |
881 |
||
882 |
void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) |
|
883 |
{ |
|
884 |
QString applicationVersion = project->first("VERSION"); |
|
885 |
QStringList verNumList = applicationVersion.split('.'); |
|
886 |
uint major = 0; |
|
887 |
uint minor = 0; |
|
888 |
uint patch = 0; |
|
889 |
bool success = false; |
|
890 |
||
891 |
if (verNumList.size() > 0) { |
|
892 |
major = verNumList[0].toUInt(&success); |
|
893 |
if (success && verNumList.size() > 1) { |
|
894 |
minor = verNumList[1].toUInt(&success); |
|
895 |
if (success && verNumList.size() > 2) { |
|
896 |
patch = verNumList[2].toUInt(&success); |
|
897 |
} |
|
898 |
} |
|
899 |
} |
|
900 |
||
901 |
QString mmpVersion; |
|
902 |
if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { |
|
903 |
// Symbian binary version only has major and minor components, so compress |
|
904 |
// Qt's minor and patch values into the minor component. Since Symbian's minor |
|
905 |
// component is a 16 bit value, only allow 8 bits for each to avoid overflow. |
|
906 |
mmpVersion.append(QString::number(major)) |
|
907 |
.append('.') |
|
908 |
.append(QString::number((minor << 8) + patch)); |
|
909 |
} else { |
|
910 |
if (!applicationVersion.isEmpty()) |
|
911 |
fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); |
|
912 |
mmpVersion = "10.0"; // Default binary version for symbian is 10.0 |
|
913 |
} |
|
914 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
915 |
t << MMP_VERSION " " << mmpVersion << endl; |
0 | 916 |
} |
917 |
||
918 |
void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) |
|
919 |
{ |
|
920 |
foreach(QString item, project->values("MMP_RULES")) { |
|
921 |
t << endl; |
|
922 |
// If there is no stringlist defined for a rule, use rule name directly |
|
923 |
// This is convenience for defining single line mmp statements |
|
924 |
if (project->values(item).isEmpty()) { |
|
925 |
t << item << endl; |
|
926 |
} else { |
|
927 |
foreach(QString itemRow, project->values(item)) { |
|
928 |
t << itemRow << endl; |
|
929 |
} |
|
930 |
} |
|
931 |
} |
|
932 |
} |
|
933 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
934 |
void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension, const QString &iconFile) |
0 | 935 |
{ |
936 |
// Read user defined bld inf rules |
|
937 |
||
938 |
QMap<QString, QStringList> userBldInfRules; |
|
939 |
for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
940 |
if (it.key().startsWith(BLD_INF_RULES_BASE)) { |
|
941 |
QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1); |
|
942 |
if (newKey.isEmpty()) { |
|
943 |
fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); |
|
944 |
continue; |
|
945 |
} |
|
946 |
QStringList newValues; |
|
947 |
QStringList values = it.value(); |
|
948 |
foreach(QString item, values) { |
|
949 |
// If there is no stringlist defined for a rule, use rule name directly |
|
950 |
// This is convenience for defining single line statements |
|
951 |
if (project->values(item).isEmpty()) { |
|
952 |
newValues << item; |
|
953 |
} else { |
|
954 |
foreach(QString itemRow, project->values(item)) { |
|
955 |
newValues << itemRow; |
|
956 |
} |
|
957 |
} |
|
958 |
} |
|
959 |
userBldInfRules.insert(newKey, newValues); |
|
960 |
} |
|
961 |
} |
|
962 |
||
963 |
// Add includes of subdirs bld.inf files |
|
964 |
||
965 |
QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); |
|
966 |
mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext); |
|
967 |
QString currentPath = qmake_getpwd(); |
|
968 |
QDir directory(currentPath); |
|
969 |
||
970 |
const QStringList &subdirs = project->values("SUBDIRS"); |
|
971 |
foreach(QString item, subdirs) { |
|
972 |
QString fixedItem; |
|
973 |
if (!project->isEmpty(item + ".file")) { |
|
974 |
fixedItem = project->first(item + ".file"); |
|
975 |
} else if (!project->isEmpty(item + ".subdir")) { |
|
976 |
fixedItem = project->first(item + ".subdir"); |
|
977 |
} else { |
|
978 |
fixedItem = item; |
|
979 |
} |
|
980 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
981 |
QString condition; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
982 |
if (!project->isEmpty(item + ".condition")) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
983 |
condition = project->first(item + ".condition"); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
984 |
|
0 | 985 |
QFileInfo subdir(fileInfo(fixedItem)); |
986 |
QString relativePath = directory.relativeFilePath(fixedItem); |
|
987 |
QString subdirFileName = subdir.completeBaseName(); |
|
988 |
QString fullProName = subdir.absoluteFilePath();; |
|
989 |
QString bldinfFilename; |
|
990 |
||
991 |
if (subdir.isDir()) { |
|
992 |
// Subdir is a regular project |
|
993 |
bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME); |
|
994 |
fullProName += QString("/") + subdirFileName + Option::pro_ext; |
|
995 |
} else { |
|
996 |
// Subdir is actually a .pro file |
|
997 |
if (relativePath.contains("/")) { |
|
998 |
// .pro not in same directory as parent .pro |
|
999 |
relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length()); |
|
1000 |
bldinfFilename = relativePath; |
|
1001 |
} else { |
|
1002 |
// .pro and parent .pro in same directory |
|
1003 |
bldinfFilename = QString("./"); |
|
1004 |
} |
|
1005 |
bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName; |
|
1006 |
} |
|
1007 |
||
1008 |
QString uid = generate_uid(fullProName); |
|
1009 |
QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; |
|
1010 |
bldinfDefine = bldinfDefine.toUpper(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1011 |
removeEpocSpecialCharacters(bldinfDefine); |
0 | 1012 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1013 |
if (!condition.isEmpty()) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1014 |
t << "#if defined(" << condition << ")" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1015 |
|
0 | 1016 |
t << "#ifndef " << bldinfDefine << endl; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1017 |
t << "\t#include \"" << bldinfFilename << "\"" << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1018 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1019 |
|
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1020 |
if (!condition.isEmpty()) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1021 |
t << "#endif" << endl; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1022 |
|
0 | 1023 |
} |
1024 |
||
1025 |
// Add supported project platforms |
|
1026 |
||
1027 |
t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; |
|
1028 |
if (0 != project->values("SYMBIAN_PLATFORMS").size()) |
|
1029 |
t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; |
|
1030 |
||
1031 |
QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); |
|
1032 |
foreach(QString item, userItems) |
|
1033 |
t << item << endl; |
|
1034 |
userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); |
|
1035 |
t << endl; |
|
1036 |
||
1037 |
// Add project mmps and old style extension makefiles |
|
1038 |
||
1039 |
QString mmpTag; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1040 |
if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) |
0 | 1041 |
mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); |
1042 |
else |
|
1043 |
mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); |
|
1044 |
||
1045 |
t << endl << mmpTag << endl << endl; |
|
1046 |
||
1047 |
writeBldInfMkFilePart(t, addDeploymentExtension); |
|
1048 |
if (targetType != TypeSubdirs) { |
|
1049 |
QString shortProFilename = project->projectFile(); |
|
1050 |
shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
1051 |
shortProFilename.replace(Option::pro_ext, QString("")); |
|
1052 |
||
1053 |
QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext; |
|
1054 |
||
1055 |
t << mmpFilename << endl; |
|
1056 |
} |
|
1057 |
||
1058 |
userItems = userBldInfRules.value(mmpTag); |
|
1059 |
foreach(QString item, userItems) |
|
1060 |
t << item << endl; |
|
1061 |
userBldInfRules.remove(mmpTag); |
|
1062 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1063 |
QString extensionTag; |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1064 |
if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1065 |
extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1066 |
else |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1067 |
extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1068 |
|
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1069 |
t << endl << extensionTag << endl << endl; |
0 | 1070 |
|
1071 |
// Generate extension rules |
|
1072 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1073 |
writeBldInfExtensionRulesPart(t, iconFile); |
0 | 1074 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1075 |
userItems = userBldInfRules.value(extensionTag); |
0 | 1076 |
foreach(QString item, userItems) |
1077 |
t << item << endl; |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1078 |
userBldInfRules.remove(extensionTag); |
0 | 1079 |
|
1080 |
// Add rest of the user defined content |
|
1081 |
||
1082 |
for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { |
|
1083 |
t << endl << endl << it.key() << endl << endl; |
|
1084 |
userItems = it.value(); |
|
1085 |
foreach(QString item, userItems) |
|
1086 |
t << item << endl; |
|
1087 |
} |
|
1088 |
} |
|
1089 |
||
1090 |
void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) |
|
1091 |
{ |
|
1092 |
if (!list.contains(value)) |
|
1093 |
list += value; |
|
1094 |
} |
|
1095 |
||
1096 |
void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) |
|
1097 |
{ |
|
1098 |
foreach(QString item, values) |
|
1099 |
appendIfnotExist(list, item); |
|
1100 |
} |
|
1101 |
||
1102 |
||
1103 |
QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) |
|
1104 |
{ |
|
1105 |
QString ret = file; |
|
1106 |
if (ret.endsWith(QDir::separator())) { |
|
1107 |
ret.remove(ret.length() - 1, 1); |
|
1108 |
} |
|
1109 |
||
1110 |
return ret; |
|
1111 |
} |
|
1112 |
||
1113 |
void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, |
|
1114 |
const QStringList& toClean, |
|
1115 |
const QString& cmd, |
|
1116 |
const QString& cmdOptions, |
|
1117 |
const QString& itemPrefix, |
|
1118 |
const QString& itemSuffix) |
|
1119 |
{ |
|
1120 |
for (int i = 0; i < toClean.size(); ++i) { |
|
1121 |
QString item = toClean.at(i); |
|
1122 |
item.prepend(itemPrefix).append(itemSuffix); |
|
1123 |
#if defined(Q_OS_WIN) |
|
1124 |
t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; |
|
1125 |
t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; |
|
1126 |
#else |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
1127 |
t << "\t-if test -e " << QDir::toNativeSeparators(item) << "; then "; |
0 | 1128 |
t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; |
1129 |
#endif |
|
1130 |
} |
|
1131 |
} |
|
1132 |
||
1133 |
void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) |
|
1134 |
{ |
|
1135 |
t << "dodistclean:" << endl; |
|
1136 |
const QStringList &subdirs = project->values("SUBDIRS"); |
|
1137 |
foreach(QString item, subdirs) { |
|
1138 |
bool fromFile = false; |
|
1139 |
QString fixedItem; |
|
1140 |
if (!project->isEmpty(item + ".file")) { |
|
1141 |
fixedItem = project->first(item + ".file"); |
|
1142 |
fromFile = true; |
|
1143 |
} else if (!project->isEmpty(item + ".subdir")) { |
|
1144 |
fixedItem = project->first(item + ".subdir"); |
|
1145 |
fromFile = false; |
|
1146 |
} else { |
|
1147 |
fromFile = item.endsWith(Option::pro_ext); |
|
1148 |
fixedItem = item; |
|
1149 |
} |
|
1150 |
QFileInfo fi(fileInfo(fixedItem)); |
|
1151 |
if (!fromFile) { |
|
1152 |
t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; |
|
1153 |
} else { |
|
1154 |
QString itemName = fi.fileName(); |
|
1155 |
int extIndex = itemName.lastIndexOf(Option::pro_ext); |
|
1156 |
if (extIndex) |
|
1157 |
fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0, extIndex); |
|
1158 |
t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; |
|
1159 |
} |
|
1160 |
||
1161 |
} |
|
1162 |
||
1163 |
generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf |
|
1164 |
generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup |
|
1165 |
generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean |
|
1166 |
QStringList fixedFiles; |
|
1167 |
QStringList fixedDirs; |
|
1168 |
foreach(QString item, generatedFiles) { |
|
1169 |
QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1170 |
if (!fixedFiles.contains(fixedItem)) { |
|
1171 |
fixedFiles << fixedItem; |
|
1172 |
} |
|
1173 |
} |
|
1174 |
foreach(QString item, generatedDirs) { |
|
1175 |
QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); |
|
1176 |
if (!fixedDirs.contains(fixedItem)) { |
|
1177 |
fixedDirs << fixedItem; |
|
1178 |
} |
|
1179 |
} |
|
1180 |
generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); |
|
1181 |
generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); |
|
1182 |
t << endl; |
|
1183 |
||
1184 |
t << "distclean: clean dodistclean" << endl; |
|
1185 |
t << endl; |
|
1186 |
} |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1187 |
|
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1188 |
void SymbianMakefileGenerator::generateExecutionTargets(QTextStream& t, const QStringList& platforms) |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1189 |
{ |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1190 |
// create execution targets |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1191 |
if (targetType == TypeExe) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1192 |
if (platforms.contains("winscw")) { |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1193 |
t << "run:" << endl; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1194 |
t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1195 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1196 |
t << "runonphone: sis" << endl; |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1197 |
t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << ".sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1198 |
t << endl; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1199 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1200 |
} |