diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-09-06 13:36:09 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-09-06 16:08:20 +0300 |
commit | d3064666be3909583ccdb873672011d1db4588e4 (patch) | |
tree | dc42e967f236f1b0aeec3e380662d704abea8fe6 /qmake | |
parent | f4bada8cbba5f209556ad4e3703d412e4146a0af (diff) | |
download | qt4-tools-d3064666be3909583ccdb873672011d1db4588e4.tar.gz |
Fixes for QMAKE_EXTRA_* variable handling in symbian-sbsv2
- No longer require PRE_TARGETDEPS items to be absolute, which was
difficult to achieve sometimes as qmake doesn't provide method
for absolutizing paths.
- Do smart command replacement for commands containing $$QMAKE_*
command variables, such as $$QMAKE_COPY, when generating bld.inf
extensions for QMAKE_EXTRA_* variables.
$$QMAKE_* command variables cannot be passed to sbsv2 toolchain
directly, as it uses cygwin in windows, and they can't simply
be replaced to use sbsv2 equivalents in symbian.conf, because
generated wrapper makefiles need them to be Windows compatible.
Reviewed-by: axis
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index e794351c31..c66c1b8ca0 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -413,6 +413,28 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t } } + QMap<QString, QString> commandsToReplace; + commandsToReplace.insert(project->values("QMAKE_COPY").join(" "), + project->values("QMAKE_SBSV2_COPY").join(" ")); + commandsToReplace.insert(project->values("QMAKE_COPY_DIR").join(" "), + project->values("QMAKE_SBSV2_COPY_DIR").join(" ")); + commandsToReplace.insert(project->values("QMAKE_MOVE").join(" "), + project->values("QMAKE_SBSV2_MOVE").join(" ")); + commandsToReplace.insert(project->values("QMAKE_DEL_FILE").join(" "), + project->values("QMAKE_SBSV2_DEL_FILE").join(" ")); + commandsToReplace.insert(project->values("QMAKE_MKDIR").join(" "), + project->values("QMAKE_SBSV2_MKDIR").join(" ")); + commandsToReplace.insert(project->values("QMAKE_DEL_DIR").join(" "), + project->values("QMAKE_SBSV2_DEL_DIR").join(" ")); + commandsToReplace.insert(project->values("QMAKE_DEL_TREE").join(" "), + project->values("QMAKE_SBSV2_DEL_TREE").join(" ")); + + // If commandItem starts with any $$QMAKE_* commands, do a replace for SBS equivalent + // Command replacement is done only for the start of the command or right after + // concatenation operators (&& and ||), as otherwise unwanted replacements might occur. + static QString cmdFind("(^|&&\\s*|\\|\\|\\s*)%1"); + static QString cmdReplace("\\1%1"); + // Write extra compilers and targets to initialize QMAKE_ET_* variables // Cache results to avoid duplicate calls when creating wrapper makefile QTextStream extraCompilerStream(&extraCompilersCache); @@ -424,13 +446,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // are not necessary. QStringList allPreDeps; foreach(QString item, project->values("PRE_TARGETDEPS")) { - // Predeps get mangled in windows, so fix them to more sbsv2 friendly format -#if defined(Q_OS_WIN) - if (item.mid(1, 1) == ":") - item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase -#endif - item.replace("\\", "/"); - allPreDeps << escapeDependencyPath(item); + allPreDeps.append(fileInfo(item).absoluteFilePath()); } foreach (QString item, project->values("GENERATED_SOURCES")) { @@ -460,7 +476,6 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" "); - // Make sure all deps paths are absolute QString absoluteDeps; foreach (QString depItem, deps) { @@ -474,6 +489,18 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; t << "OPTION DEPS " << absoluteDeps << endl; + // Iterate command replacements in reverse alphabetical order of keys so + // that keys which are starts of other longer keys are iterated after longer keys. + QMapIterator<QString, QString> cmdIter(commandsToReplace); + cmdIter.toBack(); + while (cmdIter.hasPrevious()) { + cmdIter.previous(); + if (commandItem.contains(cmdIter.key())) { + commandItem.replace(QRegExp(cmdFind.arg(cmdIter.key())), + cmdReplace.arg(cmdIter.value())); + } + } + if (commandItem.indexOf("$(INCPATH)") != -1) commandItem.replace("$(INCPATH)", incPath.join(" ")); if (commandItem.indexOf("$(DEFINES)") != -1) |