add configure test result caching
Started-by: Lars Knoll <lars.knoll@qt.io> Change-Id: I29bafc5913cf95d9908dbcdd9597df2258b69837 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
b62a42dde1
commit
ce7df6ac7d
@ -58,6 +58,9 @@ Configure meta:
|
||||
-redo ................ Re-configure with previously used options.
|
||||
Additional options may be passed, but will not be
|
||||
saved for later use by -redo.
|
||||
-recheck ............. Discard cached negative configure test results.
|
||||
Use this after installing missing dependencies.
|
||||
-recheck-all ......... Discard all cached configure test results.
|
||||
|
||||
Build options:
|
||||
|
||||
|
@ -92,6 +92,8 @@ defineTest(qtConfTest_architecture) {
|
||||
export($${1}.subarch)
|
||||
qtLog("Detected architecture: $$eval($${1}.arch) ($$eval($${1}.subarch))")
|
||||
|
||||
$${1}.cache += arch subarch
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
@ -182,9 +184,12 @@ defineTest(qtConfTest_detectPkgConfig) {
|
||||
export($${1}.pkgConfigLibdir)
|
||||
$${1}.pkgConfigSysrootDir = $$pkgConfigSysrootDir
|
||||
export($${1}.pkgConfigSysrootDir)
|
||||
$${1}.cache += pkgConfigLibdir pkgConfigSysrootDir
|
||||
}
|
||||
$${1}.pkgConfig = $$pkgConfig
|
||||
export($${1}.pkgConfig)
|
||||
$${1}.cache += pkgConfig
|
||||
export($${1}.cache)
|
||||
|
||||
PKG_CONFIG = $$pkgConfig
|
||||
export(PKG_CONFIG)
|
||||
@ -215,6 +220,8 @@ defineTest(qtConfTest_skipModules) {
|
||||
}
|
||||
$${1}.value = $$unique(skip)
|
||||
export($${1}.value)
|
||||
$${1}.cache += value
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
@ -236,6 +243,8 @@ defineTest(qtConfTest_buildParts) {
|
||||
|
||||
$${1}.value = $$parts
|
||||
export($${1}.value)
|
||||
$${1}.cache += value
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
@ -283,6 +292,8 @@ defineTest(qtConfTest_checkCompiler) {
|
||||
export($${1}.compilerDescription)
|
||||
export($${1}.compilerId)
|
||||
export($${1}.compilerVersion)
|
||||
$${1}.cache += compilerDescription compilerId compilerVersion
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
@ -409,6 +420,8 @@ defineTest(qtConfTest_xkbConfigRoot) {
|
||||
exists($$dir) {
|
||||
$${1}.value = $$dir
|
||||
export($${1}.value)
|
||||
$${1}.cache += value
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
}
|
||||
@ -434,6 +447,8 @@ defineTest(qtConfTest_qpaDefaultPlatform) {
|
||||
export($${1}.value)
|
||||
export($${1}.plugin)
|
||||
export($${1}.name)
|
||||
$${1}.cache += value plugin name
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
CONFIG -= qt debug_and_release
|
||||
load(configure_base)
|
||||
|
||||
QMAKE_CONFIG_CACHE = $$dirname(_QMAKE_CACHE_)/config.cache
|
||||
QMAKE_CONFIG_CACHE_USE = all
|
||||
|
||||
QT_CONFIGURE_REPORT =
|
||||
QT_CONFIGURE_NOTES =
|
||||
QT_CONFIGURE_WARNINGS =
|
||||
@ -198,6 +201,17 @@ defineTest(qtConfParseCommandLine) {
|
||||
next()
|
||||
}
|
||||
|
||||
contains(c, "^--?recheck") {
|
||||
QMAKE_CONFIG_CACHE_USE = positive
|
||||
export(QMAKE_CONFIG_CACHE_USE)
|
||||
next()
|
||||
}
|
||||
contains(c, "^--?recheck-all") {
|
||||
QMAKE_CONFIG_CACHE_USE = none
|
||||
export(QMAKE_CONFIG_CACHE_USE)
|
||||
next()
|
||||
}
|
||||
|
||||
!isEmpty(customCall) {
|
||||
$${customCall}($$c): \
|
||||
next()
|
||||
@ -499,6 +513,8 @@ defineTest(qtConfTest_getPkgConfigVariable) {
|
||||
variable = $$eval($${1}.pkg-config-variable)
|
||||
qtRunLoggedCommand("$$pkg_config --variable=$$variable $$args", $${1}.value)|return(false)
|
||||
export($${1}.value)
|
||||
$${1}.cache += value
|
||||
export($${1}.cache)
|
||||
return(true)
|
||||
}
|
||||
|
||||
@ -562,6 +578,11 @@ defineTest(qtConfHandleLibrary) {
|
||||
|
||||
qtConfEnsureTestTypeDeps("library")
|
||||
|
||||
qtConfLoadResult($${lpfx}, $$1) {
|
||||
qtConfExportLibrary($${lpfx}.sources.$$eval($${lpfx}.source), $$eval($${lpfx}.export))
|
||||
return()
|
||||
}
|
||||
|
||||
qtLogTestIntro($${lpfx})
|
||||
msg = "looking for library $${1}"
|
||||
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
||||
@ -596,6 +617,12 @@ defineTest(qtConfHandleLibrary) {
|
||||
}
|
||||
}
|
||||
|
||||
$${lpfx}.cache += source
|
||||
for (v, $$list(libs includes cflags version export)): \
|
||||
$${lpfx}.cache += sources.$${s}.$${v}
|
||||
for (b, $${spfx}.builds._KEYS_): \
|
||||
$${lpfx}.cache += sources.$${s}.builds.$${b}
|
||||
|
||||
# immediately output the library as well.
|
||||
qtConfExportLibrary($${spfx}, $$eval($${lpfx}.export))
|
||||
|
||||
@ -609,6 +636,7 @@ defineTest(qtConfHandleLibrary) {
|
||||
|
||||
$${lpfx}.result = $$result
|
||||
export($${lpfx}.result)
|
||||
qtConfSaveResult($${lpfx}, $$1)
|
||||
}
|
||||
|
||||
# This is a fake test type for the test dependency system.
|
||||
@ -760,6 +788,28 @@ defineTest(qtLogTestResult) {
|
||||
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
||||
}
|
||||
|
||||
defineTest(qtConfSaveResult) {
|
||||
keys = result $$eval($${1}.cache)
|
||||
cont = "cache.$${2}._KEYS_ = $$keys"
|
||||
for (k, keys): \
|
||||
cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
|
||||
write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
|
||||
}
|
||||
|
||||
defineTest(qtConfLoadResult) {
|
||||
equals(QMAKE_CONFIG_CACHE_USE, none): \
|
||||
return(false)
|
||||
isEmpty(cache.$${2}._KEYS_): \
|
||||
return(false)
|
||||
equals(QMAKE_CONFIG_CACHE_USE, positive):!$$eval(cache.$${2}.result): \
|
||||
return(false)
|
||||
for (k, cache.$${2}._KEYS_) {
|
||||
$${1}.$${k} = $$eval(cache.$${2}.$${k})
|
||||
export($${1}.$${k})
|
||||
}
|
||||
return(true)
|
||||
}
|
||||
|
||||
defineTest(qtConfIsBoolean) {
|
||||
equals(1, "true")|equals(1, "false"): \
|
||||
return(true)
|
||||
@ -832,6 +882,12 @@ defineTest(qtRunSingleTest) {
|
||||
!$${preCall}($${tpfx}): result = false
|
||||
|
||||
$$result {
|
||||
# note: we do this only after resolving the dependencies and the
|
||||
# preparation (which may resolve libraries), so that caching does
|
||||
# not alter the execution order (and thus the output).
|
||||
qtConfLoadResult($${tpfx}, $$1): \
|
||||
return()
|
||||
|
||||
qtLogTestIntro($${tpfx})
|
||||
msg = "executing config test $${1}"
|
||||
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
||||
@ -843,6 +899,7 @@ defineTest(qtRunSingleTest) {
|
||||
|
||||
$${tpfx}.result = $$result
|
||||
export($${tpfx}.result)
|
||||
qtConfSaveResult($${tpfx}, $$1)
|
||||
}
|
||||
|
||||
defineReplace(qtConfEvaluate) {
|
||||
@ -1496,6 +1553,20 @@ defineTest(qtConfigure) {
|
||||
|
||||
qtConfParseCommandLine()
|
||||
|
||||
!equals(QMAKE_CONFIG_CACHE_USE, none) {
|
||||
include($$QMAKE_CONFIG_CACHE, , true)
|
||||
# this crudely determines when to discard the cache. this also catches the case
|
||||
# of no cache being there in the first place.
|
||||
!equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]): \
|
||||
QMAKE_CONFIG_CACHE_USE = none
|
||||
}
|
||||
equals(QMAKE_CONFIG_CACHE_USE, none) {
|
||||
cont = \
|
||||
"cache.platform = $$[QMAKE_SPEC]" \
|
||||
"cache.xplatform = $$[QMAKE_XSPEC]"
|
||||
write_file($$QMAKE_CONFIG_CACHE, cont)
|
||||
}
|
||||
|
||||
# do early checks, mainly to validate the command line
|
||||
qtConfProcessEarlyChecks()
|
||||
|
||||
|
@ -24,6 +24,7 @@ DISTCLEAN_DEPS += qmake-clean
|
||||
# config.status (and configure.cache, which is the same for Windows)
|
||||
# are omitted for convenience of rebuilds.
|
||||
QMAKE_DISTCLEAN += \
|
||||
config.cache \
|
||||
config.summary \
|
||||
config.tests/.qmake.cache \
|
||||
mkspecs/qconfig.pri \
|
||||
|
Loading…
x
Reference in New Issue
Block a user