Skip to content

Commit 5a8bae7

Browse files
author
Michael Bruning
committed
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 <[email protected]>
1 parent dacb7fa commit 5a8bae7

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

tools/qmake/mkspecs/features/functions.prf

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,30 @@ defineReplace(which) {
150150
}
151151

152152
defineReplace(findOrBuildNinja) {
153-
# If NINJA_PATH env var is set, prefer that.
154-
# Fallback to locating our own bootstrapped ninja.
155-
out = $(NINJA_PATH)
156-
!exists($$out) {
157-
out = $$absolute_path("$${getChromiumSrcDir()}/../ninja/ninja", "$$QTWEBENGINE_ROOT")
158-
win32: out = $$system_path($${out}.exe)
153+
# If NINJA_PATH env var is set, prefer that.
154+
# Fallback to locating our own bootstrapped ninja.
155+
out = $(NINJA_PATH)
156+
!exists($$out) {
157+
src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT")
158+
159+
out = $$shadowed($$absolute_path("ninja/ninja", "$$src_3rd_party_dir"))
160+
win32: out = $${out}.exe
159161

160-
# If we did not find ninja, then we bootstrap it.
161-
!exists($$out): system("cd $$dirname(out) && python configure.py --bootstrap")
162+
out = $$system_path($$out)
163+
# If we did not find ninja, then we bootstrap it.
164+
!exists($$out) {
165+
# If we are making a shadow build, copy the ninja sources to the build directory.
166+
!equals(PWD, $${OUT_PWD}) {
167+
log("Build directory is different from source directory - copying ninja sources to the build tree...")
168+
shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir))
169+
170+
!exists($$dirname(out)): mkpath($$shadow_3rd_party_path)
171+
system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)")
172+
}
173+
system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap")
162174
}
163-
return($$out)
175+
}
176+
return($$out)
164177
}
165178

166179
defineTest(skipBuild) {

0 commit comments

Comments
 (0)