summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/QtPriHelpers.cmake8
-rw-r--r--mkspecs/features/qt.prf38
2 files changed, 32 insertions, 14 deletions
diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake
index ddeb4d101d..c392a7b15b 100644
--- a/cmake/QtPriHelpers.cmake
+++ b/cmake/QtPriHelpers.cmake
@@ -613,6 +613,13 @@ function(qt_generate_plugin_pri_file target pri_file_var)
list(REMOVE_DUPLICATES plugin_deps)
list(JOIN plugin_deps " " plugin_deps)
+ list(APPEND module_config v2)
+ get_target_property(target_type ${target} TYPE)
+ if(target_type STREQUAL "STATIC_LIBRARY")
+ list(APPEND module_config staticlib)
+ endif()
+ list(JOIN module_config " " module_config)
+
qt_path_join(pri_target_path ${QT_BUILD_DIR} ${INSTALL_MKSPECSDIR}/modules)
qt_path_join(pri_file "${pri_target_path}" "qt_plugin_${plugin_name}.pri")
qt_configure_file(OUTPUT "${pri_file}"
@@ -620,6 +627,7 @@ function(qt_generate_plugin_pri_file target pri_file_var)
QT_PLUGIN.${plugin_name}.EXTENDS = ${plugin_extends}
QT_PLUGIN.${plugin_name}.DEPENDS = ${plugin_deps}
QT_PLUGIN.${plugin_name}.CLASS_NAME = ${plugin_class_name}
+QT_PLUGIN.${plugin_name}.module_config = ${module_config}
QT_PLUGINS += ${plugin_name}
")
set(${pri_file_var} "${pri_file}" PARENT_SCOPE)
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index d08cf264a8..71b6679af3 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -76,7 +76,7 @@ all_qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_d
QTPLUGIN = $$unique($$list($$lower($$QTPLUGIN)))
# Sanitize requested plugins, and add any default plugins
-import_plugins:qtConfig(static) {
+import_plugins {
manualplugs = $$QTPLUGIN # User may specify plugins. Mostly legacy.
autoplugs = # Auto-added plugins.
# First round: explicitly specified modules.
@@ -129,14 +129,16 @@ import_plugins:qtConfig(static) {
warning("Redundant entries in QTPLUGIN: $$extraplugs")
}
-# Only link against plugins in static builds
-!isEmpty(QTPLUGIN):qtConfig(static) {
- IMPORT_FILE_CONT = \
- "// This file is autogenerated by qmake. It imports static plugin classes for" \
- "// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \
- "$${LITERAL_HASH}include <QtPlugin>"
-
+# Link static plugins
+!isEmpty(QTPLUGIN) {
for (plug, QTPLUGIN) {
+ module_config = $$eval(QT_PLUGIN.$${plug}.module_config)
+ isEmpty(module_config):!qtConfig(static): \
+ next() # Compatibility with older modules
+
+ !contains(module_config, staticlib): \
+ next()
+
plug_class = $$eval(QT_PLUGIN.$${plug}.CLASS_NAME)
!isEmpty(plug_class): \
IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$plug_class)"
@@ -161,12 +163,20 @@ import_plugins:qtConfig(static) {
}
}
- TARGET_BASENAME = $$lower($$basename(TARGET))
- TARGET_BASENAME ~= s/\s/_/g
- IMPORT_CPP = $$OUT_PWD/$${TARGET_BASENAME}_plugin_import.cpp
- write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error()
- GENERATED_SOURCES += $$IMPORT_CPP
- QMAKE_DISTCLEAN += $$IMPORT_CPP
+ !isEmpty(IMPORT_FILE_CONT) {
+ IMPORT_FILE_CONT = \
+ "// This file is autogenerated by qmake. It imports static plugin classes for" \
+ "// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \
+ "$${LITERAL_HASH}include <QtPlugin>" \
+ "$$IMPORT_FILE_CONT"
+
+ TARGET_BASENAME = $$lower($$basename(TARGET))
+ TARGET_BASENAME ~= s/\s/_/g
+ IMPORT_CPP = $$OUT_PWD/$${TARGET_BASENAME}_plugin_import.cpp
+ write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error()
+ GENERATED_SOURCES += $$IMPORT_CPP
+ QMAKE_DISTCLEAN += $$IMPORT_CPP
+ }
}
# target variable, flag source variable