diff options
-rw-r--r-- | doc/src/development/qmake-manual.qdoc | 9 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_qmake-manual.qdoc | 13 | ||||
-rw-r--r-- | mkspecs/common/symbian/symbian.conf | 1 | ||||
-rw-r--r-- | mkspecs/features/symbian/add_mmp_rules.prf | 33 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 10 | ||||
-rw-r--r-- | tools/qtestlib/wince/cetest/cetest.pro | 2 | ||||
-rw-r--r-- | tools/qtestlib/wince/cetest/qmake_include.pri | 4 |
7 files changed, 64 insertions, 8 deletions
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 6406193..36bfcfe 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1727,8 +1727,15 @@ distinction between shared and \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 139 + There is also a convenience function for adding conditional rules + called \c{addMMPRules}. Suppose you need certain functionality + to require different library depending on architecture. This + can be specified with \c{addMMPRules} as follows: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 148 + \note You should not use this variable to add MMP statements that are - explicitly supported by their own variables, such as + explicitly supported by their own variables, such as \c TARGET.EPOCSTACKSIZE. Doing so could result in duplicate statements in the MMP file. diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index a48b53f..5a04420 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -969,3 +969,16 @@ DEPLOYMENT.installer_header = 0x12345678 //! [147] DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"My Application Installer\"},(0x12345678),1,0,0" //! [147] + +//! [148] +# Set conditional libraries +LIB.MARM = "LIBRARY myarm.lib" +LIB.WINSCW = "LIBRARY mywinscw.lib" +LIB.default = "LIBRARY mydefault.lib" + +# Add the conditional MMP rules +MYCONDITIONS = MARM WINSCW +MYVARIABLES = LIB + +addMMPRules(MYCONDITIONS, MYVARIABLES) +//! [148] diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 509c975..5230513 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -115,6 +115,7 @@ QMAKE_STRIPFLAGS_LIB += --strip-unneeded load(qt_config) load(symbian/platform_paths) +load(add_mmp_rules) symbian-abld { # Versions of abld prior to Symbian^3 have a bug where you cannot remove something from the command line without replacing it diff --git a/mkspecs/features/symbian/add_mmp_rules.prf b/mkspecs/features/symbian/add_mmp_rules.prf new file mode 100644 index 0000000..5384dbe --- /dev/null +++ b/mkspecs/features/symbian/add_mmp_rules.prf @@ -0,0 +1,33 @@ +# Arg1: List of conditions to generate block for +# Arg2: List of variables containing rules to add +defineTest(addMMPRules) { + unset(myConditions) + unset(myVariables) + unset(myIfDef) + + myConditions = $$eval($$1) default + myVariables = $$eval($$2) + myIfDef = if + + for(condition, $$list($$myConditions)) { + contains(condition, default) { + libBlock = "$${LITERAL_HASH}else" + } else { + libBlock = "$${LITERAL_HASH}$${myIfDef} defined($${condition})" + myIfDef = elif + } + + for(var, $$list($$myVariables)) { + varVal = $$eval($${var}.$${condition}) + isEmpty(varVal) { + # No value defined for current condition, so use default + varVal = $$eval($${var}.default) + } + !isEmpty(varVal): libBlock += "$$join(varVal,$$escape_expand(\n))" + } + + MMP_RULES += $$libBlock + } + MMP_RULES += "$${LITERAL_HASH}endif" + export(MMP_RULES) +} diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 7875a82..214f95c 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -749,15 +749,14 @@ void SymbianMakefileGenerator::initMmpVariables() QStringList restrictedMmpKeywords; bool inResourceBlock = false; - overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE); + 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_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) - << QLatin1String(MMP_EPOCHEAPSIZE) << QLatin1String(MMP_EPOCSTACKSIZE) - << QLatin1String(MMP_UID) << QLatin1String(MMP_VENDORID) - << QLatin1String(MMP_VERSION); + << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) + << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); foreach (QString item, project->values("MMP_RULES")) { if (project->values(item).isEmpty()) { @@ -927,6 +926,7 @@ void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); + bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); if (targetType == TypeExe) { t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; @@ -978,7 +978,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; - if (0 != project->values("TARGET.EPOCHEAPSIZE").size()) + if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) t << MMP_EPOCALLOWDLLDATA << endl; diff --git a/tools/qtestlib/wince/cetest/cetest.pro b/tools/qtestlib/wince/cetest/cetest.pro index 5cd52cf..6b6b02a 100644 --- a/tools/qtestlib/wince/cetest/cetest.pro +++ b/tools/qtestlib/wince/cetest/cetest.pro @@ -18,7 +18,7 @@ DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED QT_NO_CODECS QT_LITE_UNICODE QT INCLUDEPATH = \ $$QT_SOURCE_TREE/tools/qtestlib/ce/cetest \ $$QT_SOURCE_TREE/qmake \ - $$QT_SOURCE_TREE/qmake/generators/symbian \ + $$QT_SOURCE_TREE/tools/shared \ $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/src/corelib/global diff --git a/tools/qtestlib/wince/cetest/qmake_include.pri b/tools/qtestlib/wince/cetest/qmake_include.pri index aa32653..8b415b0 100644 --- a/tools/qtestlib/wince/cetest/qmake_include.pri +++ b/tools/qtestlib/wince/cetest/qmake_include.pri @@ -5,5 +5,7 @@ SOURCES += \ $$QT_SOURCE_TREE/qmake/option.cpp \ $$QT_SOURCE_TREE/qmake/project.cpp \ $$QT_SOURCE_TREE/qmake/property.cpp \ - $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp \ + $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ + $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp |