2016-11-02 15:58:20 +00:00
|
|
|
# Ensure that a cache is present. If none was found on startup, this will create
|
|
|
|
# one in the build directory of the project which loads this feature.
|
|
|
|
cache()
|
|
|
|
|
2016-06-11 20:49:01 +00:00
|
|
|
load(configure_base)
|
2012-04-05 14:47:35 +00:00
|
|
|
|
2016-11-02 16:08:26 +00:00
|
|
|
recheck: write_file($$QMAKE_CONFIG_LOG, "")
|
|
|
|
|
Modularize the new configure system (infrastructure part)
This change implements the required infrastructure to modularize the new
configuration system.
This requires a hierarchy of configuration files, both for handling
multiple repositories and for individual modules inside the same
repository.
When configuring, they all need to get loaded first, as command line
processing needs to know about all possible command line options.
When the command line has been processed, the individual configuration
files need to get processed one after the other and independently from
each other.
Configure is now automatically invoked when building the a project
tree's "root" project; this works with both modular and top-level builds
of Qt (the latter with an according change in the super repo). As an
immediate consequence, the -skip option moves to the super repo with a
different implementation, as configuration is now done after the repo
list is determined. The option belongs there anyway.
This commit also adds an optional testDir entry to the json file. Like
this, we can still have all configure tests in qtbase/config.tests and
the configuration file in, e.g., corelib can reference those.
The files section can now be left out as long as a 'module' entry is
present, specifying the module name. The names of the files to generate
can then be deduced from that name. We still need to be able to specify
names directly for the global configuration files.
qtConfig() now also queries features which are module-specific. As it is
sometimes necessary to query the configuration of modules which should
not be actually linked (and cannot in the case of subdirs projects), the
new variable QT_FOR_CONFIG which allows specifying configuration-only
dependencies is introduced.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: Id1b518a3aa34044748b87fb8fac14d79653f6b18
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-25 13:45:44 +00:00
|
|
|
isEmpty(QMAKE_CONFIG_TESTS_DIR): QMAKE_CONFIG_TESTS_DIR = $$_PRO_FILE_PWD_/config.tests
|
|
|
|
|
2012-04-05 14:47:35 +00:00
|
|
|
# Try to build the test project in $$QMAKE_CONFIG_TESTS_DIR/$$1
|
|
|
|
# ($$_PRO_FILE_PWD_/config.tests/$$1 by default).
|
|
|
|
#
|
|
|
|
# If the test passes, config_$$1 will be added to CONFIG.
|
|
|
|
# The result is automatically cached. Use of cached results
|
|
|
|
# can be suppressed by passing CONFIG+=recheck to qmake.
|
|
|
|
#
|
|
|
|
# Returns: true iff the test passes
|
|
|
|
defineTest(qtCompileTest) {
|
|
|
|
positive = config_$$1
|
|
|
|
done = done_config_$$1
|
|
|
|
|
|
|
|
$$done:!recheck {
|
|
|
|
$$positive:return(true)
|
|
|
|
return(false)
|
|
|
|
}
|
|
|
|
|
|
|
|
log("Checking for $${1}... ")
|
|
|
|
msg = "executing config test $$1"
|
|
|
|
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
|
|
|
|
|
|
|
test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$1
|
|
|
|
test_out_dir = $$shadowed($$test_dir)
|
2016-11-11 09:02:34 +00:00
|
|
|
test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&"
|
2012-04-05 14:47:35 +00:00
|
|
|
|
|
|
|
# Disable qmake features which are typically counterproductive for tests
|
|
|
|
qmake_configs = "\"CONFIG -= qt debug_and_release app_bundle lib_bundle\""
|
|
|
|
|
2013-11-05 19:36:01 +00:00
|
|
|
# On WinRT we need to change the entry point as we cannot create windows
|
|
|
|
# applications
|
|
|
|
winrt {
|
|
|
|
qmake_configs += " \"QMAKE_LFLAGS+=/ENTRY:main\""
|
|
|
|
}
|
|
|
|
|
2012-04-05 14:47:35 +00:00
|
|
|
# Clean up after previous run
|
|
|
|
exists($$test_out_dir/Makefile):qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE distclean")
|
|
|
|
|
2016-07-14 14:50:02 +00:00
|
|
|
mkpath($$test_out_dir)|error()
|
2012-04-05 14:47:35 +00:00
|
|
|
|
2015-07-13 09:21:22 +00:00
|
|
|
!isEmpty (QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF
|
|
|
|
|
|
|
|
qtRunLoggedCommand("$$test_cmd_base $$system_quote($$system_path($$QMAKE_QMAKE)) $$qtconfarg -spec $$QMAKESPEC $$qmake_configs $$shell_quote($$test_dir)") {
|
2012-04-05 14:47:35 +00:00
|
|
|
qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE") {
|
|
|
|
log("yes$$escape_expand(\\n)")
|
|
|
|
msg = "test $$1 succeeded"
|
|
|
|
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
|
|
|
|
|
|
|
!$$positive {
|
|
|
|
CONFIG += $$positive
|
|
|
|
cache(CONFIG, add, positive)
|
|
|
|
}
|
|
|
|
!$$done {
|
|
|
|
CONFIG += $$done
|
|
|
|
cache(CONFIG, add, done)
|
|
|
|
}
|
|
|
|
export(CONFIG)
|
|
|
|
return(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log("no$$escape_expand(\\n)")
|
|
|
|
msg = "test $$1 FAILED"
|
|
|
|
write_file($$QMAKE_CONFIG_LOG, msg, append)
|
|
|
|
|
|
|
|
$$positive {
|
|
|
|
CONFIG -= $$positive
|
|
|
|
cache(CONFIG, sub, positive)
|
|
|
|
}
|
|
|
|
!$$done {
|
|
|
|
CONFIG += $$done
|
|
|
|
cache(CONFIG, add, done)
|
|
|
|
}
|
|
|
|
export(CONFIG)
|
|
|
|
return(false)
|
|
|
|
}
|