diff options
Diffstat (limited to 'mkspecs/features/qt.prf')
-rw-r--r-- | mkspecs/features/qt.prf | 106 |
1 files changed, 72 insertions, 34 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 0e03027bc3..3b71eea6bc 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -2,6 +2,9 @@ # due to required Qt modules being missing. !isEmpty(QMAKE_FAILED_REQUIREMENTS): return() +# hardcoded defaults +QT_CONFIG *= c99 c11 c++11 c++14 c++1z c++17 + qtConfig(thread): CONFIG *= thread #handle defines @@ -59,13 +62,28 @@ qaxserver { !force_import_plugins:!contains(TEMPLATE, ".*app"):!if(contains(TEMPLATE, ".*lib"):dll): \ CONFIG -= import_plugins unix { - contains(QT_CONFIG, no_extern_direct_access): CONFIG += mno_extern_direct_access + contains(QT_CONFIG, no_direct_extern_access): CONFIG += no_direct_extern_access else:contains(QT_CONFIG, reduce_relocations):!contains(TEMPLATE, .*lib): { QMAKE_CFLAGS += $$QMAKE_CFLAGS_PIC QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_PIC } } +# Load the entrypoint module if requested +entrypoint { + win32 { + !console:contains(TEMPLATE, ".*app"): \ + QT_PRIVATE += entrypoint_private + } else:uikit { + qt_depends = $$resolve_depends(QT, "QT.") + !watchos:equals(TEMPLATE, app):contains(qt_depends, gui(-private)?): \ + QT_PRIVATE += entrypoint_private + } +} + +# Will automatically add plugins, so run first +contains(QT_CONFIG, permissions): load(permissions) + # qmake variables cannot contain dashes, so normalize the names first CLEAN_QT = $$replace(QT, -private$, _private) CLEAN_QT_PRIVATE = $$replace(QT_PRIVATE, -private$, _private) @@ -75,13 +93,15 @@ all_qt_module_deps = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_d QTPLUGIN = $$unique($$list($$lower($$QTPLUGIN))) -import_plugins:qtConfig(static) { +# Sanitize requested plugins, and add any default plugins +import_plugins { manualplugs = $$QTPLUGIN # User may specify plugins. Mostly legacy. autoplugs = # Auto-added plugins. # First round: explicitly specified modules. - plugin_deps = $$all_qt_module_deps + all_plugin_deps = $$all_qt_module_deps + plugin_deps = $$all_plugin_deps for(ever) { - # Automatically link the default plugins for the linked Qt modules. + # Automatically add the default plugins for the linked Qt modules. for (qtmod, plugin_deps) { for (ptype, QT.$${qtmod}.plugin_types) { nptype = $$replace(ptype, [-/], _) @@ -89,7 +109,7 @@ import_plugins:qtConfig(static) { for (plug, QT_PLUGINS) { equals(QT_PLUGIN.$${plug}.TYPE, $$ptype) { for (dep, QT_PLUGIN.$${plug}.EXTENDS) { - !contains(all_qt_module_deps, $$dep) { + !contains(all_plugin_deps, $$dep) { plug = break() } @@ -112,57 +132,74 @@ import_plugins:qtConfig(static) { for (plug, QTPLUGIN): \ plugin_deps += $$eval(QT_PLUGIN.$${plug}.DEPENDS) plugin_deps = $$resolve_depends(plugin_deps, "QT.", ".depends" ".run_depends") - plugin_deps -= $$all_qt_module_deps + plugin_deps -= $$all_plugin_deps + isEmpty(plugin_deps): \ break() # ... and start over if any new Qt modules appeared, # as these may want to load plugins in turn. - all_qt_module_deps += $$plugin_deps + all_plugin_deps += $$plugin_deps } extraplugs = $$manualplugs manualplugs -= $$autoplugs extraplugs -= $$manualplugs !isEmpty(extraplugs): \ warning("Redundant entries in QTPLUGIN: $$extraplugs") - - !isEmpty(QTPLUGIN) { - 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>" - for (plug, QTPLUGIN) { - plug_class = $$eval(QT_PLUGIN.$${plug}.CLASS_NAME) - !isEmpty(plug_class): \ - IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$plug_class)" - else: \ - warning("Plugin class name could not be determined for plugin '$$plug'.") - } - 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 - } } -# Only link against plugins in static builds -!isEmpty(QTPLUGIN):qtConfig(static) { +# 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)" + else: \ + warning("Plugin class name could not be determined for plugin '$$plug'.") + + plugin_deps = $$eval(QT_PLUGIN.$${plug}.DEPENDS) + plugin_deps = $$resolve_depends(plugin_deps, "QT.", ".depends" ".run_depends") + all_qt_module_deps *= $$plugin_deps + # Check if the plugin is known to Qt. We can use this to determine # the plugin path. Unknown plugins must rely on the default link path. plug_type = $$eval(QT_PLUGIN.$${plug}.TYPE) !isEmpty(plug_type) { - plug_name = $$QMAKE_PREFIX_STATICLIB$${plug}$$qtPlatformTargetSuffix().$$QMAKE_EXTENSION_STATICLIB + # Respect target config if Qt provides both debug and release versions + # of each plugin. Otherwise, respect what Qt was configured with. + qtConfig(debug_and_release): config_variable = CONFIG + else: config_variable = QT_CONFIG + + plug_name = $$QMAKE_PREFIX_STATICLIB$${plug}$$qtPlatformTargetSuffix($$config_variable).$$QMAKE_EXTENSION_STATICLIB plug_path = $$eval(QT_PLUGIN.$${plug}.PATH) isEmpty(plug_path): \ plug_path = $$[QT_INSTALL_PLUGINS/get] LIBS += $$plug_path/$$plug_type/$$plug_name } else { - LIBS += -l$${plug}$$qtPlatformTargetSuffix() + LIBS += -l$${plug}$$qtPlatformTargetSuffix(CONFIG) } } + + !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 @@ -227,15 +264,16 @@ for(ever) { } else { lib_bases = $$MODULE_MODULE$$qtPlatformTargetSuffix() darwin: lib_bases *= $$MODULE_MODULE + add_lib_to_pretargetdeps = false win32|contains(MODULE_CONFIG, staticlib) { lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB lib_suffixes = $$QMAKE_EXTENSION_STATICLIB lib_suffixes *= $$QMAKE_LIB_EXTENSIONS - add_lib_to_pretargetdeps = true + !xcodebuild: \ + add_lib_to_pretargetdeps = true } else { lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB lib_suffixes = $$QMAKE_EXTENSION_SHLIB - add_lib_to_pretargetdeps = false } candidates = for(lib_base, lib_bases) { |