diff options
-rw-r--r-- | mkspecs/common/symbian/symbian.conf | 2 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 163 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 9 |
3 files changed, 63 insertions, 111 deletions
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index d66d227..ba31116 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -26,7 +26,7 @@ QMAKE_CFLAGS_RELEASE = QMAKE_CFLAGS_DEBUG = QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses - +MMP_OPTION_KEYWORDS = CW ARMCC GCCE VERSION_FLAGS.ARMCC = ARMCC_4_0 QMAKE_CXX = g++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index e1256d8..40ef934 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -79,12 +79,8 @@ #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" #define MMP_SECUREID "SECUREID" -#define MMP_OPTION_CW "OPTION CW" -#define MMP_OPTION_ARMCC "OPTION ARMCC" -#define MMP_OPTION_GCCE "OPTION GCCE" -#define MMP_LINKEROPTION_CW "LINKEROPTION CW" -#define MMP_LINKEROPTION_ARMCC "LINKEROPTION ARMCC" -#define MMP_LINKEROPTION_GCCE "LINKEROPTION GCCE" +#define MMP_OPTION "OPTION" +#define MMP_LINKEROPTION "LINKEROPTION" #define MMP_CAPABILITY "CAPABILITY" #define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" #define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" @@ -95,6 +91,10 @@ #define MMP_START_RESOURCE "START RESOURCE" #define MMP_END_RESOURCE "END" +#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" +#define VAR_CFLAGS "QMAKE_CFLAGS" +#define VAR_LFLAGS "QMAKE_LFLAGS" + #define SIS_TARGET "sis" #define INSTALLER_SIS_TARGET "installer_sis" #define ROM_STUB_SIS_TARGET "stub_sis" @@ -800,9 +800,7 @@ void SymbianMakefileGenerator::initMmpVariables() overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) - << QLatin1String(MMP_OPTION_CW) << QLatin1String(MMP_OPTION_ARMCC) - << QLatin1String(MMP_OPTION_GCCE) << QLatin1String(MMP_LINKEROPTION_CW) - << QLatin1String(MMP_LINKEROPTION_ARMCC) << QLatin1String(MMP_LINKEROPTION_GCCE) + << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); @@ -1152,120 +1150,65 @@ void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) t << endl << endl; } -void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase) { - QString cw, armcc, gcce; - QString cwlink, armlink, gccelink; - - if (0 != project->values("QMAKE_CXXFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.CW").size()) { - cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); - cw.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { - armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); - armcc.append(" "); - } - - if (0 != project->values("QMAKE_CFLAGS.GCCE").size()) { - gcce.append(project->values("QMAKE_CXXFLAGS.GCCE").join(" ")); - gcce.append(" "); - } - - if (0 != project->values("QMAKE_CXXFLAGS").size()) { - cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CXXFLAGS").join(" ")); - gcce.append(" "); + foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { + QStringList currentValues = project->values(variableBase + "." + compilerVersion); + if (currentValues.size()) { + t << "#if defined(" << compilerVersion << ")" << endl; + t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; + t << "#endif" << endl; + } } +} - if (0 != project->values("QMAKE_CFLAGS").size()) { - cw.append(project->values("QMAKE_CFLAGS").join(" ")); - cw.append(" "); - armcc.append(project->values("QMAKE_CFLAGS").join(" ")); - armcc.append(" "); - gcce.append(project->values("QMAKE_CFLAGS").join(" ")); - gcce.append(" "); - } +void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options) +{ + QString trimmedOptions = options.trimmed(); + if (!trimmedOptions.isEmpty()) + t << optionType << " " << optionTag << " " << trimmedOptions << endl; +} - if (0 != project->values("QMAKE_LFLAGS.CW").size()) { - cwlink.append(project->values("QMAKE_LFLAGS.CW").join(" ")); - cwlink.append(" "); +void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) +{ + if (list.size()) { + options.append(list.join(" ")); + options.append(" "); } +} - if (0 != project->values("QMAKE_LFLAGS.ARMCC").size()) { - armlink.append(project->values("QMAKE_LFLAGS.ARMCC").join(" ")); - armlink.append(" "); - } +void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) +{ + QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); + QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); + QStringList commonCFlags = project->values(VAR_CFLAGS); + QStringList commonLFlags = project->values(VAR_LFLAGS); - if (0 != project->values("QMAKE_LFLAGS.GCCE").size()) { - gccelink.append(project->values("QMAKE_LFLAGS.GCCE").join(" ")); - gccelink.append(" "); - } + foreach(QString item, keywords) { + QString compilerOption; + QString linkerOption; - if (0 != project->values("QMAKE_LFLAGS").size()) { - cwlink.append(project->values("QMAKE_LFLAGS").join(" ")); - cwlink.append(" "); - armlink.append(project->values("QMAKE_LFLAGS").join(" ")); - armlink.append(" "); - gccelink.append(project->values("QMAKE_LFLAGS").join(" ")); - gccelink.append(" "); - } + appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); + appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); + appendMmpFileOptions(compilerOption, commonCxxFlags); + appendMmpFileOptions(compilerOption, commonCFlags); - if (!cw.isEmpty() && cw[cw.size()-1] == ' ') - cw.chop(1); - if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') - armcc.chop(1); - if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ') - gcce.chop(1); - if (!cwlink.isEmpty() && cwlink[cwlink.size()-1] == ' ') - cwlink.chop(1); - if (!armlink.isEmpty() && armlink[armlink.size()-1] == ' ') - armlink.chop(1); - if (!gccelink.isEmpty() && gccelink[gccelink.size()-1] == ' ') - gccelink.chop(1); + appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); + appendMmpFileOptions(linkerOption, commonLFlags); - if (!cw.isEmpty()) - t << MMP_OPTION_CW " " << cw << endl; - if (!armcc.isEmpty()) - t << MMP_OPTION_ARMCC " " << armcc << endl; + writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); + writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); - foreach(QString armccVersion, project->values("VERSION_FLAGS.ARMCC")) { - QStringList currentValues = project->values("QMAKE_CXXFLAGS." + armccVersion); - if (currentValues.size()) { - t << "#if defined(" << armccVersion << ")" << endl; - t << MMP_OPTION_ARMCC " " << currentValues.join(" ") << endl; - t << "#endif" << endl; - } + writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); + writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); } - if (!gcce.isEmpty()) - t << MMP_OPTION_GCCE " " << gcce << endl; - - if (!cwlink.isEmpty()) - t << MMP_LINKEROPTION_CW " " << cwlink << endl; - if (!armlink.isEmpty()) - t << MMP_LINKEROPTION_ARMCC " " << armlink << endl; - if (!gccelink.isEmpty()) - t << MMP_LINKEROPTION_GCCE " " << gccelink << endl; - t << endl; } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 9de852a..90c8549 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -124,6 +124,15 @@ protected: void writeMmpFileIncludePart(QTextStream& t); void writeMmpFileLibraryPart(QTextStream& t); void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileConditionalOptions(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &variableBase); + void writeMmpFileSimpleOption(QTextStream& t, + const QString &optionType, + const QString &optionTag, + const QString &options); + void appendMmpFileOptions(QString &options, const QStringList &list); void writeMmpFileCompilerOptionPart(QTextStream& t); void writeMmpFileBinaryVersionPart(QTextStream& t); void writeMmpFileRulesPart(QTextStream& t); |