From 3dfb362782718610ec237f5a8d7ebff759d5fc7b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 2 Aug 2012 16:09:04 +0200 Subject: add support for QT_PRIVATE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Joerg Bornemann Reviewed-by: Tor Arne Vestbø Reviewed-by: Marius Storm-Olsen --- mkspecs/features/qt.prf | 35 ++----------------------------- mkspecs/features/qt_functions.prf | 43 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 35 deletions(-) (limited to 'mkspecs') diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index eaedc55864..8f797a5960 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -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..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.") diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 3517e695a5..7a13f9feca 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -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..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) -- cgit v1.2.3