From b9a578ebc604e5f919c633ec8bee99aa8d21071d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 23 Nov 2017 21:20:32 +0100 Subject: configure: change convention of passing libraries to config tests instead of pre-resolving them and passing the final LIBS to qmake, pass raw QMAKE_*_LIBS* assignments and a QMAKE_USE stanza. the immediate benefit of that is that it centralizes the debug/release lib handling, which makes build variant overrides available to all libraries, not just a few selected ones. note that this removes the CONFIG+=build_all from the test projects. turns out that this was ineffective to start with, as config tests are built with an explicit CONFIG-=debug_and_release. we might re-instate it in a non-broken way later on. Change-Id: I2117c5b36937e8230bd571dcee83231515cbe30b Reviewed-by: Joerg Bornemann --- configure.json | 9 +------- mkspecs/features/qt_configure.prf | 46 ++++++++++++++++++++++++++------------- src/corelib/configure.json | 7 ------ 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/configure.json b/configure.json index 6e48f5da61..276af319ac 100644 --- a/configure.json +++ b/configure.json @@ -168,14 +168,7 @@ "label": "D-Bus >= 1.2", "test": { "include": "dbus/dbus.h", - "main": "(void) dbus_bus_get_private(DBUS_BUS_SYSTEM, (DBusError *)NULL);", - "qmake": [ - "CONFIG += build_all", - "CONFIG(debug, debug|release): \\", - " LIBS += $$LIBS_DEBUG", - "else: \\", - " LIBS += $$LIBS_RELEASE" - ] + "main": "(void) dbus_bus_get_private(DBUS_BUS_SYSTEM, (DBusError *)NULL);" }, "sources": [ { "type": "pkgConfig", "args": "dbus-1 >= 1.2" }, diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 69a2fa14f1..ba30dad2cc 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -624,21 +624,35 @@ defineTest(qtConfTest_getPkgConfigVariable) { } defineReplace(qtConfLibraryArgs) { - qmake_args = - libs = $$eval($${1}.libs) - !isEmpty(libs): \ - qmake_args += "LIBS += $$libs" + NAME = $$upper($$eval($${1}.library)) + qmake_args = "QMAKE_LIBS_$${NAME} = $$eval($${1}.libs)" for (b, $${1}.builds._KEYS_): \ - qmake_args += "LIBS_$$upper($$b) += $$eval($${1}.builds.$${b})" + qmake_args += "QMAKE_LIBS_$${NAME}_$$upper($$b) = $$eval($${1}.builds.$${b})" includedir = $$eval($${1}.includedir) !isEmpty(includedir): \ - qmake_args += "INCLUDEPATH *= $$includedir" + qmake_args += "QMAKE_INCDIR_$${NAME} = $$includedir" cflags = $$eval($${1}.cflags) !isEmpty(cflags): \ qmake_args += "QMAKE_CFLAGS += $$cflags" "QMAKE_CXXFLAGS += $$cflags" return($$qmake_args) } +defineReplace(qtConfAllLibraryArgs) { + isEmpty(1): return() + dep_uses = + dep_args = + for (use, 1) { + use_cfg = $$section(use, :, 0, 0) + use_lib = $$section(use, :, 1, 1) + dep_uses += $$use_lib + !isEmpty(use_cfg) { + lpfx = $${use_cfg}.libraries.$$use_lib + dep_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + } + } + return("QMAKE_USE += $$dep_uses" $$dep_args) +} + defineTest(qtConfExportLibrary) { lpfx = $${currentConfig}.libraries.$$1 alias = $$eval($${lpfx}.alias) @@ -708,7 +722,7 @@ defineTest(qtConfHandleLibrary) { export($${lpfx}.result) return() } - use_args = $$eval($${lpfx}.literal_args) + resolved_uses = $$eval($${lpfx}.resolved_uses) qtConfLoadResult($${lpfx}, $$1, "library") { $$eval($${lpfx}.result): \ @@ -741,9 +755,12 @@ defineTest(qtConfHandleLibrary) { next() } + $${lpfx}.source = $$s + export($${lpfx}.source) + # if the library defines a test, use it to verify the source. !isEmpty($${lpfx}.test)|!isEmpty($${lpfx}.test._KEYS_) { - $${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx) $$use_args + $${lpfx}.resolved_uses = $$currentConfig:$$1 $$resolved_uses $${lpfx}.host = $$eval($${spfx}.host) !qtConfTest_compile($$lpfx) { qtLog(" => source failed verification.") @@ -759,9 +776,6 @@ defineTest(qtConfHandleLibrary) { for (b, $${spfx}.builds._KEYS_): \ $${lpfx}.cache += sources.$${s}.builds.$${b} - $${lpfx}.source = $$s - export($${lpfx}.source) - # immediately output the library as well. qtConfExportLibrary($$1) @@ -855,15 +869,15 @@ defineTest(qtConfTestPrepare_compile) { !defined(QMAKE_LIBS_$$nu, var): \ error("Test $$1 tries to use undeclared library '$$u'") # using an external library by exported name. - $${1}.literal_args += $$system_quote(QMAKE_USE += $$u) + $${1}.resolved_uses += :$$u } else { lpfx = $${libConfig}.libraries.$${u} - isEmpty($${lpfx}.source): \ + !equals($${lpfx}.result, true): \ return(false) - $${1}.literal_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + $${1}.resolved_uses += $$libConfig:$$u } } - export($${1}.literal_args) + export($${1}.resolved_uses) return(true) } @@ -991,6 +1005,8 @@ defineTest(qtConfTest_compile) { mkpath($$test_out_dir)|error() write_file($$test_base_out_dir/.qmake.cache)|error() + $${1}.literal_args += $$qtConfAllLibraryArgs($$eval($${1}.resolved_uses)) + # add possible command line args qmake_args += \ $$qtConfPrepareArgs($$eval($${1}.args)) \ diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 5e48024def..b03cf2f9d5 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -64,13 +64,6 @@ "UCollator *collator = ucol_open(\"ru_RU\", &status);", "if (!U_FAILURE(status))", " ucol_close(collator);" - ], - "qmake": [ - "CONFIG += build_all", - "CONFIG(debug, debug|release): \\", - " LIBS += $$LIBS_DEBUG", - "else: \\", - " LIBS += $$LIBS_RELEASE" ] }, "sources": [ -- cgit v1.2.3