summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/configure_base.prf
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-06-11 22:49:01 +0200
committerLars Knoll <lars.knoll@qt.io>2016-06-22 14:19:35 +0000
commit90eee08b3e672573e3ad93470d844e1d498651dd (patch)
tree9ca70291ea9e9c2ca46f80a31e690f6eabcab2f3 /mkspecs/features/configure_base.prf
parent71224ccc86c2d2b4c6e2bb2b61de9b1cf4efa3a2 (diff)
Let qmake do most of the work of configuring Qt
Command line arguments, configure tests and features are now defined in a json file and a configure.pri containing some custom functions. qmake uses the json file to determine command line arguments, tests and features to be executed at configuration time. A new qt_configure.prf contains all the infrastructure to parse the command line, run the configure tests, determine the set of available features and create a report about it. Change-Id: If30ac089dd3e9f8c67ebd642bde10cfa960893bb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'mkspecs/features/configure_base.prf')
-rw-r--r--mkspecs/features/configure_base.prf44
1 files changed, 44 insertions, 0 deletions
diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf
new file mode 100644
index 0000000000..ed2f599bb0
--- /dev/null
+++ b/mkspecs/features/configure_base.prf
@@ -0,0 +1,44 @@
+QMAKE_MAKE = $$(MAKE)
+!isEmpty(QMAKE_MAKE) {
+ # We were called recursively. Use the right make, as MAKEFLAGS may be set as well.
+} else: if(equals(MAKEFILE_GENERATOR, UNIX)|equals(MAKEFILE_GENERATOR, MINGW)) {
+ !equals(QMAKE_HOST.os, Windows): \
+ QMAKE_MAKE = make
+ else: \
+ QMAKE_MAKE = mingw32-make
+} else: if(equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)) {
+ QMAKE_MAKE = nmake
+} else {
+ error("Configure tests are not supported with the $$MAKEFILE_GENERATOR Makefile generator.")
+}
+
+isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false
+
+defineTest(qtLog) {
+ msg = "+ $$1"
+ write_file($$QMAKE_CONFIG_LOG, msg, append)
+ $$QMAKE_CONFIG_VERBOSE: log("$$msg$$escape_expand(\\n)")
+}
+
+defineTest(qtRunLoggedCommand) {
+ qtLog($$1)
+ write_file($${QMAKE_CONFIG_LOG}.part, "")
+ result = false
+ system("$$1 > \"$${QMAKE_CONFIG_LOG}.part\" 2>&1"): result = true
+
+ output = $$cat($${QMAKE_CONFIG_LOG}.part, blob)
+
+ write_file($${QMAKE_CONFIG_LOG}, output, append)
+ $$QMAKE_CONFIG_VERBOSE: log($$output)
+
+ return($$result)
+}
+
+isEmpty(QMAKE_CONFIG_TESTS_DIR): QMAKE_CONFIG_TESTS_DIR = $$_PRO_FILE_PWD_/config.tests
+
+# 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()
+
+QMAKE_CONFIG_LOG = $$dirname(_QMAKE_CACHE_)/config.log
+write_file($$QMAKE_CONFIG_LOG, "")