summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/qt.prf')
-rw-r--r--mkspecs/features/qt.prf152
1 files changed, 102 insertions, 50 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 55a51293ac..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
@@ -58,6 +61,28 @@ qaxserver {
!force_import_plugins:!contains(TEMPLATE, ".*app"):!if(contains(TEMPLATE, ".*lib"):dll): \
CONFIG -= import_plugins
+unix {
+ 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)
@@ -68,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, [-/], _)
@@ -82,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()
}
@@ -105,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
@@ -218,28 +262,36 @@ for(ever) {
# Linking frameworks by absolute path does not work.
LIBS$$var_sfx += -framework $$framework
} else {
- lib = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ lib_bases = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ darwin: lib_bases *= $$MODULE_MODULE
+ add_lib_to_pretargetdeps = false
win32|contains(MODULE_CONFIG, staticlib) {
- lib_missing = true
- lib_extensions = $$QMAKE_EXTENSION_STATICLIB
- lib_extensions *= $$QMAKE_LIB_EXTENSIONS
- candidates =
- for(ext, lib_extensions) {
- candidate = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB$${lib}.$$ext
- candidates += $$candidate
- exists($$candidate) {
- lib = $$candidate
- lib_missing = false
- break()
- }
+ lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_STATICLIB
+ lib_suffixes = $$QMAKE_EXTENSION_STATICLIB
+ lib_suffixes *= $$QMAKE_LIB_EXTENSIONS
+ !xcodebuild: \
+ add_lib_to_pretargetdeps = true
+ } else {
+ lib_prefix = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB
+ lib_suffixes = $$QMAKE_EXTENSION_SHLIB
+ }
+ candidates =
+ for(lib_base, lib_bases) {
+ for(lib_suffix, lib_suffixes) {
+ candidates += $${lib_prefix}$${lib_base}.$${lib_suffix}
}
- $$lib_missing {
- lib = $$first(candidates)
+ }
+ lib =
+ for(candidate, candidates) {
+ exists("$$candidate") {
+ lib = "$$candidate"
+ break()
}
- PRE_TARGETDEPS += $$lib
- } else {
- lib = $$MODULE_LIBS/$$QMAKE_PREFIX_SHLIB$${lib}.$$QMAKE_EXTENSION_SHLIB
}
+ isEmpty(lib): \
+ lib = $$first(candidates)
+ $$add_lib_to_pretargetdeps: \
+ PRE_TARGETDEPS += $$lib
LIBS$$var_sfx += $$lib
}
}
@@ -287,7 +339,7 @@ contains(all_qt_module_deps, qml): \
QMLPATHS *= $$[QT_INSTALL_QML/get]
# run qmlimportscanner
- qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
+ qtPrepareLibExecTool(QMLIMPORTSCANNER, qmlimportscanner, , system)
for (QMLPATH, QMLPATHS): \
IMPORTPATHS += -importPath $$system_quote($$QMLPATH)