add support for QT_PRIVATE

this is handled the same way as the QT variable, only that the actual
libraries end up in LIBS_PRIVATE, not LIBS, which means they don't end up
in prl files.

the handling of the two variables is entirely independent, including
independent dependency resolution, so some libraries will typically end
up twice on the linker command line. this is not a problem.

Change-Id: I257ad0d414bf273c08a7bd6a874fe9ddb7356009
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-08-02 16:09:04 +02:00 committed by Qt by Nokia
parent c292f1dc8a
commit 3dfb362782
2 changed files with 43 additions and 35 deletions

View File

@ -135,40 +135,9 @@ uitools {
QT += uitools
}
# Figure out from which modules we're wanting to use the private headers
unset(using_privates)
NEWQT =
for(QTLIB, QT) {
QTLIBRAW = $$replace(QTLIB, -private$, )
!isEqual(QTLIBRAW, $$QTLIB) {
want_var = QT.$${QTLIBRAW}.want_private
$$want_var = UsePrivate
using_privates = true
NEWQT += $$eval(QT.$${QTLIBRAW}.private_depends)
}
NEWQT += $$QTLIBRAW
contains(QT.$${QTLIBRAW}.CONFIG, auto_use_privates): CONFIG += auto_use_privates
}
# Topological resolution of modules based on their QT.<module>.depends variable
QT = $$resolve_depends(NEWQT, "QT.")
# Finally actually add the modules
unset(BAD_QT)
for(QTLIB, QT) {
QTLIBNAME = $$eval(QT.$${QTLIB}.name)
isEmpty(QTLIBNAME) {
BAD_QT += $$QTLIB
next()
}
target_qt:isEqual(TARGET, $$QTLIBNAME) {
warning($$TARGET cannot have a QT of $$QTLIB)
next()
}
qtAddModule($$QTLIB, $$eval(QT.$${QTLIB}.want_private))
}
!isEmpty(BAD_QT):error("Unknown module(s) in QT: $$BAD_QT")
qtAddModules(QT, LIBS)
qtAddModules(QT_PRIVATE, LIBS_PRIVATE)
!isEmpty(using_privates):!auto_use_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.")

View File

@ -35,6 +35,7 @@ defineTest(qtAddLibrary) {
error("No module matching library '$$1' found.")
}
# qt module, UsePrivate flag, libs variable
defineTest(qtAddModule) {
MODULE_NAME = $$eval(QT.$${1}.name)
MODULE_INCLUDES = $$eval(QT.$${1}.includes)
@ -102,11 +103,11 @@ defineTest(qtAddModule) {
QMAKE_LIBDIR *= /opt/lsb/lib
QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX}
}
LIBS += $$LINKAGE
$$3 += $$LINKAGE
}
export(CONFIG)
export(DEFINES)
export(LIBS)
export($$3)
export(INCLUDEPATH)
export(QMAKE_FRAMEWORKPATH)
export(QMAKE_LFLAGS)
@ -114,6 +115,44 @@ defineTest(qtAddModule) {
return(true)
}
# qt variable, libs variable
defineTest(qtAddModules) {
# Figure out from which modules we're wanting to use the private headers
NEWQT =
for(QTLIB, $$1) {
QTLIBRAW = $$replace(QTLIB, -private$, )
!isEqual(QTLIBRAW, $$QTLIB) {
want_var = QT.$${QTLIBRAW}.want_private
$$want_var = UsePrivate
using_privates = true
NEWQT += $$eval(QT.$${QTLIBRAW}.private_depends)
}
NEWQT += $$QTLIBRAW
contains(QT.$${QTLIBRAW}.CONFIG, auto_use_privates): CONFIG += auto_use_privates
}
# Topological resolution of modules based on their QT.<module>.depends variable
$$1 = $$resolve_depends(NEWQT, "QT.")
# Finally actually add the modules
unset(BAD_QT)
for(QTLIB, $$1) {
QTLIBNAME = $$eval(QT.$${QTLIB}.name)
isEmpty(QTLIBNAME) {
BAD_QT += $$QTLIB
next()
}
target_qt:isEqual(TARGET, $$QTLIBNAME) {
warning("$$TARGET cannot have a $$1 of $$QTLIB")
next()
}
qtAddModule($$QTLIB, $$eval(QT.$${QTLIB}.want_private), $$2)
}
!isEmpty(BAD_QT):error("Unknown module(s) in QT: $$BAD_QT")
export(using_privates)
}
# variable, default
defineTest(qtPrepareTool) {
$$1 = $$eval(QT_TOOL.$${2}.binary)