diff --git a/build/build.pro b/build/build.pro index a2fa634e6a08ef5b9c90cd9f543a2dcc708316d2..cd8384edd6f71dbd5038511b26340daaee64ba87 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 0f65c77aea0a1a888717b9ad601b9b22dc8e3590..40a125f14fd94592c6a0ad1d5e22dcd4897e0a40 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) } diff --git a/qtwebengine.pro b/qtwebengine.pro index 69bac5798c8397ad1a42b50743793526c5e300ec..c08945a44cbef5cecbf8eec7221f4468368a50de 100644 --- a/qtwebengine.pro +++ b/qtwebengine.pro @@ -10,13 +10,16 @@ SUBDIRS = shared \ build \ # This is where we use the generated qt_generated.gypi and run gyp example \ +# Ninja executable location needs to be determined early for extra targets. Should be fetched from cache most of the time anyway. +NINJA_EXECUTABLE = $$findNinja() + # Extra targets that invoke ninja on the desired configuration added for convenience release.target = release -release.commands = $$CHROMIUM_SRC_DIR/../depot_tools/ninja -C $$getOutDir()/Release +release.commands = $$NINJA_EXECUTABLE -C $$getOutDir()/Release release.depends: qmake debug.target = debug -debug.commands = $$CHROMIUM_SRC_DIR/../depot_tools/ninja -C $$getOutDir()/Debug +debug.commands = $$NINJA_EXECUTABLE -C $$getOutDir()/Debug debug.depends: qmake QMAKE_EXTRA_TARGETS += release \