Changeset 769 for trunk/qmake/generators/symbian/symmake.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/qmake/generators/symbian/symmake.cpp
r651 r769 50 50 #include <qdebug.h> 51 51 52 // Included from tools/shared 53 #include <symbian/epocroot.h> 54 52 55 #define RESOURCE_DIRECTORY_MMP "/resource/apps" 53 56 #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" … … 55 58 #define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" 56 59 #define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" 57 #define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1)58 60 59 61 #define BLD_INF_RULES_BASE "BLD_INF_RULES." … … 62 64 #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" 63 65 #define BLD_INF_TAG_EXTENSIONS "prj_extensions" 64 #define BLD_INF_TAG_ EXPORTS "prj_exports"66 #define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions" 65 67 66 68 #define RSS_RULES "RSS_RULES" … … 68 70 #define RSS_TAG_NBROFICONS "number_of_icons" 69 71 #define RSS_TAG_ICONFILE "icon_file" 72 #define RSS_TAG_HEADER "header" 73 #define RSS_TAG_SERVICE_LIST "service_list" 74 #define RSS_TAG_FILE_OWNERSHIP_LIST "file_ownership_list" 75 #define RSS_TAG_DATATYPE_LIST "datatype_list" 76 #define RSS_TAG_FOOTER "footer" 77 #define RSS_TAG_DEFAULT "default_rules" // Same as just giving rules without tag 70 78 71 79 #define MMP_TARGET "TARGET" 72 80 #define MMP_TARGETTYPE "TARGETTYPE" 73 81 #define MMP_SECUREID "SECUREID" 74 #define MMP_OPTION_CW "OPTION CW" 75 #define MMP_OPTION_ARMCC "OPTION ARMCC" 76 #define MMP_OPTION_GCCE "OPTION GCCE" 77 #define MMP_LINKEROPTION_CW "LINKEROPTION CW" 78 #define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC" 79 #define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE" 82 #define MMP_OPTION "OPTION" 83 #define MMP_LINKEROPTION "LINKEROPTION" 80 84 #define MMP_CAPABILITY "CAPABILITY" 81 85 #define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" … … 88 92 #define MMP_END_RESOURCE "END" 89 93 94 #define VAR_CXXFLAGS "QMAKE_CXXFLAGS" 95 #define VAR_CFLAGS "QMAKE_CFLAGS" 96 #define VAR_LFLAGS "QMAKE_LFLAGS" 97 90 98 #define SIS_TARGET "sis" 91 99 #define INSTALLER_SIS_TARGET "installer_sis" 100 #define ROM_STUB_SIS_TARGET "stub_sis" 92 101 #define OK_SIS_TARGET "ok_sis" 93 102 #define OK_INSTALLER_SIS_TARGET "ok_installer_sis" 103 #define OK_ROM_STUB_SIS_TARGET "ok_stub_sis" 94 104 #define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg" 95 105 #define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache" … … 106 116 static QString epocRootStr; 107 117 if (epocRootStr.isEmpty()) { 108 QFileInfo efi(epocRoot());109 epocRootStr = efi.canonicalFilePath();110 if ( epocRootStr.isEmpty()) {118 epocRootStr = epocRoot(); 119 QFileInfo efi(epocRootStr); 120 if (!efi.exists() || epocRootStr.isEmpty()) { 111 121 fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); 112 122 epocRootStr = "/"; 123 } else { 124 epocRootStr = efi.absoluteFilePath(); 113 125 } 114 126 if (!epocRootStr.endsWith("/")) … … 134 146 } 135 147 136 QString SymbianMakefileGenerator::canonizePath(const QString& origPath) 137 { 138 // Since current path gets appended almost always anyway, use it as default 139 // for nonexisting paths. 140 static QString defaultPath; 141 if (defaultPath.isEmpty()) { 142 QFileInfo fi("."); 143 defaultPath = fi.canonicalFilePath(); 144 } 145 148 QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) 149 { 146 150 // Prepend epocroot to any paths beginning with "/epoc32/" 147 151 QString resultPath = QDir::fromNativeSeparators(origPath); … … 150 154 151 155 QFileInfo fi(fileInfo(resultPath)); 152 if (fi.isDir()) { 153 resultPath = fi.canonicalFilePath(); 156 157 // Since origPath can be something given in HEADERS, we need to check if we are dealing 158 // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns 159 // false and we default to assuming it is a dir. 160 if (fi.isFile()) { 161 resultPath = fi.absolutePath(); 154 162 } else { 155 resultPath = fi. canonicalPath();163 resultPath = fi.absoluteFilePath(); 156 164 } 157 165 158 166 resultPath = QDir::cleanPath(resultPath); 159 160 if (resultPath.isEmpty())161 resultPath = defaultPath;162 167 163 168 return resultPath; … … 202 207 QString numberOfIcons; 203 208 QString iconFile; 204 Q StringListuserRssRules;209 QMap<QString, QStringList> userRssRules; 205 210 readRssRules(numberOfIcons, iconFile, userRssRules); 206 211 … … 235 240 QString outputFileName = fileInfo(Option::output.fileName()).fileName(); 236 241 if (outputFileName != BLD_INF_FILENAME) { 237 wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName); 242 wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME) 243 ? outputFileName.mid(sizeof(BLD_INF_FILENAME)) 244 : outputFileName); 238 245 isPrimaryMakefile = false; 239 246 } … … 269 276 270 277 if (targetType == TypeExe) { 271 if (!project-> values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {278 if (!project->isActiveConfig("no_icon")) { 272 279 writeRegRssFile(userRssRules); 273 280 writeRssFile(numberOfIcons, iconFile); … … 316 323 317 324 // Construct QStringList from pkg_prerules since we need search it before printed to file 325 // Note: Though there can't be more than one language or header line, use stringlists 326 // in case user wants comments to go with the rules. 318 327 QStringList rawPkgPreRules; 328 QStringList languageRules; 329 QStringList headerRules; 319 330 foreach(QString deploymentItem, project->values("DEPLOYMENT")) { 320 331 foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { … … 323 334 // This is convenience for defining single line mmp statements 324 335 if (pkgrulesValue.isEmpty()) { 325 rawPkgPreRules << pkgrulesItem; 336 if (pkgrulesItem.startsWith("&")) 337 languageRules << pkgrulesItem; 338 else if (pkgrulesItem.startsWith("#")) 339 headerRules << pkgrulesItem; 340 else 341 rawPkgPreRules << pkgrulesItem; 326 342 } else { 327 foreach(QString pkgrule, pkgrulesValue) { 328 rawPkgPreRules << pkgrule; 343 if (containsStartWithItem('&', pkgrulesValue)) { 344 foreach(QString pkgrule, pkgrulesValue) { 345 languageRules << pkgrule; 346 } 347 } else if (containsStartWithItem('#', pkgrulesValue)) { 348 foreach(QString pkgrule, pkgrulesValue) { 349 headerRules << pkgrule; 350 } 351 } else { 352 foreach(QString pkgrule, pkgrulesValue) { 353 rawPkgPreRules << pkgrule; 354 } 329 355 } 330 356 } … … 334 360 // Apply some defaults if specific data does not exist in PKG pre-rules 335 361 336 if ( !containsStartWithItem('&', rawPkgPreRules)) {362 if (languageRules.isEmpty()) { 337 363 // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) 338 QString languageCode = "; Language\n&EN\n\n"; 339 t << languageCode; 340 tw << languageCode; 341 } else { 364 languageRules << "; Language\n&EN\n\n"; 365 } else if (headerRules.isEmpty()) { 342 366 // In case user defines langs, he must take care also about SIS header 343 if (!containsStartWithItem('#', rawPkgPreRules)) 344 fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); 345 } 367 fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); 368 } 369 370 t << languageRules.join("\n") << endl; 371 tw << languageRules.join("\n") << endl; 346 372 347 373 // name of application, UID and version … … 358 384 } 359 385 360 if ( !containsStartWithItem('#', rawPkgPreRules)) {386 if (headerRules.isEmpty()) 361 387 t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); 362 } 388 else 389 t << headerRules.join("\n") << endl; 363 390 364 391 // Localized vendor name … … 425 452 426 453 // deploy rsc & reg_rsc file 427 if (!project-> values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {454 if (!project->isActiveConfig("no_icon")) { 428 455 t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") 429 456 .arg(epocRoot()) … … 450 477 QString remoteTestPath; 451 478 remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); 479 QString zDir = epocRoot() + QLatin1String("epoc32/data/z"); 452 480 453 481 initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); … … 455 483 t << "; DEPLOYMENT" << endl; 456 484 for (int i = 0; i < depList.size(); ++i) { 457 t << QString("\"%1\" - \"%2\"") 458 .arg(QString(depList.at(i).from).replace('\\','/')) 459 .arg(depList.at(i).to) << endl; 485 QString from = depList.at(i).from; 486 QString to = depList.at(i).to; 487 488 // Deploy anything not already deployed from under epoc32 instead from under 489 // \epoc32\data\z\ to enable using pkg file without rebuilding 490 // the project, which can be useful for some binary only distributions. 491 if (!from.contains(QLatin1String("epoc32"), Qt::CaseInsensitive)) { 492 from = to; 493 if (from.size() > 1 && from.at(1) == QLatin1Char(':')) 494 from = from.mid(2); 495 from.prepend(zDir); 496 } else { 497 if (from.size() > 1 && from.at(1) == QLatin1Char(':')) 498 from = from.mid(2); 499 } 500 501 t << QString("\"%1\" - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl; 460 502 } 461 503 t << endl; … … 542 584 void SymbianMakefileGenerator::writeCustomDefFile() 543 585 { 544 if (targetType == TypePlugin && !project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {586 if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { 545 587 // Create custom def file for plugin 546 588 QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); … … 607 649 else if ((project->values("TEMPLATE")).contains("lib")) { 608 650 // Check CONFIG to see if we are to build staticlib or dll 609 if (project-> values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static"))651 if (project->isActiveConfig("staticlib") || project->isActiveConfig("static")) 610 652 targetType = TypeLib; 611 else if (project-> values("CONFIG").contains("plugin"))653 else if (project->isActiveConfig("plugin")) 612 654 targetType = TypePlugin; 613 655 else … … 619 661 if (0 != project->values("TARGET.UID2").size()) { 620 662 uid2 = project->first("TARGET.UID2"); 621 } else if (project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {663 } else if (project->isActiveConfig("stdbinary")) { 622 664 uid2 = "0x20004C45"; 623 665 } else { … … 690 732 691 733 QDir current = QDir::current(); 692 QString canonizedCurrent = canonizePath(".");734 QString absolutizedCurrent = absolutizePath("."); 693 735 694 736 for (int j = 0; j < srcpaths.size(); ++j) { … … 698 740 if (fi.filePath().length() > fi.fileName().length()) { 699 741 appendIfnotExist(srcincpaths, fi.path()); 700 sources[ canonizePath(fi.path())] += fi.fileName();742 sources[absolutizePath(fi.path())] += fi.fileName(); 701 743 } else { 702 sources[ canonizedCurrent] += fi.fileName();703 appendIfnotExist(srcincpaths, canonizedCurrent);744 sources[absolutizedCurrent] += fi.fileName(); 745 appendIfnotExist(srcincpaths, absolutizedCurrent); 704 746 } 705 747 } … … 715 757 716 758 for (int j = 0; j < incpaths.size(); ++j) { 717 QString includepath = canonizePath(incpaths.at(j));759 QString includepath = absolutizePath(incpaths.at(j)); 718 760 appendIfnotExist(sysincspaths, includepath); 719 761 appendAbldTempDirs(sysincspaths, includepath); … … 757 799 bool inResourceBlock = false; 758 800 759 overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) ;801 overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); 760 802 restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) 761 << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC) 762 << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW) 763 << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE) 803 << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) 764 804 << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) 765 << QLatin1String(MMP_EPOCHEAPSIZE) << QLatin1String(MMP_EPOCSTACKSIZE) 766 << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) 767 << QLatin1String(MMP_VERSION); 805 << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) 806 << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); 768 807 769 808 foreach (QString item, project->values("MMP_RULES")) { … … 886 925 t << endl; 887 926 888 if (!project-> values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) {927 if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) { 889 928 writeMmpFileLibraryPart(t); 890 929 } … … 935 974 { 936 975 bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); 976 bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); 937 977 938 978 if (targetType == TypeExe) { 939 979 t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; 940 980 if (!skipTargetType) { 941 if (project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))981 if (project->isActiveConfig("stdbinary")) 942 982 t << MMP_TARGETTYPE "\t\tSTDEXE" << endl; 943 983 else … … 947 987 t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl; 948 988 if (!skipTargetType) { 949 if (project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))989 if (project->isActiveConfig("stdbinary")) 950 990 t << MMP_TARGETTYPE "\t\tSTDDLL" << endl; 951 991 else … … 955 995 t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl; 956 996 if (!skipTargetType) { 957 if (project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))997 if (project->isActiveConfig("stdbinary")) 958 998 t << MMP_TARGETTYPE "\t\tSTDLIB" << endl; 959 999 else … … 986 1026 if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) 987 1027 t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; 988 if ( 0 != project->values("TARGET.EPOCHEAPSIZE").size())1028 if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) 989 1029 t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; 990 1030 if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) 991 1031 t << MMP_EPOCALLOWDLLDATA << endl; 992 1032 993 if (targetType == TypePlugin && !project-> values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {1033 if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { 994 1034 // Use custom def file for Qt plugins 995 1035 t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; … … 1007 1047 { 1008 1048 if ((targetType == TypeExe) && 1009 !project-> values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) {1049 !project->isActiveConfig("no_icon")) { 1010 1050 1011 1051 QString locTarget = fixedTarget; … … 1111 1151 } 1112 1152 1153 void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, 1154 const QString &optionType, 1155 const QString &optionTag, 1156 const QString &variableBase) 1157 { 1158 foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { 1159 QStringList currentValues = project->values(variableBase + "." + compilerVersion); 1160 if (currentValues.size()) { 1161 t << "#if defined(" << compilerVersion << ")" << endl; 1162 t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; 1163 t << "#endif" << endl; 1164 } 1165 } 1166 } 1167 1168 void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, 1169 const QString &optionType, 1170 const QString &optionTag, 1171 const QString &options) 1172 { 1173 QString trimmedOptions = options.trimmed(); 1174 if (!trimmedOptions.isEmpty()) 1175 t << optionType << " " << optionTag << " " << trimmedOptions << endl; 1176 } 1177 1178 void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) 1179 { 1180 if (list.size()) { 1181 options.append(list.join(" ")); 1182 options.append(" "); 1183 } 1184 } 1185 1113 1186 void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) 1114 1187 { 1115 QString cw, armcc, gcce; 1116 QString cwlink, armlink, gccelink; 1117 1118 if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { 1119 cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); 1120 cw.append(" "); 1121 } 1122 1123 if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { 1124 armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); 1125 armcc.append(" "); 1126 } 1127 1128 if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) { 1129 gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); 1130 gcce.append(" "); 1131 } 1132 1133 if (0 != project->values("QMAKE_CFLAGS.CW").size()) { 1134 cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); 1135 cw.append(" "); 1136 } 1137 1138 if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { 1139 armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); 1140 armcc.append(" "); 1141 } 1142 1143 if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) { 1144 gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); 1145 gcce.append(" "); 1146 } 1147 1148 if (0 != project->values("QMAKE_CXXFLAGS").size()) { 1149 cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); 1150 cw.append(" "); 1151 armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); 1152 armcc.append(" "); 1153 gcce.append(project->values("QMAKE_CXXFLAGS").join(" ")); 1154 gcce.append(" "); 1155 } 1156 1157 if (0 != project->values("QMAKE_CFLAGS").size()) { 1158 cw.append(project->values("QMAKE_CFLAGS").join(" ")); 1159 cw.append(" "); 1160 armcc.append(project->values("QMAKE_CFLAGS").join(" ")); 1161 armcc.append(" "); 1162 gcce.append(project->values("QMAKE_CFLAGS").join(" ")); 1163 gcce.append(" "); 1164 } 1165 1166 if (0 != project->values("QMAKE_LFLAGS.CW").size()) { 1167 cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" ")); 1168 cwlink.append(" "); 1169 } 1170 1171 if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) { 1172 armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" ")); 1173 armlink.append(" "); 1174 } 1175 1176 if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) { 1177 gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" ")); 1178 gccelink.append(" "); 1179 } 1180 1181 if (0 != project->values("QMAKE_LFLAGS").size()) { 1182 cwlink.append(project->values("QMAKE_LFLAGS").join(" ")); 1183 cwlink.append(" "); 1184 armlink.append(project->values("QMAKE_LFLAGS").join(" ")); 1185 armlink.append(" "); 1186 gccelink.append(project->values("QMAKE_LFLAGS").join(" ")); 1187 gccelink.append(" "); 1188 } 1189 1190 if (!cw.isEmpty() && cw[cw.size()-1] == ' ') 1191 cw.chop(1); 1192 if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') 1193 armcc.chop(1); 1194 if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') 1195 gcce.chop(1); 1196 if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ') 1197 cwlink.chop(1); 1198 if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ') 1199 armlink.chop(1); 1200 if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ') 1201 gccelink.chop(1); 1202 1203 if (!cw.isEmpty()) 1204 t << MMP_OPTION_CW " " << cw << endl; 1205 if (!armcc.isEmpty()) 1206 t << MMP_OPTION_ARMCC " " << armcc << endl; 1207 if (!gcce.isEmpty()) 1208 t << MMP_OPTION_GCCE " " << gcce << endl; 1209 1210 if (!cwlink.isEmpty()) 1211 t << MMP_LINKEROPTION_CW " " << cwlink << endl; 1212 if (!armlink.isEmpty()) 1213 t << MMP_LINKEROPTION_ARMCC " " << armlink << endl; 1214 if (!gccelink.isEmpty()) 1215 t << MMP_LINKEROPTION_GCCE " " << gccelink << endl; 1188 QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); 1189 QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); 1190 QStringList commonCFlags = project->values(VAR_CFLAGS); 1191 QStringList commonLFlags = project->values(VAR_LFLAGS); 1192 1193 foreach(QString item, keywords) { 1194 QString compilerOption; 1195 QString linkerOption; 1196 1197 appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); 1198 appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); 1199 appendMmpFileOptions(compilerOption, commonCxxFlags); 1200 appendMmpFileOptions(compilerOption, commonCFlags); 1201 1202 appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); 1203 appendMmpFileOptions(linkerOption, commonLFlags); 1204 1205 writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); 1206 writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); 1207 1208 writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); 1209 writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); 1210 } 1216 1211 1217 1212 t << endl; … … 1317 1312 } 1318 1313 1314 QString condition; 1315 if (!project->isEmpty(item + ".condition")) 1316 condition = project->first(item + ".condition"); 1317 1319 1318 QFileInfo subdir(fileInfo(fixedItem)); 1320 1319 QString relativePath = directory.relativeFilePath(fixedItem); … … 1345 1344 removeSpecialCharacters(bldinfDefine); 1346 1345 1346 if (!condition.isEmpty()) 1347 t << "#if defined(" << condition << ")" << endl; 1348 1347 1349 t << "#ifndef " << bldinfDefine << endl; 1348 t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl; 1349 t << "#endif // " << bldinfDefine << endl; 1350 t << "\t#include \"" << bldinfFilename << "\"" << endl; 1351 t << "#endif" << endl; 1352 1353 if (!condition.isEmpty()) 1354 t << "#endif" << endl; 1355 1350 1356 } 1351 1357 … … 1365 1371 1366 1372 QString mmpTag; 1367 if (project-> values("CONFIG").contains("symbian_test", Qt::CaseInsensitive))1373 if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) 1368 1374 mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); 1369 1375 else … … 1388 1394 userBldInfRules.remove(mmpTag); 1389 1395 1390 t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; 1396 QString extensionTag; 1397 if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) 1398 extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS); 1399 else 1400 extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS); 1401 1402 t << endl << extensionTag << endl << endl; 1391 1403 1392 1404 // Generate extension rules … … 1394 1406 writeBldInfExtensionRulesPart(t, iconFile); 1395 1407 1396 userItems = userBldInfRules.value( BLD_INF_TAG_EXTENSIONS);1408 userItems = userBldInfRules.value(extensionTag); 1397 1409 foreach(QString item, userItems) 1398 1410 t << item << endl; 1399 userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS); 1400 1401 t << endl << BLD_INF_TAG_EXPORTS << endl << endl; 1402 1403 // Generate export rules 1404 1405 // Export any deployed plugin stubs under /epoc32/data/z to support ROM builds 1406 for (int i = 0; i < depList.size(); ++i) { 1407 int index = depList.at(i).from.indexOf(PLUGIN_STUB_DIR); 1408 if (index != -1) { 1409 t << QString("%1 /epoc32/data/z%2") 1410 .arg(QString(depList.at(i).from).mid(index).replace('\\','/')) 1411 .arg(QString(depList.at(i).to).mid(2).replace('\\','/')) << endl; 1412 } 1413 } 1414 1415 userItems = userBldInfRules.value(BLD_INF_TAG_EXPORTS); 1416 foreach(QString item, userItems) 1417 t << item << endl; 1418 userBldInfRules.remove(BLD_INF_TAG_EXPORTS); 1411 userBldInfRules.remove(extensionTag); 1419 1412 1420 1413 // Add rest of the user defined content … … 1428 1421 } 1429 1422 1430 void SymbianMakefileGenerator::writeRegRssFile(Q StringList&userItems)1423 void SymbianMakefileGenerator::writeRegRssFile(QMap<QString, QStringList> &userItems) 1431 1424 { 1432 1425 QString filename(fixedTarget); … … 1445 1438 t << "#include <" << fixedTarget << ".rsg>" << endl; 1446 1439 t << "#include <appinfo.rh>" << endl; 1440 foreach(QString item, userItems[RSS_TAG_HEADER]) 1441 t << item << endl; 1447 1442 t << endl; 1448 1443 t << "UID2 KUidAppRegistrationResourceFile" << endl; … … 1452 1447 t << "\tapp_file=\"" << fixedTarget << "\";" << endl; 1453 1448 t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; 1449 1450 writeRegRssList(t, userItems[RSS_TAG_SERVICE_LIST], 1451 QLatin1String(RSS_TAG_SERVICE_LIST), 1452 QLatin1String("SERVICE_INFO")); 1453 writeRegRssList(t, userItems[RSS_TAG_FILE_OWNERSHIP_LIST], 1454 QLatin1String(RSS_TAG_FILE_OWNERSHIP_LIST), 1455 QLatin1String("FILE_OWNERSHIP_INFO")); 1456 writeRegRssList(t, userItems[RSS_TAG_DATATYPE_LIST], 1457 QLatin1String(RSS_TAG_DATATYPE_LIST), 1458 QLatin1String("DATATYPE")); 1454 1459 t << endl; 1455 1460 1456 foreach(QString item, userItems )1457 t << "\t" << item << endl;1461 foreach(QString item, userItems[RSS_TAG_DEFAULT]) 1462 t << "\t" << item.replace("\n","\n\t") << endl; 1458 1463 t << "\t}" << endl; 1464 1465 foreach(QString item, userItems[RSS_TAG_FOOTER]) 1466 t << item << endl; 1459 1467 } else { 1460 1468 PRINT_FILE_CREATE_ERROR(filename) 1469 } 1470 } 1471 1472 void SymbianMakefileGenerator::writeRegRssList(QTextStream &t, 1473 QStringList &userList, 1474 const QString &listTag, 1475 const QString &listItem) 1476 { 1477 int itemCount = userList.count(); 1478 if (itemCount) { 1479 t << "\t" << listTag << " ="<< endl; 1480 t << "\t\t{" << endl; 1481 foreach(QString item, userList) { 1482 t << "\t\t" << listItem << endl; 1483 t << "\t\t\t{" << endl; 1484 t << "\t\t\t" << item.replace("\n","\n\t\t\t") << endl; 1485 t << "\t\t\t}"; 1486 if (--itemCount) 1487 t << ","; 1488 t << endl; 1489 } 1490 t << "\t\t}; "<< endl; 1461 1491 } 1462 1492 } … … 1540 1570 } 1541 1571 1542 void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) 1572 void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, 1573 QString &iconFile, QMap<QString, 1574 QStringList> &userRssRules) 1543 1575 { 1544 1576 for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { … … 1552 1584 QStringList values = it.value(); 1553 1585 foreach(QString item, values) { 1554 // If there is no stringlist defined for a rule, use rule name directly1586 // If there is no stringlist defined for a rule, use rule value directly 1555 1587 // This is convenience for defining single line statements 1556 1588 if (project->values(item).isEmpty()) { 1557 1589 newValues << item; 1558 1590 } else { 1591 QStringList itemList; 1559 1592 foreach(QString itemRow, project->values(item)) { 1560 newValues<< itemRow;1593 itemList << itemRow; 1561 1594 } 1595 newValues << itemList.join("\n"); 1562 1596 } 1563 1597 } … … 1580 1614 continue; 1581 1615 } 1616 } else if (newKey == RSS_TAG_HEADER 1617 || newKey == RSS_TAG_SERVICE_LIST 1618 || newKey == RSS_TAG_FILE_OWNERSHIP_LIST 1619 || newKey == RSS_TAG_DATATYPE_LIST 1620 || newKey == RSS_TAG_FOOTER 1621 || newKey == RSS_TAG_DEFAULT) { 1622 userRssRules[newKey] = newValues; 1623 continue; 1582 1624 } else { 1583 1625 fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", … … 1588 1630 } 1589 1631 1632 QStringList newValues; 1590 1633 foreach(QString item, project->values(RSS_RULES)) { 1591 // If there is no stringlist defined for a rule, use rule name directly1592 // This is convenience for defining single line mmpstatements1634 // If there is no stringlist defined for a rule, use rule value directly 1635 // This is convenience for defining single line statements 1593 1636 if (project->values(item).isEmpty()) { 1594 userRssRules << item;1637 newValues << item; 1595 1638 } else { 1596 userRssRules << project->values(item); 1597 } 1598 } 1639 newValues << project->values(item); 1640 } 1641 } 1642 userRssRules[RSS_TAG_DEFAULT] << newValues; 1599 1643 1600 1644 // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist … … 1612 1656 bool ok; 1613 1657 numberOfIcons = numberOfIcons.simplified(); 1614 int tmp =numberOfIcons.toInt(&ok);1658 numberOfIcons.toInt(&ok); 1615 1659 if (!ok) { 1616 1660 numberOfIcons.clear(); … … 1883 1927 1884 1928 t << SIS_TARGET ":" << endl; 1885 QString siscommand = QString ("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \1929 QString siscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ 1886 1930 "$(MAKE) -s -f $(MAKEFILE) %4," \ 1887 1931 "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \ … … 1899 1943 t << OK_SIS_TARGET ":" << endl; 1900 1944 1901 QString pkgcommand = QString ("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \1945 QString pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ 1902 1946 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") 1903 1947 .arg(fixedTarget) … … 1912 1956 t << "\t$(MAKE) -s -f $(MAKEFILE) " SIS_TARGET << endl << endl; 1913 1957 1958 t << ROM_STUB_SIS_TARGET ":" << endl; 1959 QString stubsiscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ 1960 "$(MAKE) -s -f $(MAKEFILE) %4," \ 1961 "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \ 1962 "$(MAKE) -s -f $(MAKEFILE) %5))," \ 1963 "$(MAKE) -s -f $(MAKEFILE) %6)") 1964 .arg(fixedTarget) 1965 .arg("pkg") 1966 .arg(MAKE_CACHE_NAME) 1967 .arg(OK_ROM_STUB_SIS_TARGET) 1968 .arg(FAIL_SIS_NOCACHE_TARGET) 1969 .arg(FAIL_SIS_NOPKG_TARGET); 1970 t << stubsiscommand << endl; 1971 t << endl; 1972 1973 t << OK_ROM_STUB_SIS_TARGET ":" << endl; 1974 1975 QString stubpkgcommand = QString::fromLatin1("\tcreatepackage.bat -s $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ 1976 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") 1977 .arg(fixedTarget) 1978 .arg("pkg"); 1979 t << stubpkgcommand << endl; 1980 t << endl; 1981 1914 1982 t << INSTALLER_SIS_TARGET ": " << sisName << endl; 1915 siscommand = QString ("\t$(if $(wildcard %1_installer.%2)," \1983 siscommand = QString::fromLatin1("\t$(if $(wildcard %1_installer.%2)," \ 1916 1984 "$(MAKE) -s -f $(MAKEFILE) %3," \ 1917 1985 "$(MAKE) -s -f $(MAKEFILE) %4)") … … 1925 1993 t << OK_INSTALLER_SIS_TARGET ": " << endl; 1926 1994 1927 pkgcommand = QString ("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \1995 pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \ 1928 1996 "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") 1929 1997 .arg(fixedTarget) … … 2005 2073 } 2006 2074 t << "runonphone: sis" << endl; 2007 t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << " _$(QT_SIS_TARGET).sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl;2075 t << "\trunonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis " << fixedTarget << ".sis " << fixedTarget << ".exe " << "$(QT_RUN_OPTIONS)" << endl; 2008 2076 t << endl; 2009 2077 }
Note:
See TracChangeset
for help on using the changeset viewer.