summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2013-06-14 16:42:39 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-06-14 18:26:31 +0200
commit8fd262f1022990abb29b1523b612048fb13822b9 (patch)
treeec4fde9ff32f1586bde83aa5aa1ce169518ce4de /build
parent164650cd970a1884a758092b9a47c1639cbb96a2 (diff)
Make ninja detection a bit more robust
Having ninja in the PATH should be good enough. If that didn't work, we try to find it in the most logical location relative to CHROMIUM_SRC_DIR and bail out otherwise. Since it seems unlikely to vary, and can be convenient to keep persistent, we put it in .qmake.cache if qmake uses a cache.
Diffstat (limited to 'build')
-rw-r--r--build/build.pro2
-rw-r--r--build/qmake/mkspecs/features/functions.prf13
2 files changed, 13 insertions, 2 deletions
diff --git a/build/build.pro b/build/build.pro
index a2fa634e6..cd8384edd 100644
--- a/build/build.pro
+++ b/build/build.pro
@@ -9,7 +9,7 @@ GYP_OUTPUT = $$system(./gyp_qtwebengine)
message($$GYP_OUTPUT)
ninja.target = ninja
-ninja.commands = $$CHROMIUM_SRC_DIR/../depot_tools/ninja -C $$getOutDir()/$$getConfigDir()
+ninja.commands = $$findNinja() -C $$getOutDir()/$$getConfigDir()
ninja.depends: qmake
QMAKE_EXTRA_TARGETS += ninja
diff --git a/build/qmake/mkspecs/features/functions.prf b/build/qmake/mkspecs/features/functions.prf
index 0f65c77ae..40a125f14 100644
--- a/build/qmake/mkspecs/features/functions.prf
+++ b/build/qmake/mkspecs/features/functions.prf
@@ -32,5 +32,16 @@ defineReplace(mocOutput) {
# The order is important, since the output of the second replace would end up accidentaly transformed by the first one
out = $$replace(out, ^(.*)($$join(QMAKE_EXT_CPP,|)), $${QMAKE_CPP_MOD_MOC}\\1$${QMAKE_EXT_CPP_MOC})
out = $$replace(out, ^(.*)($$join(QMAKE_EXT_H,|)), $${QMAKE_H_MOD_MOC}\\1$${first(QMAKE_EXT_CPP)})
- return ($$out)
+ return($$out)
+}
+
+defineReplace(findNinja) {
+ !isEmpty(CACHED_NINJA_EXECUTABLE):exists($$CACHED_NINJA_EXECUTABLE): return($$CACHED_NINJA_EXECUTABLE)
+ out = $$system("which ninja 2>/dev/null")
+ # Try to be smart about it if we know where the chromium sources are located
+ isEmpty(CHROMIUM_SRC_DIR): message(foobar)
+ !exists($$out):!isEmpty(CHROMIUM_SRC_DIR): out = $$absolute_path("../depot_tools/ninja", $$CHROMIUM_SRC_DIR)
+ !exists($$out): error("Ninja executable can't be found.")
+ cache(CACHED_NINJA_EXECUTABLE, set, out)
+ return($$out)
}