summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2016-10-21 16:41:08 +0200
committerMichal Klocek <michal.klocek@qt.io>2016-11-30 10:41:50 +0000
commit15a38cb07539dce2b6f7e9008d79e2b7335d3289 (patch)
tree8900444e4aff22619864a6ab07eed81ae995dfdd
parentf2f20462e146508868d488f9bc370c53e000d2d9 (diff)
Add support for system based ninja
Adds system-ninja feature, which is enabled if ninja is found in system path. Change-Id: Icc58bc252d67a27f80c139349be28f9fd239108a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--configure.json15
-rw-r--r--configure.pri12
-rw-r--r--src/core/gyp_run.pro11
-rw-r--r--tools/qmake/mkspecs/features/functions.prf19
4 files changed, 44 insertions, 13 deletions
diff --git a/configure.json b/configure.json
index 63abd1dba..66d568de9 100644
--- a/configure.json
+++ b/configure.json
@@ -8,6 +8,13 @@
}
},
+ "tests" : {
+ "ninja": {
+ "label": "system ninja",
+ "type": "detectNinja"
+ }
+ },
+
"features": {
"proprietary-codecs": {
"label": "Proprietary Codecs",
@@ -19,6 +26,11 @@
"label": "Spellchecker",
"purpose": "Enables the use of Chromium's spellchecker",
"output": [ "privateFeature" ]
+ },
+ "system-ninja": {
+ "label": "Using system ninja",
+ "condition": "tests.ninja",
+ "output": [ "privateFeature" ]
}
},
@@ -27,7 +39,8 @@
"section": "Qt WebEngine",
"entries": [
"proprietary-codecs",
- "spellchecker"
+ "spellchecker",
+ "system-ninja"
]
}
]
diff --git a/configure.pri b/configure.pri
new file mode 100644
index 000000000..dee7847b7
--- /dev/null
+++ b/configure.pri
@@ -0,0 +1,12 @@
+
+defineTest(qtConfTest_detectNinja) {
+ ninja = $$qtConfFindInPath("ninja")
+ !isEmpty(ninja) {
+ qtLog("Found ninja from path: $$ninja")
+ qtRunLoggedCommand("$$ninja --version", version)|return(false)
+ contains(version, "1.*"): return(true)
+ qtLog("Ninja version too old")
+ }
+ qtLog("Building own ninja")
+ return(false)
+}
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index 1850447e7..7351b2443 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -2,6 +2,11 @@
# 1) invoking gyp through the gyp_qtwebengine script, which in turn makes use of the generated gypi include files
# 2) produce a Makefile that will run ninja, and take care of actually building everything.
+isQtMinimum(5, 8) {
+ include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+ QT_FOR_CONFIG += webengine-private
+}
+
TEMPLATE = aux
cross_compile {
@@ -148,8 +153,12 @@ for (config, GYP_CONFIG): GYP_ARGS += "-D $$config"
}
build_pass|!debug_and_release {
+
+ ninja_binary = ninja
ninja.target = invoke_ninja
- ninja.commands = $$findOrBuildNinja() \$\(NINJAFLAGS\) -C "$$OUT_PWD/$$getConfigDir()"
+
+ !qtConfig(system-ninja): ninja_binary = $$shell_quote($$shell_path($$buildNinja()))
+ ninja.commands = $$ninja_binary \$\(NINJAFLAGS\) -C $$shell_quote($$OUT_PWD/$$getConfigDir())
QMAKE_EXTRA_TARGETS += ninja
build_pass:build_all: default_target.target = all
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf
index 6ee9be57d..d0a922f9c 100644
--- a/tools/qmake/mkspecs/features/functions.prf
+++ b/tools/qmake/mkspecs/features/functions.prf
@@ -368,24 +368,21 @@ defineTest(use?) {
return(false)
}
-defineReplace(findOrBuildNinja) {
- # If NINJA_PATH env var is set, prefer that.
- # Fallback to locating our own bootstrapped ninja.
- out = $(NINJA_PATH)
- !exists($$out) {
+defineReplace(buildNinja) {
+
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir))
win32: out = $${out}.exe
- # If we did not find ninja, then we bootstrap it.
+ # check if it is not already built
!exists($$out) {
- mkpath($$dirname(out))
- ninja_configure = $$absolute_path(ninja/configure.py, $$src_3rd_party_dir)
- system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$system_path($$ninja_configure)) --bootstrap")
+ mkpath($$dirname(out))
+ ninja_configure = $$absolute_path(ninja/configure.py, $$src_3rd_party_dir)
+ system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$system_path($$ninja_configure)) --bootstrap")
}
- }
- return($$system_path($$out))
+
+ return($$out)
}
defineTest(skipBuild) {