diff options
Diffstat (limited to 'qmake/generators/symbian')
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 25 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 21 |
2 files changed, 42 insertions, 4 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 8bf2176..bdba329 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -574,7 +574,30 @@ void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { - t << "MACRO\t\t" << value << endl; + // String macros for Makefile based platforms are defined like this in pro files: + // + // DEFINES += VERSION_STRING=\\\"1.2.3\\\" + // + // This will not work in *.mmp files, which don't need double escaping, and + // will therefore result in a VERSION_STRING value of \"1.2.3\" instead of "1.2.3". + // Improve cross platform support by removing one level of escaping from all + // DEFINES values. + static QChar backslash = QLatin1Char('\\'); + QString fixedValue; + fixedValue.reserve(value.size()); + int pos = 0; + int prevPos = 0; + while (pos < value.size()) { + if (value.at(pos) == backslash) { + fixedValue += value.mid(prevPos, pos - prevPos); + pos++; + prevPos = pos; + } + pos++; + } + fixedValue += value.mid(prevPos); + + t << "MACRO\t\t" << fixedValue << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 84236f1..78a9024 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -569,12 +569,27 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t exportFlm(); // Parse extra compilers data + QStringList rawDefines; QStringList defines; QStringList incPath; - defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") - << varGlue("DEFINES","-D"," -D",""); + rawDefines << project->values("PRL_EXPORT_DEFINES") + << project->values("QMAKE_COMPILER_DEFINES") + << project->values("DEFINES"); + + // Remove defines containing doubly-escaped characters (e.g. escaped double-quotation mark + // inside a string define) as bld.inf parsing done by sbsv2 toolchain breaks if they are + // present. + static QString backslashes = QLatin1String("\\\\"); + QMutableStringListIterator i(rawDefines); + while (i.hasNext()) { + QString val = i.next(); + if (val.indexOf(backslashes) != -1) + i.remove(); + } + + defines << valGlue(rawDefines,"-D"," -D",""); + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { |