#-------------------------------------------------
#
# Project created by QtCreator 2019-08-06T10:27:47
#
#-------------------------------------------------
TARGET = FileSystemProxyServer
TEMPLATE = app

VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_BUILD = 0

VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_BUILD}
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

QT -= gui
QT += core
QT += network
QT += websockets

CONFIG += c++17
CONFIG += console
CONFIG += thread
CONFIG -= app_bundle

!versionAtLeast(QT_VERSION, 5.15) {
  DEFINES += OLD_QT_VERSION
}

versionAtLeast(QT_VERSION, 6.0) {
  DEFINES += QT_VERSION_6_OR_HIGHER
  QT += core5compat
}

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

win* {
  DEFINES += WIN_COMPILER
}
!win* {
  DEFINES += UNIX_COMPILER
}
win32-msvc* {
  QMAKE_LFLAGS += /NODEFAULTLIB:LIBCMT
  QMAKE_LFLAGS += /ignore:4099  # ignore warnings from libusb-1.0
}

SOURCES += \
  main.cpp

HEADERS += \
  StartReceiveFileWebApiCommand.h \
  StopReceiveFileWebApiCommand.h \
  FlashDataWebSocketServer.h \
  LinkConfiguration.h \
  ../Net/WebSockets/WebSocketServer.h

include(../Common/Common.pri)
include(../Net/WebApi/WebApi.pri)
#include(../MemoryManager/MemoryManager.pri)

INCLUDEPATH += $$PWD/..
INCLUDEPATH += $$PWD/../Net/WebSockets

PROJECT_DIR_PATH = $$PWD

CONFIG(debug, debug|release) {
  DESTDIR_PATH = $$PWD/../build-$${TARGET}-debug
}
CONFIG(release, debug|release) {
  DESTDIR_PATH = $$PWD/../build-$${TARGET}-release
}

DESTDIR = $${DESTDIR_PATH}
OBJECTS_DIR = $${DESTDIR_PATH}/.obj
MOC_DIR = $${DESTDIR_PATH}/.moc
RCC_DIR = $${DESTDIR_PATH}/.rcc
UI_DIR = $${DESTDIR_PATH}/.ui

win32 {
  DESTDIR_PATH ~= s,/,\\,g
  PROJECT_DIR_PATH ~= s,/,\\,g
}

!equals(PROJECT_DIR_PATH, $${DESTDIR_PATH}) {
  linux-g++{
    QMAKE_POST_LINK +=$$quote(cp $${PROJECT_DIR_PATH}/NetworkSettings.json $${DESTDIR_PATH}/NetworkSettings.json $$escape_expand(\n\t))
  }
  win32 {
    QMAKE_POST_LINK += $$quote(copy /Y $${PROJECT_DIR_PATH}\\NetworkSettings.json $${DESTDIR_PATH}\\NetworkSettings.json $$escape_expand(\n\t))
  }
}

# Deployment - Automatically Detect and Copy Dependencies to Build Folder
win32 {
  TARGET_CUSTOM_EXT = .exe
  DEPLOY_COMMAND = $$[QT_INSTALL_BINS]/windeployqt
  DEPLOY_OPTIONS = "--no-svg --no-system-d3d-compiler --no-opengl --no-opengl-sw"
  DEPLOY_TARGET = $$shell_quote($$shell_path($${DESTDIR_PATH}/$${TARGET}$${TARGET_CUSTOM_EXT}))
  CONFIG(debug, debug|release) {
    # debug
    DEPLOY_OPTIONS += "--debug"
  } else {
    # release
    DEPLOY_OPTIONS += "--release"
  }
  # Uncomment the following line to help debug the deploy command when running qmake
  #message($${DEPLOY_COMMAND} $${DEPLOY_OPTIONS} $${DEPLOY_TARGET})

  QMAKE_POST_LINK += $${DEPLOY_COMMAND} $${DEPLOY_OPTIONS} $${DEPLOY_TARGET}
}

DISTFILES += \
  NetworkSettings.json
