diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-08-06 09:15:40 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-08-06 09:15:40 (GMT) |
commit | 3c0d46e59c3c1de863c695a40dcd9c42aaa29787 (patch) | |
tree | 9289b191cf27f15387c2d4eb18e302fa26a81ef4 /qmake | |
parent | 638edc80e3b224a6830dda0a2bd3097cb82dcb96 (diff) | |
download | Qt-3c0d46e59c3c1de863c695a40dcd9c42aaa29787.zip Qt-3c0d46e59c3c1de863c695a40dcd9c42aaa29787.tar.gz Qt-3c0d46e59c3c1de863c695a40dcd9c42aaa29787.tar.bz2 |
Further cleanup of qmake codes
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/metamakefile.cpp | 10 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.cpp | 37 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.h | 3 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 253 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 61 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.cpp | 15 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.h | 4 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 13 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.h | 4 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 2 | ||||
-rw-r--r-- | qmake/option.cpp | 2 | ||||
-rw-r--r-- | qmake/option.h | 1 | ||||
-rw-r--r-- | qmake/project.cpp | 8 |
15 files changed, 184 insertions, 233 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index dae38fc..a983d3b 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -156,7 +156,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; fi = QFileInfo(profile); } QMakeProject tmp_proj; diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 0b8fa17..a5fe373 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -534,7 +534,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() int start = oldpwd.lastIndexOf("/", end - 2); QString parentMmpFilename = oldpwd.mid(start + 1, end - start - 1); parentMmpFilename.prepend(oldpwd); - parentMmpFilename = parentMmpFilename.append(".mmp"); + parentMmpFilename = parentMmpFilename.append(Option::mmp_ext); const QStringList &subdirs = project->values("SUBDIRS"); @@ -560,13 +560,13 @@ bool SymbianSubdirsMetaMakefileGenerator::init() childMmpFilename = subdir.fileName(); childMmpFilename = subdir.absoluteFilePath(); childMmpFilename.replace(Option::pro_ext, QString("")); - childMmpFilename.append(".mmp"); + childMmpFilename.append(Option::mmp_ext); } else { childMmpFilename = subdir.absoluteFilePath(); - childMmpFilename.replace(QString(".pro"), QString(".mmp")); + childMmpFilename.replace(Option::pro_ext, Option::mmp_ext); sub_name = childMmpFilename; - sub_name.replace(QString(".mmp"), QString("")); + sub_name.replace(Option::mmp_ext, QString("")); sub_name.replace(0, sub_name.lastIndexOf("/") + 1, QString("")); project->values("SHADOW_BLD_INFS").append(QString("bld.inf.") + sub_name); } @@ -643,7 +643,7 @@ bool SymbianSubdirsMetaMakefileGenerator::init() int start = newpwd.lastIndexOf("/", end - 2); QString mmpFilename = newpwd.mid(start + 1, end - start - 1); mmpFilename.prepend(newpwd); - mmpFilename = mmpFilename.append(".mmp"); + mmpFilename = mmpFilename.append(Option::mmp_ext); // map mmpfile to its absolute filepath mmpPaths.insert(mmpFilename, newpwd); diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 8e3e20b..352c3cc 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -45,15 +45,20 @@ #include <qdebug.h> #define PLUGIN_STUB_DIR "qmakepluginstubs" +#define SYSBIN_DIR "\\sys\\bin" + +#define SUFFIX_DLL "dll" +#define SUFFIX_EXE "exe" +#define SUFFIX_QTPLUGIN "qtplugin" static bool isPlugin(const QFileInfo& info, const QString& devicePath) { // Libraries are plugins if deployment path is something else than - // \\sys\\bin or x:\\sys\\bin - if (0 == info.suffix().compare(QLatin1String("dll")) && + // SYSBIN_DIR with or without drive letter + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) && (devicePath.size() < 8 || - (0 != devicePath.compare(QLatin1String("\\sys\\bin")) && - 0 != devicePath.mid(1).compare(QLatin1String(":\\sys\\bin"))))) { + (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) && + 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive)))) { return true; } else { return false; @@ -62,8 +67,8 @@ static bool isPlugin(const QFileInfo& info, const QString& devicePath) static bool isBinary(const QFileInfo& info) { - if (0 == info.suffix().compare(QLatin1String("dll")) || - 0 == info.suffix().compare(QLatin1String("exe"))) { + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) || + 0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) { return true; } else { return false; @@ -80,7 +85,7 @@ static void createPluginStub(const QFileInfo& info, generatedDirs << PLUGIN_STUB_DIR; // Plugin stubs must have different name from the actual plugins, because // the toolchain for creating ROM images cannot handle non-binary .dll files properly. - QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + ".qtplugin"); + QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + "." SUFFIX_QTPLUGIN); if(stubFile.open(QIODevice::WriteOnly)) { if (!generatedFiles.contains(stubFile.fileName())) generatedFiles << stubFile.fileName(); @@ -88,7 +93,7 @@ static void createPluginStub(const QFileInfo& info, // Add note to stub so that people will not wonder what it is. // Creation date is added to make new stub to deploy always to // force plugin cache miss when loading plugins. - t << "This file is a Qt plugin stub file. The real Qt plugin is located in \\sys\\bin. Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; + t << "This file is a Qt plugin stub file. The real Qt plugin is located in " SYSBIN_DIR ". Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; } else { fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData()); } @@ -122,8 +127,8 @@ void initProjectDeploySymbian(QMakeProject* project, QString devicePath = project->first(item + ".path"); if (!deployBinaries && !devicePath.isEmpty() - && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join("")) - || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join("")))) { + && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) + || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { // Do not deploy resources in emulator builds, as that seems to cause conflicts // If there is ever a real need to deploy pre-built resources for emulator, // BLD_INF_RULES.prj_exports can be used as a workaround. @@ -145,7 +150,7 @@ void initProjectDeploySymbian(QMakeProject* project, // create output path devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); } else { - if (0 == platform.compare(QLatin1String("winscw"))) { + if (0 == platform.compare(QLatin1String("winscw"), Qt::CaseInsensitive)) { if (devicePathHasDriveLetter) { devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1,1); } else { @@ -162,8 +167,8 @@ void initProjectDeploySymbian(QMakeProject* project, devicePath.replace(QLatin1String("/"), QLatin1String("\\")); if (!deployBinaries && - 0 == devicePath.right(8).compare(QLatin1String("\\sys\\bin"))) { - // Skip deploying to \\sys\\bin for anything but binary deployments + 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive)) { + // Skip deploying to SYSBIN_DIR for anything but binary deployments // Note: Deploying pre-built binaries also follow this rule, so emulator builds // will not get those deployed. Since there is no way to differentiate currently // between pre-built binaries for emulator and HW anyway, this is not a major issue. @@ -193,7 +198,7 @@ void initProjectDeploySymbian(QMakeProject* project, // Executables and libraries are deployed to \sys\bin QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName()), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + info.fileName()))); + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); } if (isPlugin(info, devicePath)) { createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles); @@ -223,10 +228,10 @@ void initProjectDeploySymbian(QMakeProject* project, if (!iteratorInfo.isDir()) { if (isPlugin(iterator.fileInfo(), devicePath)) { // This deploys pre-built plugins. Other pre-built binaries will deploy normally, - // as they have \sys\bin target path. + // as they have SYSBIN_DIR target path. if (deployBinaries) { deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), - Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + iterator.fileName()))); + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + iterator.fileName()))); } createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); continue; diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index 0aad431..78b419b 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -66,4 +66,5 @@ extern void initProjectDeploySymbian(QMakeProject* project, const QString &build, QStringList& generatedDirs, QStringList& generatedFiles); -#endif // INITPROJECTDEPLOYSYMBIAN_H
\ No newline at end of file + +#endif // INITPROJECTDEPLOYSYMBIAN_H diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 1f22c70..889ad6f 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -62,24 +62,17 @@ #define BLD_INF_TAG_MMPFILES "prj_mmpfiles" #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" #define BLD_INF_TAG_EXTENSIONS "prj_extensions" + #define RSS_RULES "RSS_RULES" #define RSS_RULES_BASE "RSS_RULES." #define RSS_TAG_NBROFICONS "number_of_icons" #define RSS_TAG_ICONFILE "icon_file" -#define DUMP_VAR(v) \ -{ \ - QString s(v); \ - QStringList list = project->values(s); \ - printf("----------------------------------\n", qPrintable(s)); \ - printf("Dumping %s (%d items) from %s, %d\n", \ - qPrintable(s), \ - list.count(), \ - __FILE__, \ - __LINE__); \ - foreach(QString l, list) \ - printf("\t%s\n", qPrintable(l)); \ -} +#define MMP_TARGET "TARGET" +#define MMP_TARGETTYPE "TARGETTYPE" +#define MMP_SECUREID "SECUREID" + +#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) { @@ -163,7 +156,7 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t) QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); QString bldinfDefine = shortProFilename; bldinfDefine.append("_"); @@ -189,7 +182,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) // Generate pkg files if there are any actual files to deploy bool generatePkg = false; - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { generatePkg = true; } else { foreach(QString item, project->values("DEPLOYMENT")) { @@ -226,11 +219,11 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) if(wrapperMakefile.open(QIODevice::WriteOnly)) { generatedFiles << wrapperFileName; } else { - fprintf(stderr, "Error: Could not open wrapper makefile '%s'\n", qPrintable(wrapperFileName)); + PRINT_FILE_CREATE_ERROR(wrapperFileName); return false; } - if (getTargetExtension() == "subdirs") { + if (targetType == TypeSubdirs) { // If we have something to deploy, generate extension makefile for just that, since // normal extension makefile is not getting generated and we need emulator deployment to be done. if (generatePkg) @@ -243,21 +236,19 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); QString mmpFilename = shortProFilename; mmpFilename.append("_"); mmpFilename.append(uid3); - mmpFilename.append(".mmp"); + mmpFilename.append(Option::mmp_ext); writeMmpFile(mmpFilename, symbianLangCodes); - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - QString appname = escapeFilePath(fileFixify(project->first("TARGET"))); - appname = removePathSeparators(appname); - writeRegRssFile(appname, userRssRules); - writeRssFile(appname, numberOfIcons, iconFile); - writeLocFile(appname, symbianLangCodes); + writeRegRssFile(fixedTarget, userRssRules); + writeRssFile(fixedTarget, numberOfIcons, iconFile); + writeLocFile(fixedTarget, symbianLangCodes); } } @@ -267,7 +258,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) return true; } -bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) +void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { QString build = ( config == "udeb" ) ? "debug" : "release"; QString pkgFilename = QString("%1_%2-%3.%4") @@ -276,8 +267,10 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS .arg(compiler) .arg("pkg"); QFile pkgFile(pkgFilename); - if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) - return false; + if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + PRINT_FILE_CREATE_ERROR(pkgFilename); + return; + } generatedFiles << pkgFile.fileName(); @@ -317,14 +310,11 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS } // name of application, UID and version - QString applicationName = project->first("TARGET"); - int last = applicationName.lastIndexOf(QLatin1Char('/')); - applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); if(!containsStartWithItem('#', rawPkgPreRules)) { t << "; SIS header: name, uid, version" << endl; - t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; + t << QString("#{\"%1\"},(%2),%3").arg(fixedTarget).arg(uid3).arg(applicationVersion) << endl << endl; } // Localized vendor name @@ -360,10 +350,10 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS .arg(config); - if (getTargetExtension() == "exe") { + if (targetType == TypeExe) { // deploy .exe file t << "; Executable and default resource files" << endl; - QString exeFile = applicationName + ".exe"; + QString exeFile = fixedTarget + ".exe"; t << QString("\"%1/%2\" - \"%3\\%4\"") .arg(epocReleasePath) .arg(exeFile) @@ -374,15 +364,15 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") .arg(epocRoot()) - .arg(applicationName + ".rsc") + .arg(fixedTarget + ".rsc") .arg(installPathResource) - .arg(applicationName + ".rsc") << endl; + .arg(fixedTarget + ".rsc") << endl; t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") .arg(epocRoot()) - .arg(applicationName + "_reg.rsc") + .arg(fixedTarget + "_reg.rsc") .arg(installPathRegResource) - .arg(applicationName + "_reg.rsc") << endl; + .arg(fixedTarget + "_reg.rsc") << endl; QString myIconFile = iconFile; myIconFile = myIconFile.replace("\\\\", "\\"); @@ -428,8 +418,6 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS t << endl; } } - - return true; } bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) @@ -444,9 +432,9 @@ bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStri return result; } -bool SymbianMakefileGenerator::writeCustomDefFile() +void SymbianMakefileGenerator::writeCustomDefFile() { - if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if(targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Create custom def file for plugin QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); @@ -473,16 +461,16 @@ bool SymbianMakefileGenerator::writeCustomDefFile() t << "\tqt_plugin_instance @ 2 NONAME" << endl; t << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) } } - - return true; } void SymbianMakefileGenerator::init() { MakefileGenerator::init(); + fixedTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + fixedTarget = removePathSeparators(fixedTarget); if(0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); @@ -490,9 +478,7 @@ void SymbianMakefileGenerator::init() if(0 == project->values("QMAKESPEC").size()) project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); - if(!isConfigSetToSymbian()) - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); - + project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); // bld.inf project->values("MAKEFILE") += BLD_INF_FILENAME; @@ -508,25 +494,25 @@ void SymbianMakefileGenerator::init() } if((project->values("TEMPLATE")).contains("app")) - targetType = "exe"; + targetType = TypeExe; else if((project->values("TEMPLATE")).contains("lib")) { // Check CONFIG to see if we are to build staticlib or dll if(project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) - targetType = "staticlib"; + targetType = TypeLib; else if (project->values("CONFIG").contains("plugin")) - targetType = "plugin"; + targetType = TypePlugin; else - targetType = "dll"; + targetType = TypeDll; } else - targetType = "subdirs"; + targetType = TypeSubdirs; if(0 != project->values("TARGET.UID2").size()) { uid2 = project->first("TARGET.UID2"); } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { uid2 = "0x20004C45"; } else { - if(getTargetExtension() == "exe") { + if(targetType == TypeExe) { if(project->values("QT").contains("gui", Qt::CaseInsensitive)) { // exe and gui -> uid2 needed uid2 = "0x100039CE"; @@ -534,7 +520,7 @@ void SymbianMakefileGenerator::init() // exe but not gui: uid2 is ignored anyway -> set it to 0 uid2 = "0"; } - } else if(getTargetExtension() == "dll" || getTargetExtension() == "lib") { + } else if(targetType == TypeDll || targetType == TypeLib || targetType == TypePlugin) { uid2 = "0x1000008d"; } } @@ -548,7 +534,7 @@ void SymbianMakefileGenerator::init() uint uidNum = uid3.toUInt(&conversionOk, 0); if (!conversionOk) { - fprintf(stderr, "Error: Invalid UID \"%s\".", uid3.toUtf8().constData()); + fprintf(stderr, "Error: Invalid UID \"%s\".\n", uid3.toUtf8().constData()); } else { privateDirUid.setNum(uidNum, 16); while (privateDirUid.length() < 8) @@ -559,14 +545,14 @@ void SymbianMakefileGenerator::init() QString SymbianMakefileGenerator::getTargetExtension() { QString ret; - if(targetType.compare("exe", Qt::CaseInsensitive) == 0 || targetType.compare("app", Qt::CaseInsensitive) == 0) { + if(targetType == TypeExe) { ret.append("exe"); - } else if (targetType.compare("staticlib",Qt::CaseInsensitive) == 0) { + } else if (targetType == TypeLib) { ret.append("lib"); - } else if (targetType.compare("dll", Qt::CaseInsensitive) == 0 || targetType.compare("plugin", Qt::CaseInsensitive) == 0) { + } else if (targetType == TypeDll || targetType == TypePlugin) { ret.append("dll"); - } else if (targetType.compare("subdirs", Qt::CaseInsensitive) == 0) { - ret.append("subdirs"); + } else if (targetType == TypeSubdirs) { + // Not actually usable, so return empty } else { // If nothing else set, default to exe ret.append("exe"); @@ -575,11 +561,6 @@ QString SymbianMakefileGenerator::getTargetExtension() return ret; } -bool SymbianMakefileGenerator::isConfigSetToSymbian() -{ - return project->values("CONFIG").contains("symbian", Qt::CaseInsensitive); -} - QString SymbianMakefileGenerator::generateUID3() { QString target = project->first("TARGET"); @@ -588,7 +569,7 @@ QString SymbianMakefileGenerator::generateUID3() return generate_test_uid(target); } -bool SymbianMakefileGenerator::initMmpVariables() +void SymbianMakefileGenerator::initMmpVariables() { QStringList sysincspaths; QStringList srcincpaths; @@ -668,8 +649,6 @@ bool SymbianMakefileGenerator::initMmpVariables() sysincspaths << temporary; systeminclude.insert("SYSTEMINCLUDE", sysincspaths); - - return true; } bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) @@ -689,20 +668,18 @@ bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) return true; } -bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) +void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) { t << "// ==============================================================================" << endl; t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; t << "// This file is generated by qmake and should not be modified by the" << endl; t << "// user." << endl; - t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length()-4,4))) << ".mmp" << endl; + t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length()-4,4))) << Option::mmp_ext << endl; t << "// ==============================================================================" << endl << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) { QFile ft(filename); if(ft.open(QIODevice::WriteOnly)) { @@ -749,19 +726,14 @@ bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb writeMmpFileRulesPart(t); } else { - return false; + PRINT_FILE_CREATE_ERROR(filename) } - - return true; } -bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { t << endl; - if(isConfigSetToSymbian()) - return true; - QStringList &defines = project->values("DEFINES"); if (defines.size()) t << "// Qt Macros" << endl; @@ -780,39 +752,36 @@ bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) } t << endl; - - return true; } -bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) +void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { t << "MACRO" << "\t\t" << value << endl; - return true; } -bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { - if(getTargetExtension() == "exe") { - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << "\n"; + if(targetType == TypeExe) { + t << MMP_TARGET << "\t\t" << fixedTarget.append(".exe") << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDEXE" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl; else - t << "TARGETTYPE" << "\t\t" << "EXE" << endl; - } else if (getTargetExtension() == "dll"){ - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".dll")) << "\n"; + t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl; + } else if (targetType == TypeDll || targetType == TypePlugin){ + t << MMP_TARGET << "\t\t" << fixedTarget.append(".dll") << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDDLL" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl; else - t << "TARGETTYPE" << "\t\t" << "DLL" << endl; - } else if (getTargetExtension() == "lib"){ - t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".lib")) << "\n"; + t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl; + } else if (targetType == TypeLib){ + t << MMP_TARGET << "\t\t" << fixedTarget.append(".lib") << "\n"; if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) - t << "TARGETTYPE" << "\t\t" << "STDLIB" << endl; + t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl; else - t << "TARGETTYPE" << "\t\t" << "LIB" << endl; + t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl; } else { - printf("unexpected target and targettype %s\n", getTargetExtension().toAscii().data()); + fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); } t << endl; @@ -820,12 +789,12 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; if(0 != project->values("TARGET.SID").size()) { - t << "SECUREID" << "\t\t" << project->values("TARGET.SID").join(" ") << endl; + t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl; } else { if(0 == uid3.size()) - t << "SECUREID" << "\t\t" << "0" << endl; + t << MMP_SECUREID << "\t\t" << "0" << endl; else - t << "SECUREID" << "\t\t" << uid3 << endl; + t << MMP_SECUREID << "\t\t" << uid3 << endl; } // default value used from mkspecs is 0 @@ -842,14 +811,12 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) if(0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) t << "EPOCALLOWDLLDATA" << endl; - if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if(targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { // Use custom def file for Qt plugins t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; } t << endl; - - return true; } @@ -857,14 +824,12 @@ bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) Application registration resource files should be installed to the \private\10003a3f\import\apps directory. */ -bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { - if((getTargetExtension() == "exe") && + if((targetType == TypeExe) && !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - QString target = escapeFilePath(fileFixify(project->first("TARGET"))); - target = removePathSeparators(target); - QString locTarget = target; + QString locTarget = fixedTarget; locTarget.append(".rss"); t << "SOURCEPATH\t\t\t. " << endl; @@ -878,22 +843,20 @@ bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringL t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP<< endl; t << "END" << endl << endl; - QString regTarget = target; + QString regTarget = fixedTarget; regTarget.append("_reg.rss"); t << "SOURCEPATH\t\t\t." << endl; t << "START RESOURCE\t\t" << regTarget << endl; if (isForSymbianSbsv2()) - t << "DEPENDS " << target << ".rsg" << endl; + t << "DEPENDS " << fixedTarget << ".rsg" << endl; t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; t << "END" << endl << endl; } - return true; } -bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { - QDir current = QDir::current(); for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { @@ -905,19 +868,14 @@ bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) } t << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) { - writeMmpFileSystemIncludePart(t); - - return true; } -bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { QStringList &libs = project->values("LIBS"); libs << project->values("QMAKE_LIBS"); @@ -955,11 +913,9 @@ bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) } t << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { if(0 != project->first("TARGET.CAPABILITY").size()) { QStringList &capabilities = project->values("TARGET.CAPABILITY"); @@ -974,11 +930,9 @@ bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) t << "CAPABILITY" << "\t\t" << "None"; } t << endl << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { QString cw, armcc; @@ -1027,10 +981,9 @@ bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) t << "OPTION" << '\t' << " ARMCC "<< armcc << endl; t << endl; - return true; } -bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { QString applicationVersion = project->first("VERSION"); QStringList verNumList = applicationVersion.split('.'); @@ -1064,11 +1017,9 @@ bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) } t << "VERSION " << mmpVersion << endl; - - return true; } -bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { foreach(QString item, project->values("MMP_RULES")) { t << endl; @@ -1082,10 +1033,9 @@ bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) } } } - return true; } -bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) +void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { // Read user defined bld inf rules QMap<QString, QStringList> userBldInfRules; @@ -1116,7 +1066,7 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add includes of subdirs bld.inf files QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); - mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf(".")+1, 3, "mmp"); + mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext); QString currentPath = qmake_getpwd(); if(!currentPath.endsWith(QString("/"))) @@ -1137,11 +1087,11 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy QString bldinfFilename; QString fullProFilename = fullMmpName; - fullProFilename.replace(QString(".mmp"), QString(".pro")); + fullProFilename.replace(Option::mmp_ext, Option::pro_ext); QString uid = generate_uid(fullProFilename); QString cleanMmpName = fullProFilename; - cleanMmpName.replace(QString(".pro"), QString("")); + cleanMmpName.replace(Option::pro_ext, QString("")); cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString("")); if(shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project @@ -1200,16 +1150,14 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy t << endl << mmpTag << endl << endl; writeBldInfMkFilePart(t, addDeploymentExtension); - if (getTargetExtension() == "subdirs") { + if (targetType == TypeSubdirs) { mmpProjects.removeOne(mmpfilename); - } - - if(getTargetExtension() != "subdirs") { + } else { QString shortProFilename = project->projectFile(); shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(QString(".pro"), QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); - QString mmpFilename = shortProFilename + QString("_") + uid3 + QString(".mmp"); + QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext; t << mmpFilename << endl; } @@ -1237,11 +1185,9 @@ bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy foreach(QString item, userItems) t << item << endl; } - - return true; } -bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) +void SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) { QString filename(appName); filename.append("_reg.rss"); @@ -1272,12 +1218,11 @@ bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &us t << "\t" << item << endl; t << "\t}" << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename) } - return true; } -bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) +void SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) { QString filename(appName); filename.append(".rss"); @@ -1317,12 +1262,11 @@ bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfI t << "\t}" << endl; t << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename); } - return true; } -bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) +void SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) { QString filename(appName); filename.append(".loc"); @@ -1352,9 +1296,8 @@ bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbi t << "#define STRING_r_caption \"" << appName << "\"" << endl; t << "#endif" << endl; } else { - return false; + PRINT_FILE_CREATE_ERROR(filename); } - return true; } void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 3bf9f1d..a5781ee 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -54,12 +54,19 @@ QT_BEGIN_NAMESPACE class SymbianMakefileGenerator : public MakefileGenerator { protected: + enum TargetType { + TypeExe, + TypeDll, + TypeLib, + TypePlugin, + TypeSubdirs + }; QString platform; QString uid2; QString uid3; QString privateDirUid; - QString targetType; + TargetType targetType; QMap<QString, QStringList> sources; QMap<QString, QStringList> systeminclude; QMap<QString, QStringList> library; @@ -70,46 +77,50 @@ protected: QStringList generatedDirs; QHash<QString, QString> qt2S60LangMapTable; + QString fixedTarget; + void removeSpecialCharacters(QString& str); QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString canonizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); - bool generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + void generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); bool containsStartWithItem(const QChar &c, const QStringList& src); virtual void init(); QString getTargetExtension(); - bool isConfigSetToSymbian(); QString generateUID3(); - bool initMmpVariables(); + void initMmpVariables(); void writeHeader(QTextStream &t); - bool writeBldInfContent(QTextStream& t, bool addDeploymentExtension); + void writeBldInfContent(QTextStream& t, bool addDeploymentExtension); static bool removeDuplicatedStrings(QStringList& stringList); - bool writeMmpFileHeader(QTextStream &t); - bool writeMmpFile(QString &filename, QStringList &symbianLangCodes); - bool writeMmpFileMacrosPart(QTextStream& t); - bool addMacro(QTextStream& t, const QString& value); - bool writeMmpFileTargetPart(QTextStream& t); - bool writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); - bool writeMmpFileSystemIncludePart(QTextStream& t); - bool writeMmpFileIncludePart(QTextStream& t); - bool writeMmpFileLibraryPart(QTextStream& t); - bool writeMmpFileCapabilityPart(QTextStream& t); - bool writeMmpFileCompilerOptionPart(QTextStream& t); - bool writeMmpFileBinaryVersionPart(QTextStream& t); - bool writeMmpFileRulesPart(QTextStream& t); - - bool writeRegRssFile(QString &appname, QStringList &useritems); - bool writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); - bool writeLocFile(QString &appName, QStringList &symbianLangCodes); + void writeMmpFileHeader(QTextStream &t); + void writeMmpFile(QString &filename, QStringList &symbianLangCodes); + void writeMmpFileMacrosPart(QTextStream& t); + void addMacro(QTextStream& t, const QString& value); + void writeMmpFileTargetPart(QTextStream& t); + void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); + void writeMmpFileSystemIncludePart(QTextStream& t); + void writeMmpFileIncludePart(QTextStream& t); + void writeMmpFileLibraryPart(QTextStream& t); + void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileCompilerOptionPart(QTextStream& t); + void writeMmpFileBinaryVersionPart(QTextStream& t); + void writeMmpFileRulesPart(QTextStream& t); + + void writeCustomDefFile(); + + void writeRegRssFile(QString &appname, QStringList &useritems); + void writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); + void writeLocFile(QString &appName, QStringList &symbianLangCodes); void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + QStringList symbianLangCodesFromTsFiles(); void fillQt2S60LangMapTable(); @@ -127,12 +138,10 @@ protected: void generateDistcleanTargets(QTextStream& t); - bool writeCustomDefFile(); - // Subclass implements - virtual bool writeBldInfExtensionRulesPart(QTextStream& t) = 0; + virtual void writeBldInfExtensionRulesPart(QTextStream& t) = 0; virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; public: diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 17c365d..0c264fc 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -62,7 +62,7 @@ SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } -bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; removeSpecialCharacters(gnuMakefileName); @@ -148,8 +148,6 @@ bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b t << endl; } // if(ft.open(QIODevice::WriteOnly)) - - return true; } void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) @@ -163,8 +161,6 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool QStringList releasePlatforms = allPlatforms; releasePlatforms.removeAll("winscw"); // No release for emulator - bool isSubdirs = getTargetExtension() == "subdirs"; - QString testClause; if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) testClause = QLatin1String(" test"); @@ -285,7 +281,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // Unfortunately, Symbian build chain doesn't support linking generated objects to target, // so supporting generating sources is the best we can do. This is enough for mocs. - if (!isSubdirs) { + if (targetType != TypeSubdirs) { writeExtraTargets(t); writeExtraCompilerTargets(t); @@ -365,17 +361,16 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << endl; // Create execution target - if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; } } -bool SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) { // We don't use extensions for anything in abld Q_UNUSED(t); - return true; } bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) @@ -417,7 +412,7 @@ void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool ad { // Normally emulator deployment gets done via regular makefile, but since subdirs // do not get that, special deployment only makefile is generated for them if needed. - if(getTargetExtension() != "subdirs" || addDeploymentExtension) { + if(targetType != TypeSubdirs || addDeploymentExtension) { QString gnuMakefileName = QLatin1String("Makefile_") + uid3; removeSpecialCharacters(gnuMakefileName); gnuMakefileName.append(".mk"); diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 7de6510..10e189e 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -51,9 +51,9 @@ class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); bool writeDeploymentTargets(QTextStream &t); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 34585e8..7b8d3da 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -87,12 +87,11 @@ void SymbianSbsv2MakefileGenerator::exportFlm() } } -bool SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { // Can't use extension makefile with sbsv2 Q_UNUSED(wrapperFileName); Q_UNUSED(deploymentOnly); - return true; } void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) @@ -106,8 +105,6 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo QStringList releasePlatforms = allPlatforms; releasePlatforms.removeAll("winscw"); // No release for emulator - bool isSubdirs = getTargetExtension() == "subdirs"; - QString testClause; if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) testClause = QLatin1String(".test"); @@ -212,7 +209,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo // Add all extra targets including extra compiler targest also to wrapper makefile, // even though many of them may have already been added to bld.inf as FLMs. // This is to enable use of targets like 'mocables', which call targets generated by extra compilers. - if (!isSubdirs) { + if (targetType != TypeSubdirs) { t << extraTargetsCache; t << extraCompilersCache; } @@ -229,13 +226,13 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo t << endl; // create execution target - if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { t << "run:" << endl; t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; } } -bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) { // Makes sure we have needed FLMs in place. exportFlm(); @@ -408,8 +405,6 @@ bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << endl; t << endl; - - return true; } void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index caa491d..5a56af5 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -51,9 +51,9 @@ class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); public: diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 44caa68..3668fe2 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp @@ -682,7 +682,7 @@ void DspMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 303e3e1..2b60be6 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -524,7 +524,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; diff --git a/qmake/option.cpp b/qmake/option.cpp index 0e4a608..7f3e250 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -68,6 +68,7 @@ QString Option::obj_ext; QString Option::lex_ext; QString Option::yacc_ext; QString Option::pro_ext; +QString Option::mmp_ext; QString Option::dir_sep; QString Option::dirlist_sep; QString Option::h_moc_mod; @@ -381,6 +382,7 @@ Option::init(int argc, char **argv) Option::lex_ext = ".l"; Option::yacc_ext = ".y"; Option::pro_ext = ".pro"; + Option::mmp_ext = ".mmp"; #ifdef Q_OS_WIN Option::dirlist_sep = ";"; Option::shellPath = detectShellPath(); diff --git a/qmake/option.h b/qmake/option.h index 4205b03..e028566 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -92,6 +92,7 @@ struct Option static QString dirlist_sep; static QString sysenv_mod; static QString pro_ext; + static QString mmp_ext; static QString res_ext; static char field_sep; static const char *application_argv0; diff --git a/qmake/project.cpp b/qmake/project.cpp index 7c7044c..87c6939 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1606,8 +1606,8 @@ QMakeProject::read(uchar cmd) if(cmd & ReadProFile) { // parse project file debug_msg(1, "Project file: reading %s", pfile.toLatin1().constData()); - if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(".pro")) - pfile += ".pro"; + if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(Option::pro_ext)) + pfile += Option::pro_ext; if(!read(pfile, vars)) return false; } @@ -3339,7 +3339,7 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList // UIDs starting with 0xE are test UIDs in symbian -QString generate_test_uid(const QString& target) +QString generate_test_uid(const QString& target) { QString tmp = generate_uid(target); tmp.replace(0,1,"E"); @@ -3350,7 +3350,7 @@ QString generate_test_uid(const QString& target) // UIDs starting with 0xE are test UIDs in symbian -QString generate_uid(const QString& target) +QString generate_uid(const QString& target) { static QMap<QString, QString> targetToUid; |