summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-04-12 10:59:34 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-04-12 11:31:57 (GMT)
commita46b1d4060fd392c10d6c55d51f536ba92d9f5c3 (patch)
treeba33d7aebb321d1505992785274dd8f5db3c9aa0 /qmake
parentec171d35582ea440a1a790296e1875876ae7c568 (diff)
downloadQt-a46b1d4060fd392c10d6c55d51f536ba92d9f5c3.zip
Qt-a46b1d4060fd392c10d6c55d51f536ba92d9f5c3.tar.gz
Qt-a46b1d4060fd392c10d6c55d51f536ba92d9f5c3.tar.bz2
Improved support for OPTION and LINKEROPTION statements in MMP files
VERSION_FLAGS.<keyword> can now be used for all compilers and not just armcc, and version flagging can now be used with QMAKE_LFLAGS as well as QMAKE_CXXFLAGS. Also, MMP_OPTION_KEYWORDS variable is used to define supported keywords for OPTION and LINKEROPTION statements, which are defined via QMAKE_CXXFLAGS.<keyword> and QMAKE_LFLAGS.<keyword> variables. This improves flexibility in the future if new keywords need to be supported. Task-number: QTBUG-8685 Reviewed-by: Janne Koskinen
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/symbian/symmake.cpp163
-rw-r--r--qmake/generators/symbian/symmake.h9
2 files changed, 62 insertions, 110 deletions
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);