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.prf179
1 files changed, 148 insertions, 31 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index be54d030e7..f62b6bb139 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -14,18 +14,6 @@ no_keywords:DEFINES += QT_NO_KEYWORDS
plugin { #Qt plugins
static:DEFINES += QT_STATICPLUGIN
DEFINES += QT_PLUGIN
-
- # Triggers both on Qt being configured with -arch boundschecker,
- # and if you qmake CONFIG+=boundchecker on your plugin project
- boundschecker|contains(QT_CONFIG,boundschecker) {
- # This option is added for plugins when Qt is configured for Boundschecker,
- # since we want Boundschecker to not instrument the qt_plugin_query_verification_data
- # function, as we call that function without the plugin's dependent DLLs, thus
- # Boundscheckers instrumentation will fail. The function only returns a const char *,
- # so no instrumentation is really needed on that function anyways.
- QMAKE_CFLAGS += /nmignore:*:qt_plugin_query_verification_data
- QMAKE_CXXFLAGS += /nmignore:*:qt_plugin_query_verification_data
- }
}
qtestlib {
@@ -57,23 +45,153 @@ qaxserver {
QT += axserver
}
+# target variable, flag source variable
+defineTest(qtProcessModuleFlags) {
+ for(flag, $$2) {
+ contains(flag, ^-.*): \
+ $$1 -= $$replace(flag, ^-, )
+ else: \
+ $$1 += $$flag
+ }
+ export($$1)
+}
+
unset(using_privates)
-qtAddModules(QT, LIBS)
-qtAddModules(QT_PRIVATE, LIBS_PRIVATE)
+var_sfx =
+for(ever) {
+ # qmake variables cannot contain dashes, so normalize the names first
+ CLEAN_QT$$var_sfx = $$replace(QT$$var_sfx, -private$, _private)
+ # Topological resolution of modules based on their QT.<module>.depends variable
+ FULL_QT$$var_sfx = $$resolve_depends(CLEAN_QT$$var_sfx, "QT.")
+ # Finally actually add the modules
+ unset(BAD_QT)
+ for(QTLIB, FULL_QT$$var_sfx) {
+ MODULE_NAME = $$eval(QT.$${QTLIB}.name)
+ MODULE_MODULE = $$eval(QT.$${QTLIB}.module)
+ MODULE_INCLUDES = $$eval(QT.$${QTLIB}.includes)
+ MODULE_LIBS = $$eval(QT.$${QTLIB}.libs)
+ MODULE_FRAMEWORKS = $$eval(QT.$${QTLIB}.frameworks)
+ MODULE_CONFIG = $$eval(QT.$${QTLIB}.module_config)
+
+ isEmpty(MODULE_NAME) {
+ BAD_QT += $$QTLIB
+ next()
+ }
+
+ contains(MODULE_CONFIG, internal_module): \
+ using_privates = true
+ contains(MODULE_CONFIG, ltcg): \
+ CONFIG += link_ltcg
+
+ qtProcessModuleFlags(CONFIG, QT.$${QTLIB}.CONFIG)
+ qtProcessModuleFlags(DEFINES, QT.$${QTLIB}.DEFINES)
+
+ MODULE_INCLUDES -= $$QMAKE_DEFAULT_INCDIRS
+ MODULE_LIBS_ADD = $$MODULE_LIBS
+ MODULE_LIBS_ADD -= $$QMAKE_DEFAULT_LIBDIRS
+
+ !contains(MODULE_CONFIG, v2) {
+ # Backwards compatibility with pre-5.6 module .pri files
+
+ contains(MODULE_CONFIG, lib_bundle) {
+ MODULE_FRAMEWORKS = $$MODULE_LIBS
+ inc = $$MODULE_LIBS/$${MODULE_NAME}.framework/Headers
+ MODULE_INCLUDES = $$inc
+ contains(MODULE_CONFIG, internal_module): \
+ MODULE_INCLUDES += \
+ $$inc/$$eval(QT.$${QTLIB}.VERSION) \
+ $$inc/$$eval(QT.$${QTLIB}.VERSION)/$$MODULE_NAME
+ } else {
+ # Re-insert the major version in the library name (cf qt5LibraryTarget above)
+ MODULE_NAME ~= s,^Qt,Qt$$QT_MAJOR_VERSION,
+ }
+
+ # Only link to this module if a libs directory is set, else this is just a module
+ # to give access to sources or include files, and not for linking.
+ !isEmpty(MODULE_LIBS):!contains(MODULE_CONFIG, no_link): \
+ MODULE_MODULE = $${MODULE_NAME}$${QT_LIBINFIX}
+ }
+
+ # Frameworks shouldn't need include paths, but much code does not use
+ # module-qualified #includes, so by default we add paths which point
+ # directly into the frameworks. Private modules have somewhat convoluted
+ # header paths, so adding them is necessary in every case.
+ !if(contains(MODULE_CONFIG, lib_bundle):qt_no_framework_direct_includes) \
+ |contains(MODULE_CONFIG, internal_module): \
+ INCLUDEPATH *= $$MODULE_INCLUDES
+ QMAKE_FRAMEWORKPATH *= $$MODULE_FRAMEWORKS
+ !isEmpty(MODULE_MODULE) {
+ contains(MODULE_CONFIG, lib_bundle) {
+ LIBS$$var_sfx += -framework $$MODULE_MODULE
+ } else {
+ !isEmpty(MODULE_LIBS_ADD): \
+ LIBS$$var_sfx += -L$$MODULE_LIBS_ADD
+
+ lib = $$MODULE_MODULE$$qtPlatformTargetSuffix()
+ LIBS$$var_sfx += -l$$lib
+
+ contains(MODULE_CONFIG, staticlib): \
+ PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB}
+
+ !isEmpty(QMAKE_LSB) {
+ !isEmpty(MODULE_LIBS_ADD): \
+ QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS_ADD
+ QMAKE_LFLAGS *= --lsb-shared-libs=$$lib
+ QMAKE_LIBDIR *= /opt/lsb/lib
+ }
+ }
+ }
+ }
+ !isEmpty(BAD_QT):error("Unknown module(s) in QT$$var_sfx: $$replace(BAD_QT, _private$, -private)")
+
+ !isEmpty(var_sfx): break()
+ var_sfx = _PRIVATE
+}
!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) {
message("This project is using private headers and will therefore be tied to this specific Qt module build version.")
message("Running this project against other versions of the Qt modules may crash at any arbitrary point.")
message("This is not a bug, but a result of using Qt internals. You have been warned!")
}
-qtAddRpathLink($$QT $$QT_PRIVATE)
-wince:static:gui {
- QTLIB += qmenu_wce.res
+qt_module_deps = $$CLEAN_QT $$CLEAN_QT_PRIVATE
+qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
+
+!no_qt_rpath:!static:contains(QT_CONFIG, rpath):!contains(QT_CONFIG, static):\
+ contains(qt_module_deps, core) {
+ relative_qt_rpath:!isEmpty(QMAKE_REL_RPATH_BASE):contains(INSTALLS, target):\
+ isEmpty(target.files):isEmpty(target.commands):isEmpty(target.extra) {
+ mac {
+ if(equals(TEMPLATE, app):app_bundle)|\
+ if(equals(TEMPLATE, lib):plugin:plugin_bundle) {
+ ios: binpath = $$target.path/$${TARGET}.app
+ else: binpath = $$target.path/$${TARGET}.app/Contents/MacOS
+ } else: equals(TEMPLATE, lib):!plugin:lib_bundle {
+ binpath = $$target.path/$${TARGET}.framework/Versions/Current
+ } else {
+ binpath = $$target.path
+ }
+ } else {
+ binpath = $$target.path
+ }
+ # NOT the /dev property, as INSTALLS use host paths
+ QMAKE_RPATHDIR += $$relative_path($$[QT_INSTALL_LIBS], $$binpath)
+ } else {
+ QMAKE_RPATHDIR += $$[QT_INSTALL_LIBS/dev]
+ }
}
-qt_module_deps = $$QT $$QT_PRIVATE
-qt_module_deps = $$replace(qt_module_deps, -private$, _private)
-qt_module_deps = $$resolve_depends(qt_module_deps, "QT.")
+!isEmpty(QMAKE_LFLAGS_RPATHLINK):!contains(QT_CONFIG, static) {
+ # -rpath-link is used by the linker to find dependencies of dynamic
+ # libraries which were NOT specified on the command line.
+ # This means that paths of direct dependencies (QT & QT_PRIVATE)
+ # don't need to be listed, unlike their private dependencies' paths.
+ privdep = $$resolve_depends(qt_module_deps, "QT.", ".depends" ".run_depends")
+ privdep -= $$qt_module_deps
+ rpaths =
+ for(dep, privdep): \
+ rpaths += $$eval(QT.$${dep}.libs)
+ QMAKE_RPATHLINKDIR *= $$unique(rpaths)
+}
# static builds: link qml import plugins into the app.
contains(qt_module_deps, qml): \
@@ -98,7 +216,7 @@ contains(qt_module_deps, qml): \
!isEmpty(IMPORTS._KEYS_) {
# add import plugins to LIBS line
- for (key, IMPORTS._KEYS_): {
+ for (key, IMPORTS._KEYS_) {
PATH = $$eval(IMPORTS.$${key}.path)
PLUGIN = $$eval(IMPORTS.$${key}.plugin)
!isEmpty(PATH):!isEmpty(PLUGIN): LIBS *= -L$$PATH -l$${PLUGIN}$$qtPlatformTargetSuffix()
@@ -234,14 +352,10 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
QT_PLUGINPATH = $$eval(QT_PLUGIN.$${QTPLUG}.TYPE)
# Generate the plugin linker line
- target_qt:isEqual(TARGET, QTPLUG) {
- warning($$TARGET cannot have a QTPLUGIN of $$QTPLUG)
- } else {
- QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
- }
+ QT_LINKAGE = -l$${QTPLUG}$$qtPlatformTargetSuffix()
# Only link against plugin in static builds
- isEqual(QT_CURRENT_VERIFY, QTPLUGIN): {
+ isEqual(QT_CURRENT_VERIFY, QTPLUGIN) {
!isEmpty(QT_PLUGINPATH) {
plugpath = $$eval(QT_PLUGIN.$${QTPLUG}.PATH)
isEmpty(plugpath): \
@@ -252,15 +366,18 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
# if the plugin is linked statically there is no need to deploy it
DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY
}
- isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt): {
+
+ # The following block is currently broken, because qt_plugin_XXX.prf files
+ # are not generated for dynamic builds.
+ false:isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt) {
QT_ITEM =
debug: QT_ITEM = $${QTPLUG}d4.dll
else: QT_ITEM = $${QTPLUG}4.dll
- eval(qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS/get]/$${QT_PLUGINPATH}/$${QT_ITEM})
- eval(qt_additional_plugin_$${QTPLUG}.path = $${QT_PLUGINPATH})
+ qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS/get]/$${QT_PLUGINPATH}/$${QT_ITEM}
+ qt_additional_plugin_$${QTPLUG}.path = $${QT_PLUGINPATH}
- DEPLOYMENT *= qt_additional_plugin_$${QTPLUG}
+ INSTALLS *= qt_additional_plugin_$${QTPLUG}
}
}
}