qt5base-lts/mkspecs/features/qt_module_fwdpri.prf
Thiago Macieira df3631045c Add a new location for QML 2.x imports
This commits adds a -qmldir configuration option for the configures to
allow the user to change the default location (it defaults to
$archdatadir/qml).

It adds a QLibraryInfo::Qml2ImportsPath value for
QLibraryInfo::location, a qmake property of QT_INSTALL_QML and a qt.conf
configure location entry "Qml2Imports".

At the same time, it makes the qmake .prf files dealing with QML plugins
be the QML 2 version. Those files are new in Qt 5, so we have the option
to choose which version we want to use.

Discussed-on: http://lists.qt-project.org/pipermail/development/2012-October/007136.html
Change-Id: I8c1c53e8685a5934ed0a9a42ba5663297b81a677
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-11-19 15:25:54 +01:00

81 lines
3.5 KiB
Plaintext

!build_pass {
load(qt_build_paths)
MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri
# -rpath-link is used by the linker to find depedencies of dynamic
# libraries which were NOT specified on the command line.
# This means that .libs of each module's regular .depends (QT) don't
# need to be put there, as they appear on the linker line anyway.
# A module's QT_PRIVATE's .libs OTOH need to be put there.
# .depends_private (QT_FOR_PRIVATE) is somewhat special: if the privates
# are used, the libraries are explicitly linked. If not, their locations
# need to be put into -rpath-link. As QT_FOR_PRIVATE cannot in turn
# contain privates, they always end up in -rpath-link of dependant
# modules.
# For simplicity of use, each module's rpath list has all dependencies
# transitively resolved already.
pubqt = $$MODULE_DEPENDS $$QT_FOR_PRIVATE
pubdep = $$resolve_depends(pubqt, "QT.")
privqt = $$replace(QT_PRIVATE, -private$, )
privdep = $$resolve_depends(privqt, "QT.")
rpaths =
alldep = $$pubdep $$privdep
for(dep, alldep) { # Inherit link-rpaths from all our dependencies
rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private)
}
privdep -= $$pubdep
for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths
rpaths += $$eval(QT.$${dep}.libs)
!isEmpty(rpaths) {
rpaths = $$unique(rpaths)
module_rpathlink = "QT.$${MODULE}.rpath_link = $$val_escape(rpaths)"
} else {
module_rpathlink =
}
rpaths_priv =
xtradep = $$resolve_depends(QT_FOR_PRIVATE, "QT.")
for(dep, xtradep): \ # Add our private API's dependencies' lib paths as new link-rpaths
rpaths_priv += $$eval(QT.$${dep}.libs)
rpaths_priv = $$unique(rpaths_priv)
rpaths_priv -= $$rpaths
!isEmpty(rpaths_priv) {
module_rpathlink_priv = "QT.$${MODULE}.rpath_link_private = $$val_escape(rpaths_priv)"
} else {
module_rpathlink_priv =
}
# Create a forwarding module .pri file
MODULE_FWD_PRI_CONT = \
"QT_MODULE_BASE = $$MODULE_BASE_DIR" \
"QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \
"QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \
"QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \
"QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \
"QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \
"QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \
$$module_rpathlink \
$$module_rpathlink_priv \
"include($$MODULE_PRI)"
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
# Then, inject the new module into the current cache state
!contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI) { # before the actual include()!
added = $$MODULE_PRI $$MODULE_FWD_PRI
cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, added)
unset(added)
}
include($$MODULE_FWD_PRI)
for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \
name depends private_depends module_config CONFIG DEFINES sources \
includes private_includes bins libs plugins imports qml \
)):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient)
cache(QT_CONFIG, transient)
} # !build_pass
# Schedule the regular .pri file for installation
CONFIG += qt_install_module