project {
  expand(QT5_INCDIR) {
    $QT5_INCDIR
    $(QTDIR)/include
  }
  expand(QT5_BINDIR) {
    $QT5_BINDIR
    $(QTDIR)/bin
  }
  expand(QT5_LIBDIR) {
    $QT5_LIBDIR
    $(QTDIR)/lib
  }
  // On some linux systems with both Qt4 and Qt5 installed, the uic and moc
  // executables for Qt5 need to be run as "uic-qt5"
  // Expand the variable here to avoid the "undefined" warning from msvc.
  expand(QT5_SUFFIX) {
    $QT5_SUFFIX
    ""
  }

  requires += qt5
  includes += $(QT5_INCDIR)
  libpaths += $(QT5_LIBDIR)
  libs += Qt5Core

  // On Linux at least, Qt5 by default requires position independent code
  specific (gnuace) {
    compile_flags += $(if $(PIC),$(PIC),-fPIC)
  }

  specific (prop:microsoft) {
    // On Windows it's possible for Qt to include winsock.h through windows.h
    // which will conflict with winsock2.h. This makes windows.h not include
    // winsock.h
    macros += WIN32_LEAN_AND_MEAN
  }

  Define_Custom(UIC) {
    command          = $(QT5_BINDIR)/uic$(QT5_SUFFIX)
    output_option    = -o
    inputext         = .ui
    pre_filename     = ui_
    header_outputext = .h
  }

  Define_Custom(MOC) {
    automatic_in     = 0
    automatic_out    = 0
    command          = $(QT5_BINDIR)/moc$(QT5_SUFFIX)
    output_option    = -o
    pch_postrule     = 1
    inputext         = .h
    pre_extension    = _moc
    source_outputext = .cpp
  }

  Define_Custom(QRC) {
    command          = $(QT5_BINDIR)/rcc$(QT5_SUFFIX)
    output_option    = -o
    commandflags     = -name <%input_noext%>
    pch_postrule     = 1
    inputext         = .qrc
    pre_extension    = _qrc
    source_outputext = .cpp
  }
}
