summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-10-02 13:19:00 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-10-02 13:19:00 (GMT)
commit91d96edc19805c9dcc35650eb42e7587837cecc8 (patch)
tree29ee12bfcbc0564560803949fd0e688ea14875b1 /qmake
parent6b2f1f919d135929d508e5cfd2d64c390420ad50 (diff)
downloadQt-91d96edc19805c9dcc35650eb42e7587837cecc8.zip
Qt-91d96edc19805c9dcc35650eb42e7587837cecc8.tar.gz
Qt-91d96edc19805c9dcc35650eb42e7587837cecc8.tar.bz2
Enable overriding TARGETTYPE and OPTION statements with MMP_RULES
If MMP_RULES contains TARGETTYPE or any OPTION statements, default values for these will not be added to MMP file. This allows for example conditional OPTIONs and using native PLUGIN target type using MMP_RULES. Task-number: QT-2229 Reviewed-by: axis
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/symbian/symmake.cpp75
-rw-r--r--qmake/generators/symbian/symmake.h2
2 files changed, 58 insertions, 19 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index dd1dd5f..3d24053 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -71,6 +71,9 @@
#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 SIS_TARGET "sis"
#define OK_SIS_TARGET "ok_sis"
@@ -649,9 +652,35 @@ void SymbianMakefileGenerator::initMmpVariables()
sysincspaths << temporary;
systeminclude.insert("SYSTEMINCLUDE", sysincspaths);
+
+ // Check MMP_RULES for singleton keywords that are overridden
+ QStringList overridableMmpKeywords;
+ overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_OPTION_CW)
+ << QLatin1String(MMP_OPTION_ARMCC) << QLatin1String(MMP_OPTION_GCCE);
+
+ foreach (QString item, project->values("MMP_RULES")) {
+ if (project->values(item).isEmpty()) {
+ checkOverridability(overridableMmpKeywords, item);
+ } else {
+ foreach (QString itemRow, project->values(item)) {
+ checkOverridability(overridableMmpKeywords, itemRow);
+ }
+ }
+ }
+}
+
+void SymbianMakefileGenerator::checkOverridability(QStringList &overridableKeywords, QString &checkString)
+{
+ // Check if checkString contains overridable keyword and
+ // add the keyword to overridden keywords list if so.
+ QString simplifiedString = checkString.simplified();
+ foreach (QString item, overridableKeywords) {
+ if (simplifiedString.startsWith(item))
+ appendIfnotExist(overriddenMmpKeywords, item);
+ }
}
-bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList)
+bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList)
{
QStringList tmpStringList;
@@ -762,24 +791,32 @@ void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value)
void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t)
{
+ bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE);
+
if (targetType == TypeExe) {
t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl;
- if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl;
- else
- t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl;
+ }
} else if (targetType == TypeDll || targetType == TypePlugin) {
t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl;
- if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl;
- else
- t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl;
+ }
} else if (targetType == TypeLib) {
t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl;
- if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
- t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl;
- else
- t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl;
+ if (!skipTargetType) {
+ if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive))
+ t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl;
+ else
+ t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl;
+ }
} else {
fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType);
}
@@ -990,12 +1027,12 @@ void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t)
if (!gcce.isEmpty() && gcce[gcce.size()-1] == ' ')
gcce.chop(1);
- if (!cw.isEmpty())
- t << "OPTION CW " << cw << endl;
- if (!armcc.isEmpty())
- t << "OPTION ARMCC " << armcc << endl;
- if (!gcce.isEmpty())
- t << "OPTION GCCE " << gcce << endl;
+ if (!cw.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_CW))
+ t << MMP_OPTION_CW " " << cw << endl;
+ if (!armcc.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_ARMCC))
+ t << MMP_OPTION_ARMCC " " << armcc << endl;
+ if (!gcce.isEmpty() && !overriddenMmpKeywords.contains(MMP_OPTION_GCCE))
+ t << MMP_OPTION_GCCE " " << gcce << endl;
t << endl;
}
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 8e1a492..36f6e05 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -73,6 +73,7 @@ protected:
QMap<QString, QStringList> library;
// (output file) (source , command)
QMap<QString, QStringList> makmakeCommands;
+ QStringList overriddenMmpKeywords;
QStringList generatedFiles;
QStringList generatedDirs;
@@ -95,6 +96,7 @@ protected:
QString generateUID3();
void initMmpVariables();
+ void checkOverridability(QStringList &overridableKeywords, QString &checkString);
void writeHeader(QTextStream &t);
void writeBldInfContent(QTextStream& t, bool addDeploymentExtension);