TEMPLATE = app
TARGET = pt61850netd_pqfe
DEPENDPATH += .

INCLUDEPATH += . \
    ./source \
    ./source/include \
    ./source/include/mmslite \
    ./source/include/pg_inst \
    ./source/include/curl \
    ./source/include/oss_sdk \
    ./source/include/rocketmq

QMAKE_ORIG_TARGET = $$(TARGET)

QT += core xml network
CONFIG += thread

DEFINES += _CRT_SECURE_NO_WARNINGS
DEFINES += MMS_LITE LINUX=2 MOSI LEAN_T TP0_ENABLED
DEFINES += CLIENT _DEBUG _REENTRANT _GNU_SOURCE _LARGEFILE64_SOURCE

# debug/release flags
CONFIG(debug, debug|release) {
    message("Building debug version with debug symbols")
    QMAKE_CFLAGS_DEBUG   += -g -O0
    QMAKE_CXXFLAGS_DEBUG += -g -O0
    CONFIG += force_debug_info
} else {
    message("Building release version")
    QMAKE_CFLAGS_RELEASE   += -O2
    QMAKE_CXXFLAGS_RELEASE += -O2
}

win32 {
    DEFINES -= UNICODE
    DEFINES += _AFXDLL
    CONFIG += console
}

win32 {
    # RC_FILE=pt61850netd_pqfe.rc
    SOURCES += source/mms/event.c
    INCLUDEPATH += ./source/include/apr
    QMAKE_LFLAGS += /NODEFAULTLIB:libcmt.lib
    LIBS += -L./lib -L./lib/mmslite -lws2_32

    CONFIG(debug, debug|release) {
        DEFINES += DEBUG_SISCO
        MMS_LIB_SUFFIX = _ld.lib
        QMAKE_POST_LINK = $$QMAKE_COPY debug\\*.exe ..\\..\\usr_bin\\jspqfe_home\\bin
    } else {
        MMS_LIB_SUFFIX = _n.lib
        QMAKE_POST_LINK = $$QMAKE_COPY release\\*.exe ..\\..\\usr_bin\\jspqfe_home\\bin
    }

    LIBS += ositcps$$MMS_LIB_SUFFIX \
            mvl$$MMS_LIB_SUFFIX \
            mmsle$$MMS_LIB_SUFFIX \
            mmsl$$MMS_LIB_SUFFIX \
            asn1$$MMS_LIB_SUFFIX \
            mem$$MMS_LIB_SUFFIX \
            meml$$MMS_LIB_SUFFIX \
            slog$$MMS_LIB_SUFFIX \
            utility$$MMS_LIB_SUFFIX \
            ssec0$$MMS_LIB_SUFFIX

    LIBS += -llibapr-1 -llibaprutil-1 -llibjclite
}

unix {
    # 清掉旧标准
    QMAKE_CXXFLAGS -= -std=gnu++98
    QMAKE_CXXFLAGS -= -std=c++98
    QMAKE_CXXFLAGS -= -std=gnu++11
    QMAKE_CXXFLAGS -= -std=c++11

    # 只保留一个
    QMAKE_CXXFLAGS += -std=gnu++14

    include(fe_common.pri)
    SOURCES += source/mms/event2.c
    INCLUDEPATH += ./source/include/apr-linux

    LIBS += -L/FeProject/lib
    # LIBS += -L/FeProject/lib/pgodbc

    DEFINES += DEBUG_SISCO
    VERSION = 1.0.0

    # rpath
    QMAKE_LFLAGS += -Wl,-rpath,/FeProject/lib \
                    -Wl,-rpath,/FeProject/lib/mmslite

    LIBS += -lrt -lpthread

    MMS_LIB_SUFFIX = _ld.a
    LIBS += /FeProject/lib/mmslite/ositcps$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/mvl$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/mmsle$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/mmsl$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/asn1l$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/mem$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/slog$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/util$$MMS_LIB_SUFFIX \
            /FeProject/lib/mmslite/ssec0$$MMS_LIB_SUFFIX \
            /FeProject/lib/libcurl.so \
            /FeProject/lib/libmxml4.so \
            /FeProject/lib/librocketmq.so \
            /FeProject/lib/libhttprun.so \
            /FeProject/lib/liblog4cplus.so

    LIBS += -lapr-1 -laprutil-1 -ljclite
    LIBS += -lrdkafka++
	LIBS += -lrdkafka
    LIBS += -L/FeProject/lib -llog4cplus
	LIBS += -L/root/JoyProject/3rdparty/boost_pic_aarch64/lib -Wl,--no-as-needed -lboost_iostreams -Wl,--as-needed
    LIBS += -L/root/JoyProject/3rdparty/zlib_pic_aarch64/lib -lz

}

# install
target.path = ../../bin
INSTALLS += target

# Input

HEADERS += source/mms/db_interface.h \
           source/include/otlv4.h \
           source/mms/mmsclient.h \
           source/mms/mmsop_en.h \
           source/mms/rdb_client.h \
           source/mms/ver_conf.h \
           source/misc/SM4.h \
           source/json/save2json.h \
           source/json/mms_json_inter.h \
          # source/json/rdkafka.h \
          # source/json/rdkafkacpp.h \
          # source/json/kafka_producer.h \
           source/json/cjson.h \
           source/rocketmq/SimpleProducer.h \
           source/cfg_parse/custom_printf.h \
           source/log4cplus/log4.h

SOURCES += source/mms/main.c \
           source/mms/clntobj.c \
           source/mms/logcfgx.c \
           source/mms/mms_process.c \
           source/mms/mmscli_rpt.c \
           source/mms/mmsclient.c \
           source/mms/mmslvar.c \
           source/mms/mmsop_en.c \
           source/mms/mvl_acse.c \
           source/mms/mvlop_en.c \
           source/mms/parse_xml.c \
           source/mms/rdb_client.c \
           source/mms/rdb_ext_utils.c \
           source/mms/reject.c \
           source/mms/mmscli_log.c \
           source/misc/SM4.cpp \
           source/misc/my_encrypt.cpp \
           source/json/save2json.cpp \
           source/cfg_parse/cfg_parser.cpp \
          # source/json/kafka_producer.cpp \
           source/json/create_json.cpp \
           source/json/cjson.c \
           source/cfg_parse/nacos.cpp \
           source/cfg_parse/base64.cpp \
           source/cfg_parse/SimpleProducer.cpp \
           source/cfg_parse/log4.cpp \
		  # source/cfg_parse/oss_aliyun.cpp \
           #source/cfg_parse/obs_huaweiyun.cpp \
		#   source/cfg_parse/datahub.cpp \
		#   source/cfg_parse/uds_huaweiyun.cpp

