functions.prf 3.13 KiB
defineTest(isPlatformSupported) {
  linux-g++|win32-msvc2013|macx-clang: return(true)
  return(false)
# 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(getConfigDir) {
  CONFIG(release, debug|release):return("Release")
  return("Debug")
defineReplace(extractCFlag) {
    CFLAGS = $$QMAKE_CFLAGS
    !isEmpty(ANDROID_TARGET_CFLAGS): CFLAGS = $$ANDROID_TARGET_CFLAGS
    OPTION = $$find(CFLAGS, $$1)
    OPTION = $$split(OPTION, =)
    return ($$member(OPTION, 1))
defineReplace(findMocables) {
  input = $$1
  for (file, input): \
      infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
  mocables = $$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-mocables $$infiles")
  mocables = $$replace(mocables, $$_PRO_FILE_PWD_/, '')
  return($$mocables)
defineReplace(findIncludedMocFiles) {
  input = $$1
  for (file, input): \
      infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
  return($$system("python $$QTWEBENGINE_ROOT/tools/buildscripts/find-included-moc-files $$infiles"))
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(rccOutput) {
  out = $$1
  out = $$replace(out, .qrc, .cpp)
  out = $$join(out, qrc_, qrc_)
  return($$out)
defineReplace(rccExternFunc) {
  out = $$1
  out = $$replace(out, .qrc, )
  return($$out)
defineReplace(which) {
  out = $$1
  win32 {
    command = $$split(out, " ")
    executable = $$first(command)
7172737475767778798081828384858687888990919293949596979899100101102103104105
# Return the first match only out = $$system("((for /f \"usebackq delims=\" %i in (`where $$executable 2^> NUL`) do @if not defined _endwhich (@echo %i & set _endwhich=true)) & set _endwhich=)") isEmpty(out) { message($$executable not found) out = $$executable } for(arg, command): !equals(arg, $$executable): out += $$arg } else:unix { command = $$split(out, " ") executable = $$first(command) out = $$system("which $$executable 2>/dev/null") isEmpty(out) { message($$executable not found) out = $$executable } for(arg, command): !equals(arg, $$executable): out += $$arg } return($$out) } defineReplace(findOrBuildNinja) { git_chromium_src_dir = $$system("git config qtwebengine.chromiumsrcdir") # Fall back to the snapshot path if git does not know about chromium sources (i.e. init-repository.py has not been used) isEmpty(git_chromium_src_dir): git_chromium_src_dir = "src/3rdparty/chromium" out = $$absolute_path("$$git_chromium_src_dir/../ninja/ninja", "$$QTWEBENGINE_ROOT") win32: out = $$system_path($${out}.exe) # If we did not find ninja, then we bootstrap it. !exists($$out) { system("python $$dirname(out)/bootstrap.py") } return($$out) }