# QT -= gui
QT += core
QT += widgets serialport network
# QT += network

TARGET = ATBUpdateTool

VERSION=1.0.0

INCLUDEPATH += plugins

CONFIG += c++17 console
# CONFIG -= app_bundle

DEFINES+=APP_VERSION=\\\"$$VERSION\\\"

QMAKE_CXXFLAGS += -Wno-deprecated-copy

# custom target for 'git subtree'
# subtree.target = subtree
# subtree.commands = git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
# subtree.depends =
# QMAKE_EXTRA_UNIX_TARGETS += subtree

# ! exists(DCPlugin) {
#     $$system("git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
# } else {
    # $$system("git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash")
# }

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

contains( CONFIG, PTU5 ) {
    greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
    CONFIG += link_pkgconfig
    lessThan(QT_MAJOR_VERSION, 5):   PKGCONFIG += qextserialport
    QMAKE_CXXFLAGS += -std=c++11   # for GCC >= 4.7
    QMAKE_CXXFLAGS += -Wno-deprecated-copy
    ARCH = PTU5
    DEFINES+=PTU5
}
contains( CONFIG, PTU5_YOCTO ) {
    greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
    PTU5BASEPATH = /opt/devel/ptu5
    ARCH = PTU5
    DEFINES+=PTU5

    # add qmqtt lib
    #LIBS += -lQt5Qmqtt
}
contains( CONFIG, DesktopLinux ) {
    greaterThan(QT_MAJOR_VERSION, 4): QT += serialport
    lessThan(QT_MAJOR_VERSION, 5):    CONFIG += extserialport
    # QMAKE_CC = ccache $$QMAKE_CC
    # QMAKE_CXX = ccache $$QMAKE_CXX
    QMAKE_CXXFLAGS += -std=c++11
    QMAKE_CXXFLAGS += -Wno-deprecated-copy
    linux-clang {  QMAKE_CXXFLAGS += -Qunused-arguments   }
    ARCH = DesktopLinux
    DEFINES+=DesktopLinux
}

SOURCES += \
        main.cpp \
        update.cpp \
        git/git_client.cpp \
        apism/apism_client.cpp \
        apism/apism_tcp_client.cpp \
        process/command.cpp \
        message_handler.cpp \
        worker.cpp \
        worker_thread.cpp

HEADERS += \
        update.h \
        git/git_client.h \
        apism/apism_client.h \
        apism/apism_tcp_client.h \
        apism/ismas_data.h \
        process/command.h \
        message_handler.h \
        worker.h \
        worker_thread.h \
        plugins/interfaces.h

OTHER_FILES += \
    /opt/app/tools/atbupdate/update_log.csv \
    main.cpp.bck \
    main.cpp.bck2 \
    main.cpp.bck3

# https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
# git subtree add --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
# git subtree pull --prefix DCPlugin https://git.mimbach49.de/GerhardHoffmann/DCPlugin.git master --squash
# include(./DCPlugin/DCPlugin.pri)
