feature(!wireshark, !wireshark_cmake) {
  requires += wireshark_any
}

project : glib {
  includes      += $(WIRESHARK_SRC)

  specific(vc71) {
    macros      += MSC_VER_REQUIRED=1310
  }
  specific(vc8) {
    macros      += MSC_VER_REQUIRED=1400
  }
  specific(vc9) {
    macros      += MSC_VER_REQUIRED=1500
  }
  specific(vc10) {
    macros      += MSC_VER_REQUIRED=1600
  }
  specific(vc11) {
    macros      += MSC_VER_REQUIRED=1700
  }
  specific(vc12) {
    macros      += MSC_VER_REQUIRED=1800
  }
  specific(vc14) {
    macros      += MSC_VER_REQUIRED=1900
  }
  specific(vs2017) {
    macros      += MSC_VER_REQUIRED=1910
  }
  specific(vs2019) {
    macros      += MSC_VER_REQUIRED=1920
  }
  verbatim(nmake, top, 1) {
    include $(WIRESHARK_SRC)/config.nmake
  }
}

// Autoconf / In Source Wireshark Build Method
// This feasture works with how Wireshark Developers Guide says to build
// Wireshark on Linux (autogen.sh). This is also used for older 1.x Wireshark
// Windows builds and if Wireshark headers are installed on the system.
// On Windows $(WIRETAP_VERSION) also has to be specified as well.
feature(wireshark) {
  avoids += wireshark_cmake
  specific(prop:windows) {
    libpaths    += $(WIRESHARK_SRC)/wiretap $(WIRESHARK_SRC)/epan
    lit_libs    += wiretap-$(WIRETAP_VERSION) libwireshark
  } else {
    libpaths    += $(WIRESHARK_SRC)/wiretap/.libs $(WIRESHARK_SRC)/epan/.libs
    lit_libs    += wiretap wireshark
  }
}

// Out of Source Built Wireshark
// CMake out of source builds of Wireshark are used in the Developers Guide
// for Windows and macOS. This can also be used on Linux if built using CMake.
// To use build against them we need two additional paths:
//   WIRESHARK_BUILD
//     The location of the build that the user choose when building Wireshark.
//     It must contain the config.h file after building Wireshark.
//   WIRESHARK_LIB
//     The location of the wireshark dynamic libraries relative to
//     WIRESHARK_BUILD.
//     For Windows this might be:
//       run\RelWithDebInfo
//     For macOS this might be:
//       run/Wireshark.app/Contents/PlugIns/wireshark
feature(wireshark_cmake) {
  avoids += wireshark

  includes    += $(WIRESHARK_BUILD)
  libpaths    += $(WIRESHARK_BUILD)/$(WIRESHARK_LIB)
  lit_libs    += wiretap wireshark wsutil
}
