From 5a8bae70bb6caf01c262ed3a607c736ea72561b9 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Mon, 16 Nov 2015 16:18:00 +0100 Subject: Build ninja in the shadow build directory. Essentially makes a copy of the ninja sources to the build directory to be non-intrusive for src/3rdparty. Task-number: QTBUG-44002 Change-Id: I82a686abbfab2579462dcb57e10b16f71a3a0d4e Reviewed-by: Joerg Bornemann --- tools/qmake/mkspecs/features/functions.prf | 31 +++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'tools/qmake') diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 64064bddb..cab79ff28 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -150,17 +150,30 @@ defineReplace(which) { } defineReplace(findOrBuildNinja) { - # If NINJA_PATH env var is set, prefer that. - # Fallback to locating our own bootstrapped ninja. - out = $(NINJA_PATH) - !exists($$out) { - out = $$absolute_path("$${getChromiumSrcDir()}/../ninja/ninja", "$$QTWEBENGINE_ROOT") - win32: out = $$system_path($${out}.exe) + # If NINJA_PATH env var is set, prefer that. + # Fallback to locating our own bootstrapped ninja. + out = $(NINJA_PATH) + !exists($$out) { + 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. - !exists($$out): system("cd $$dirname(out) && python configure.py --bootstrap") + out = $$system_path($$out) + # If we did not find ninja, then we bootstrap it. + !exists($$out) { + # If we are making a shadow build, copy the ninja sources to the build directory. + !equals(PWD, $${OUT_PWD}) { + log("Build directory is different from source directory - copying ninja sources to the build tree...") + shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir)) + + !exists($$dirname(out)): mkpath($$shadow_3rd_party_path) + system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)") + } + system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap") } - return($$out) + } + return($$out) } defineTest(skipBuild) { -- cgit v1.2.3