-
Pierre Rossi authored
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.
8fd262f1
# Map to the correct target type for gyp
defineReplace(toGypTargetType) {
equals(TEMPLATE, "app"):return("executable")
equals(TEMPLATE, "lib") {
CONFIG(static): return("static_library")
return("shared_library")
}
return("none")
}
defineReplace(getOutDir) {
# FIXME: rely on env variable in here and in the gyp_qtwebengine script, à la WEBKITOUTPUTDIR
return("$$QTWEBENGINE_ROOT/out")
}
defineReplace(getConfigDir) {
CONFIG(release, debug|release):return("Release")
return("Debug")
}
defineReplace(findMocables) {
input = $$1
for (file, input): \
infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
mocables = $$system("$$QTWEBENGINE_ROOT/build/scripts/find-mocables $$infiles")
mocables = $$replace(mocables, $$_PRO_FILE_PWD_$${QMAKE_DIR_SEP}, '')
return($$mocables)
}
defineReplace(mocOutput) {
out = $$1
# 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)
}
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)
}