From 0346d605e3dc3e00f1dc55a16697a5316eb8e6e2 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Tue, 12 Jun 2012 12:30:13 +0100 Subject: [PATCH] Do not add debug/release to QMAKE_CONFIG. Let module system enable them This solved QTBUG-26111 in which qtjsbackend gets built with an incomplete framework on Mac OSX. This was traced back to commit 6a6fd56e662b2c1a581727f7ec44d5bd60913ad4 which moved QMAKE_CONFIG values from .qmake.cache to mkspecs/qmodule.pri. Since qtjsbackend contains config tests it creates its own .qmake.cache which was previously masking this issue. QMAKE_CONFIG incorrectly contained debug for debug_and_release builds even though debug and release are already present in the CONFIG variable in mkspecs/qconfig.pri. The changes to configure prevent CONFIG in qmodule.pri from containing debug and release variables and ensure that QT_CONFIG contains build_all and debug_and_release if appropriate. Configure.app is also adjusted to match this behaviour. The other part of the change is to qt_module_config.prf and qt_plugin.prf. These changes take care of populating CONFIG with the appropriate debug_and_release and build_all variables depending upon what is present in QT_CONFIG. This ensures that the Qt modules and plugins get built with the same configuration as qtbase. The special handling for the qcocoa QPA plugin ensures that it is built in release mode only to preserve the behaviour introduced by commit 5603f94eaa538dbe28fc426065d65a27799adedc. Task-number: QTBUG-26111 Change-Id: I6f65aba50709e1b2431b8b4411ff30a06f7d8aed Reviewed-by: Oswald Buddenhagen --- configure | 4 +--- mkspecs/features/qt_module_config.prf | 13 ++++++++----- mkspecs/features/qt_plugin.prf | 5 ++++- src/plugins/platforms/cocoa/cocoa.pro | 2 ++ tools/configure/configureapp.cpp | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 13449ca2c9..1bb7bb9bf6 100755 --- a/configure +++ b/configure @@ -2472,7 +2472,7 @@ if [ "$CFG_DEBUG" = "auto" ]; then fi fi if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then - QT_CONFIG="$QT_CONFIG build_all" + QT_CONFIG="$QT_CONFIG build_all debug_and_release" fi # pass on $CFG_SDK to the configure tests. @@ -5097,10 +5097,8 @@ fi # build up the variables for output if [ "$CFG_DEBUG" = "yes" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}debug" - QMAKE_CONFIG="$QMAKE_CONFIG debug" elif [ "$CFG_DEBUG" = "no" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}release" - QMAKE_CONFIG="$QMAKE_CONFIG release" fi if [ "$CFG_SHARED" = "yes" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared" diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf index b6b0c2ca37..06c5512a40 100644 --- a/mkspecs/features/qt_module_config.prf +++ b/mkspecs/features/qt_module_config.prf @@ -39,7 +39,13 @@ win32:!wince*:DLLDESTDIR = $$[QT_INSTALL_PREFIX]/bin CONFIG += qt warn_on depend_includepath CONFIG += qmake_cache target_qt CONFIG -= fix_output_dirs -win32|mac:!macx-xcode:CONFIG += debug_and_release + +# If Qt was configured with -debug-and-release then build the module the same way +if(win32|mac):!wince*:!macx-xcode { + contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release + contains(QT_CONFIG, build_all):CONFIG += build_all +} + linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF !isEmpty(DESTDIR):CONFIG += create_cmake @@ -47,7 +53,6 @@ linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions contains(QT_CONFIG, largefile):CONFIG += largefile -contains(QT_CONFIG, build_all):CONFIG += build_all contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info contains(QT_CONFIG, separate_debug_info_nocopy):CONFIG += separate_debug_info_nocopy contains(QT_CONFIG, c++11):CONFIG += c++11 @@ -56,9 +61,7 @@ contains(QT_CONFIG, c++11):CONFIG += c++11 mac:!static:contains(QT_CONFIG, qt_framework) { #QMAKE_FRAMEWORK_VERSION = 4.0 CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework - CONFIG(debug, debug|release) { - !build_pass:CONFIG += build_all - } else { #release + CONFIG(release, debug|release) { !debug_and_release|build_pass { CONFIG -= qt_install_headers #no need to install these as well FRAMEWORK_HEADERS.version = Versions diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 768918f65b..32994f39f1 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -6,7 +6,10 @@ isEmpty(QT_MAJOR_VERSION) { } CONFIG += qt plugin -win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release +if(win32|mac):!wince*:!macx-xcode { + contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release + contains(QT_CONFIG, build_all):CONFIG += build_all +} TARGET = $$qtLibraryTarget($$TARGET) contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols contains(QT_CONFIG, separate_debug_info):CONFIG += separate_debug_info diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index bfe757046e..ac79ccc414 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -96,6 +96,8 @@ INSTALLS += target # The Qt plugin loader will dlopen both if found, causing duplicate # Objective-c class definitions for the classes defined in the plugin. contains(QT_CONFIG,release):CONFIG -= debug +contains(QT_CONFIG,debug_and_release):CONFIG -= debug_and_release +contains(QT_CONFIG,build_all):CONFIG -= build_all # Acccessibility debug support # DEFINES += QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 84d759ba33..ba50d9604c 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2194,11 +2194,11 @@ void Configure::generateOutputVars() bool buildAll = (dictionary[ "BUILDALL" ] == "yes"); if (build == "debug") { if (buildAll) - qtConfig += "release"; + qtConfig += "debug_and_release build_all release"; qtConfig += "debug"; } else if (build == "release") { if (buildAll) - qtConfig += "debug"; + qtConfig += "debug_and_release build_all debug"; qtConfig += "release"; }