summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-08-02 19:15:45 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-04 00:52:38 +0200
commitff0a759f8d70322d348e0d918248e56dae2e40d3 (patch)
tree1ae68fcd067a211904ea2335da94e7b5f4e10dea /mkspecs
parent55662549485be9b47984d4a54e730f531fb01f4a (diff)
de-duplicate dbusadaptors.prf vs. dbusinterfaces.prf
it's two times the same code, once with "adaptor" (and an -a option) and once with "interface" (and a -p option). the de-duplicated code looks a bit nasty, as qmake cannot deal with braces on the LHS yet. Change-Id: I199a07947661ab9abe7a736b56c437f3f6dc4fa4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/dbusadaptors.prf43
-rw-r--r--mkspecs/features/dbuscommon.pri57
-rw-r--r--mkspecs/features/dbusinterfaces.prf44
3 files changed, 63 insertions, 81 deletions
diff --git a/mkspecs/features/dbusadaptors.prf b/mkspecs/features/dbusadaptors.prf
index 3463d586dd..43134e2a39 100644
--- a/mkspecs/features/dbusadaptors.prf
+++ b/mkspecs/features/dbusadaptors.prf
@@ -1,41 +1,4 @@
-qtPrepareTool(QMAKE_QDBUSXML2CPP, qdbusxml2cpp)
+dbus_type = adaptor
+qdbusxml2cpp_option = -a
-for(DBUS_ADAPTOR, $$list($$unique(DBUS_ADAPTORS))) {
-
- !contains(DBUS_ADAPTOR, .*\\w\\.xml$) {
- warning("Invalid D-BUS adaptor: '$${DBUS_ADAPTOR}', please use 'com.mydomain.myinterface.xml' instead.")
- next()
- }
-
- DBUS_ADAPTOR_LIST += $${DBUS_ADAPTOR}
-}
-
-dbus_adaptor_header.commands = $$QMAKE_QDBUSXML2CPP -a ${QMAKE_FILE_OUT}: ${QMAKE_FILE_IN}
-dbus_adaptor_header.output_function = dbus_adaptor_header_output
-dbus_adaptor_header.name = DBUSXML2CPP ADAPTOR HEADER ${QMAKE_FILE_IN}
-dbus_adaptor_header.variable_out = DBUS_ADAPTOR_HEADERS
-dbus_adaptor_header.input = DBUS_ADAPTOR_LIST
-
-defineReplace(dbus_adaptor_header_output) {
- return("$$lower($$section($$list($$basename(1)),.,-2,-2))_adaptor.h")
-}
-
-dbus_adaptor_source.commands = $$QMAKE_QDBUSXML2CPP -i ${QMAKE_FILE_OUT_BASE}.h -a :${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
-dbus_adaptor_source.output_function = dbus_adaptor_source_output
-dbus_adaptor_source.name = DBUSXML2CPP ADAPTOR SOURCE ${QMAKE_FILE_IN}
-dbus_adaptor_source.variable_out = SOURCES
-dbus_adaptor_source.input = DBUS_ADAPTOR_LIST
-
-load(moc)
-dbus_adaptor_moc.commands = $$moc_header.commands
-dbus_adaptor_moc.output = $$moc_header.output
-dbus_adaptor_moc.depends = $$dbus_adaptor_header.output
-dbus_adaptor_moc.input = DBUS_ADAPTOR_HEADERS
-dbus_adaptor_moc.variable_out = GENERATED_SOURCES
-dbus_adaptor_moc.name = $$moc_header.name
-
-defineReplace(dbus_adaptor_source_output) {
- return("$$lower($$section($$list($$basename(1)),.,-2,-2))_adaptor.cpp")
-}
-
-QMAKE_EXTRA_COMPILERS += dbus_adaptor_header dbus_adaptor_source dbus_adaptor_moc
+include(dbuscommon.pri)
diff --git a/mkspecs/features/dbuscommon.pri b/mkspecs/features/dbuscommon.pri
new file mode 100644
index 0000000000..b2c62306aa
--- /dev/null
+++ b/mkspecs/features/dbuscommon.pri
@@ -0,0 +1,57 @@
+load(moc)
+qtPrepareTool(QMAKE_QDBUSXML2CPP, qdbusxml2cpp)
+
+defineReplace(qdbusOutputBasename) {
+ return($$lower($$section($$list($$basename(1)),.,-2,-2)))
+}
+
+dbus_TYPE = $$upper($$dbus_type)
+group = dbus_$${dbus_type}
+GROUP = DBUS_$${dbus_TYPE}
+input_list = $${GROUP}_LIST
+
+for(entry, $$list($$unique($${GROUP}S))) {
+
+ !contains(entry, .*\\w\\.xml$) {
+ warning("Invalid D-BUS $${dbus_type}: '$$entry', please use 'com.mydomain.myinterface.xml' instead.")
+ next()
+ }
+
+ $$input_list += $$entry
+}
+
+# funny indent to avoid re-indentation in next commit
+ dthc = $${group}_header.commands
+ $$dthc = $$QMAKE_QDBUSXML2CPP $$qdbusxml2cpp_option ${QMAKE_FILE_OUT}: ${QMAKE_FILE_IN}
+ dtho = $${group}_header.output
+ $$dtho = ${QMAKE_FUNC_FILE_IN_qdbusOutputBasename}_$${dbus_type}.h
+ dthn = $${group}_header.name
+ $$dthn = DBUSXML2CPP $${dbus_TYPE} HEADER ${QMAKE_FILE_IN}
+ dthvo = $${group}_header.variable_out
+ $$dthvo = $${GROUP}_HEADERS
+ dthi = $${group}_header.input
+ $$dthi = $$input_list
+
+ dtsc = $${group}_source.commands
+ $$dtsc = $$QMAKE_QDBUSXML2CPP -i ${QMAKE_FILE_OUT_BASE}.h $$qdbusxml2cpp_option :${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+ dtso = $${group}_source.output
+ $$dtso = ${QMAKE_FUNC_FILE_IN_qdbusOutputBasename}_$${dbus_type}.cpp
+ dtsn = $${group}_source.name
+ $$dtsn = DBUSXML2CPP $${dbus_TYPE} SOURCE ${QMAKE_FILE_IN}
+ dtsvo = $${group}_source.variable_out
+ $$dtsvo = SOURCES
+ dtsi = $${group}_source.input
+ $$dtsi = $$input_list
+
+ dtmc = $${group}_moc.commands
+ $$dtmc = $$moc_header.commands
+ dtmo = $${group}_moc.output
+ $$dtmo = $$moc_header.output
+ dtmi = $${group}_moc.input
+ $$dtmi = $${GROUP}_HEADERS
+ dtmvo = $${group}_moc.variable_out
+ $$dtmvo = GENERATED_SOURCES
+ dtmn = $${group}_moc.name
+ $$dtmn = $$moc_header.name
+
+ QMAKE_EXTRA_COMPILERS += $${group}_header $${group}_source $${group}_moc
diff --git a/mkspecs/features/dbusinterfaces.prf b/mkspecs/features/dbusinterfaces.prf
index 1828802a44..910dace359 100644
--- a/mkspecs/features/dbusinterfaces.prf
+++ b/mkspecs/features/dbusinterfaces.prf
@@ -1,42 +1,4 @@
-load(moc)
+dbus_type = interface
+qdbusxml2cpp_option = -p
-qtPrepareTool(QMAKE_QDBUSXML2CPP, qdbusxml2cpp)
-
-for(DBUS_INTERFACE, $$list($$unique(DBUS_INTERFACES))) {
-
- !contains(DBUS_INTERFACE, .*\\w\\.xml$) {
- warning("Invalid D-BUS interface : '$${DBUS_INTERFACE}', please use 'com.mydomain.myinterface.xml' instead.")
- next()
- }
-
- DBUS_INTERFACE_LIST += $${DBUS_INTERFACE}
-}
-
-dbus_interface_header.commands = $$QMAKE_QDBUSXML2CPP -p ${QMAKE_FILE_OUT}: ${QMAKE_FILE_IN}
-dbus_interface_header.output_function = dbus_interface_header_output
-dbus_interface_header.name = DBUSXML2CPP INTERFACE HEADER ${QMAKE_FILE_IN}
-dbus_interface_header.variable_out = DBUS_INTERFACE_HEADERS
-dbus_interface_header.input = DBUS_INTERFACE_LIST
-
-defineReplace(dbus_interface_header_output) {
- return("$$lower($$section($$list($$basename(1)),.,-2,-2))_interface.h")
-}
-
-dbus_interface_source.commands = $$QMAKE_QDBUSXML2CPP -i ${QMAKE_FILE_OUT_BASE}.h -p :${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
-dbus_interface_source.output_function = dbus_interface_source_output
-dbus_interface_source.name = DBUSXML2CPP INTERFACE SOURCE ${QMAKE_FILE_IN}
-dbus_interface_source.variable_out = SOURCES
-dbus_interface_source.input = DBUS_INTERFACE_LIST
-
-dbus_interface_moc.commands = $$moc_header.commands
-dbus_interface_moc.output = $$moc_header.output
-dbus_interface_moc.depends = $$dbus_interface_header.output
-dbus_interface_moc.input = DBUS_INTERFACE_HEADERS
-dbus_interface_moc.variable_out = GENERATED_SOURCES
-dbus_interface_moc.name = $$moc_header.name
-
-defineReplace(dbus_interface_source_output) {
- return("$$lower($$section($$list($$basename(1)),.,-2,-2))_interface.cpp")
-}
-
-QMAKE_EXTRA_COMPILERS += dbus_interface_header dbus_interface_source dbus_interface_moc
+include(dbuscommon.pri)