qt5base-lts/mkspecs/features/qt_module_pris.prf
Oswald Buddenhagen 4c34b418b8 fix lack of rpath-link when using modules from final location
if the libraries are in a non-standard location, but no rpath is used,
rpath-link is needed. this is often the case for non-prefix builds
(which have no forwarding pris any more).

as we cannot store absolute paths in the final pris, we need to store the
module names, and resolve them only at use time.

Change-Id: I1538b5d531611c76a2d7058a3b2ff683bdcbe427
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-02-04 15:10:22 +01:00

122 lines
5.0 KiB
Plaintext

#
# W A R N I N G
# -------------
#
# This file is not part of the Qt API. It exists purely as an
# implementation detail. It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#
load(qt_build_paths)
MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri
prefix_build: \
MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri
else: \
MODULE_PRI = $$MODULE_FWD_PRI
!build_pass {
# Create a module .pri file
unix:!static: \
module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]"
else: \
module_rpath =
!isEmpty(QT_FOR_PRIVATE) {
contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.")
module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE"
} else {
module_privdep =
}
!isEmpty(QT_PRIVATE): \
module_rundep = "QT.$${MODULE}.run_depends = $$unique($$list($$replace(QT_PRIVATE, -private$, )))"
else: \
module_rundep =
static: \
module_build_type = "QT.$${MODULE}.module_config = staticlib"
else:mac:contains(QT_CONFIG, qt_framework): \
module_build_type = "QT.$${MODULE}.module_config = lib_bundle"
else: \
module_build_type =
!isEmpty(MODULE_CONFIG): \
module_config = "QT.$${MODULE}.CONFIG = $$MODULE_CONFIG"
else: \
module_config =
!no_module_headers {
MODULE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME"
MODULE_PRIVATE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION \
\$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME"
}
MODULE_PRI_CONT = \
"QT.$${MODULE}.VERSION = $${VERSION}" \
"QT.$${MODULE}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
"QT.$${MODULE}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
"QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
"" \
"QT.$${MODULE}.name = $$TARGET" \
"QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \
"QT.$${MODULE}.includes = $$MODULE_INCLUDES" \
"QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES" \
"QT.$${MODULE}.libs = \$\$QT_MODULE_LIB_BASE" \
"QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
$$module_rpath \
"QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
"QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \
"QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" \
"QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
$$module_privdep \
$$module_rundep \
$$module_build_type \
$$module_config \
"QT.$${MODULE}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting
"" \
"QT_CONFIG += $$MODULE" # this is obsolete, but some code still depends on it
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.")
MODULE_PRI_FILES = $$MODULE_PRI
prefix_build {
# Create a forwarding module .pri file
MODULE_FWD_PRI_CONT = \
"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_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \
"QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \
"include($$MODULE_PRI)"
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
} else { # prefix_build
# This is needed for the direct include() below.
QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS]
QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS]
QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS]
QT_MODULE_QML_BASE = $$[QT_INSTALL_QML]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS]
QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS]
}
# Then, inject the new module into the current cache state
!contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI): \ # before the actual include()!
cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES)
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 libexecs plugins imports qml \
rpath_link rpath_link_private \
)):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