summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/development/qmake-manual.qdoc9
-rw-r--r--doc/src/snippets/code/doc_src_qmake-manual.qdoc13
-rw-r--r--mkspecs/common/symbian/symbian.conf1
-rw-r--r--mkspecs/features/symbian/add_mmp_rules.prf33
4 files changed, 55 insertions, 1 deletions
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc
index 78dfefa..b3d6f72 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 f3026ad..a90ef91 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -107,6 +107,7 @@ QMAKE_STRIPFLAGS_LIB += --strip-unneeded
load(qt_config)
load(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)
+}