x2t verion up 2.0.3.440

x2t verion up 2.0.3.440

#-------------------------------------------------
#
# Project created by QtCreator 2014-10-03T18:30:31
#
#-------------------------------------------------

QT       -= core
QT       -= gui

VERSION = 2.0.3.440
DEFINES += INTVER=$$VERSION

TARGET = x2t

CORE_ROOT_DIR = $$PWD/../../..
PWD_ROOT_DIR = $$PWD

CONFIG += core_static_link_libstd
CONFIG += core_x2t
include(../../../Common/base.pri)
include(../../../Common/3dParty/icu/icu.pri)

core_windows {
    QMAKE_LFLAGS += /INCREMENTAL:NO

    contains(QMAKE_TARGET.arch, x86_64):{
        QMAKE_LFLAGS_CONSOLE  = /SUBSYSTEM:CONSOLE,5.02
    } else {
        QMAKE_LFLAGS_CONSOLE  = /SUBSYSTEM:CONSOLE,5.01
    }

} else {
    QMAKE_CXXFLAGS += -Wall -Wno-ignored-qualifiers
}

#CONFIG += build_for_centos6
build_for_centos6 {
    QMAKE_LFLAGS += -Wl,--dynamic-linker=./ld-linux-x86-64.so.2
}

DEFINES += UNICODE \
    _UNICODE \
    _USE_LIBXML2_READER_ \
    _USE_XMLLITE_READER_ \
    USE_LITE_READER \
    PPTX_DEF\
    PPT_DEF\
    ENABLE_PPT_TO_PPTX_CONVERT\
    #DISABLE_FILE_DOWNLOADER \
    FILTER_FLATE_DECODE_ENABLED \
    CXIMAGE_DONT_DECLARE_TCHAR \
    DONT_WRITE_EMBEDDED_FONTS \
    AVS_USE_CONVERT_PPTX_TOCUSTOM_VML \
    LIBXML_READER_ENABLED

DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
DEFINES += PDFWRITER_USE_DYNAMIC_LIBRARY
DEFINES += XPS_USE_DYNAMIC_LIBRARY
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
DEFINES += HTMLFILE_USE_DYNAMIC_LIBRARY
DEFINES += UNICODECONVERTER_USE_DYNAMIC_LIBRARY

core_windows {
    INCLUDEPATH += ../../../OfficeUtils/src/zlib-1.2.3
}
core_mac {
    INCLUDEPATH += ../../../OfficeUtils/src/zlib-1.2.3
}

INCLUDEPATH += ../../../DesktopEditor/xml/build/qt

INCLUDEPATH += ../../../DesktopEditor/xml/libxml2/include
INCLUDEPATH += ../../../DesktopEditor/freetype-2.5.2/include
INCLUDEPATH += ../../../DesktopEditor/agg-2.4/include

INCLUDEPATH += $$PWD/../../../Common/DocxFormat
DEPENDPATH += $$PWD/../../../Common/DocxFormat

INCLUDEPATH += $$PWD/../../../ASCOfficePPTXFile/
DEPENDPATH += $$PWD/../../../ASCOfficePPTXFile/

INCLUDEPATH += $$PWD/../../../ASCOfficePPTXFile/Editor/
DEPENDPATH += $$PWD/../../../ASCOfficePPTXFile/Editor/

INCLUDEPATH += $$PWD/../../../OfficeUtils/src
DEPENDPATH += $$PWD/../../../OfficeUtils/src

INCLUDEPATH += $$PWD/../../../ASCOfficeDocxFile2
DEPENDPATH += $$PWD/../../../ASCOfficeDocxFile2

##############################################################################################################

SOURCES +=  ../../src/cextracttools.cpp \
            ../../../Common/OfficeFileFormatChecker2.cpp \
            ../../src/ASCConverters.cpp \
            ../../../DesktopEditor/xml/src/xmllight.cpp \
    ../../../DesktopEditor/xml/src/xmldom.cpp
HEADERS +=  ../../src/cextracttools.h \
            ../../../Common/OfficeFileFormatChecker.h \
            ../../src/ASCConverters.h \
            ../../../DesktopEditor/graphics/MetafileToGraphicsRenderer.h

#Xls file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lXlsFormatLib
# odf format writer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOdfFileWriterLib
# odf format reader
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOdfFileReaderLib
#doc file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDocFormatLib
# ppt file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPptFormatLib
#rtf file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lRtfFormatLib
#txt(xml) file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lTxtXmlFormatLib
# pdf writer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPdfWriter
#docxfile2
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lASCOfficeDocxFile2Lib
#pptxformat
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPPTXFormatLib
#docxformat
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDocxFormatLib
#office utils
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOfficeUtils
#graphics
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lgraphics
#doctrenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -ldoctrenderer
#HtmlRenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lHtmlRenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPdfReader
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDjVuFile
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lXpsFile
#HtmlFile
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lHtmlFile
#UnicodeConverter
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter
#Crypto++
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib

#####################################################
# внешнее подключение сторонних библиотек

#BOOST
CONFIG += core_boost_regex
include($$PWD/../../../Common/3dParty/boost/boost.pri)

core_windows {
    LIBS += -lurlmon
    LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxml
}

core_linux {
    LIBS += -lz
    LIBS += -lxml2
    LIBS += -lcurl
}

mac {
    LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxml
    LIBS += -framework AppKit
}
########################################################

#-------------------------------------------------
#
# Project created by QtCreator 2014-10-03T18:30:31
#
#-------------------------------------------------

QT       -= core
QT       -= gui

VERSION = 2.0.3.438
DEFINES += INTVER=$$VERSION

TARGET = x2t

CORE_ROOT_DIR = $$PWD/../../..
PWD_ROOT_DIR = $$PWD

CONFIG += core_static_link_libstd
CONFIG += core_x2t
include(../../../Common/base.pri)
include(../../../Common/3dParty/icu/icu.pri)

core_windows {
    QMAKE_LFLAGS += /INCREMENTAL:NO

    contains(QMAKE_TARGET.arch, x86_64):{
        QMAKE_LFLAGS_CONSOLE  = /SUBSYSTEM:CONSOLE,5.02
    } else {
        QMAKE_LFLAGS_CONSOLE  = /SUBSYSTEM:CONSOLE,5.01
    }

} else {
    QMAKE_CXXFLAGS += -Wall -Wno-ignored-qualifiers
}

#CONFIG += build_for_centos6
build_for_centos6 {
    QMAKE_LFLAGS += -Wl,--dynamic-linker=./ld-linux-x86-64.so.2
}

DEFINES += UNICODE \
    _UNICODE \
    _USE_LIBXML2_READER_ \
    _USE_XMLLITE_READER_ \
    USE_LITE_READER \
    PPTX_DEF\
    PPT_DEF\
    ENABLE_PPT_TO_PPTX_CONVERT\
    #DISABLE_FILE_DOWNLOADER \
    FILTER_FLATE_DECODE_ENABLED \
    CXIMAGE_DONT_DECLARE_TCHAR \
    DONT_WRITE_EMBEDDED_FONTS \
    AVS_USE_CONVERT_PPTX_TOCUSTOM_VML \
    LIBXML_READER_ENABLED

DEFINES += PDFREADER_USE_DYNAMIC_LIBRARY
DEFINES += PDFWRITER_USE_DYNAMIC_LIBRARY
DEFINES += XPS_USE_DYNAMIC_LIBRARY
DEFINES += DJVU_USE_DYNAMIC_LIBRARY
DEFINES += HTMLRENDERER_USE_DYNAMIC_LIBRARY
DEFINES += HTMLFILE_USE_DYNAMIC_LIBRARY
DEFINES += UNICODECONVERTER_USE_DYNAMIC_LIBRARY

core_windows {
    INCLUDEPATH += ../../../OfficeUtils/src/zlib-1.2.3
}
core_mac {
    INCLUDEPATH += ../../../OfficeUtils/src/zlib-1.2.3
}

INCLUDEPATH += ../../../DesktopEditor/xml/build/qt

INCLUDEPATH += ../../../DesktopEditor/xml/libxml2/include
INCLUDEPATH += ../../../DesktopEditor/freetype-2.5.2/include
INCLUDEPATH += ../../../DesktopEditor/agg-2.4/include

INCLUDEPATH += $$PWD/../../../Common/DocxFormat
DEPENDPATH += $$PWD/../../../Common/DocxFormat

INCLUDEPATH += $$PWD/../../../ASCOfficePPTXFile/
DEPENDPATH += $$PWD/../../../ASCOfficePPTXFile/

INCLUDEPATH += $$PWD/../../../ASCOfficePPTXFile/Editor/
DEPENDPATH += $$PWD/../../../ASCOfficePPTXFile/Editor/

INCLUDEPATH += $$PWD/../../../OfficeUtils/src
DEPENDPATH += $$PWD/../../../OfficeUtils/src

INCLUDEPATH += $$PWD/../../../ASCOfficeDocxFile2
DEPENDPATH += $$PWD/../../../ASCOfficeDocxFile2

##############################################################################################################

SOURCES +=  ../../src/cextracttools.cpp \
            ../../../Common/OfficeFileFormatChecker2.cpp \
            ../../src/ASCConverters.cpp \
            ../../../DesktopEditor/xml/src/xmllight.cpp \
    ../../../DesktopEditor/xml/src/xmldom.cpp
HEADERS +=  ../../src/cextracttools.h \
            ../../../Common/OfficeFileFormatChecker.h \
            ../../src/ASCConverters.h \
            ../../../DesktopEditor/graphics/MetafileToGraphicsRenderer.h

#Xls file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lXlsFormatLib
# odf format writer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOdfFileWriterLib
# odf format reader
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOdfFileReaderLib
#doc file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDocFormatLib
# ppt file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPptFormatLib
#rtf file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lRtfFormatLib
#txt(xml) file
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lTxtXmlFormatLib
# pdf writer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPdfWriter
#docxfile2
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lASCOfficeDocxFile2Lib
#pptxformat
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPPTXFormatLib
#docxformat
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDocxFormatLib
#office utils
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lOfficeUtils
#graphics
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lgraphics
#doctrenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -ldoctrenderer
#HtmlRenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lHtmlRenderer
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lPdfReader
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lDjVuFile
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lXpsFile
#HtmlFile
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lHtmlFile
#UnicodeConverter
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter
#Crypto++
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib

#####################################################
# внешнее подключение сторонних библиотек

#BOOST
CONFIG += core_boost_regex
include($$PWD/../../../Common/3dParty/boost/boost.pri)

core_windows {
    LIBS += -lurlmon
    LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxml
}

core_linux {
    LIBS += -lz
    LIBS += -lxml2
    LIBS += -lcurl
}

mac {
    LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -llibxml
    LIBS += -framework AppKit
}
########################################################


Changes the object/moc dir for the tests for faster compile time

include(./../../lib/dcpconfig.pri)

INCLUDEPATH += ../doubles

SRCDIR = ./../../src

DEPENDPATH = $$INCLUDEPATH

QMAKE_LIBDIR += ../../../lib/lib/ /usr/lib/
LIBDCPSRC =../../../lib/src
LIBDCPINCLUDE=../../../lib/src/include
LIBDCPFAKES=../../../lib/tests/doubles
STUBSDIR = ../doubles
CONFIG += debug

QT += testlib

TEMPLATE = app

DEFINES += QT_NO_DEBUG_OUTPUT
#DEFINES += QT_NO_WARNING_OUTPUT
DEFINES += UNIT_TEST

coverage {
    message("Coverage options enabled")
    QMAKE_CXXFLAGS += --coverage
    QMAKE_LFLAGS += --coverage
}

target.path = $${DCP_INSTALL_LIB}/duicontrolpanel-tests
INSTALLS += target
include(check.pri)
LIBS +=  -L/usr/lib -lduicontrolpanel
QMAKE_CXXFLAGS += -Werror
message($$target.path)

OBJECTS_DIR = ../.obj
MOC_DIR = ../.moc

include(./../../lib/dcpconfig.pri)

INCLUDEPATH += ../doubles

SRCDIR = ./../../src

DEPENDPATH = $$INCLUDEPATH

QMAKE_LIBDIR += ../../../lib/lib/ /usr/lib/
LIBDCPSRC =../../../lib/src
LIBDCPINCLUDE=../../../lib/src/include
LIBDCPFAKES=../../../lib/tests/doubles
STUBSDIR = ../doubles
CONFIG += debug

QT += testlib

TEMPLATE = app

DEFINES += QT_NO_DEBUG_OUTPUT
#DEFINES += QT_NO_WARNING_OUTPUT
DEFINES += UNIT_TEST

coverage {
    message("Coverage options enabled")
    QMAKE_CXXFLAGS += --coverage
    QMAKE_LFLAGS += --coverage
}

target.path = $${DCP_INSTALL_LIB}/duicontrolpanel-tests
INSTALLS += target
include(check.pri)
LIBS +=  -L/usr/lib -lduicontrolpanel
QMAKE_CXXFLAGS += -Werror
message($$target.path)

OBJECTS_DIR = .obj
MOC_DIR = .moc


deleted nonexistent file from umllib.pri

HEADERS += \
	$$PWD/edgeElement.h \
	$$PWD/element.h \
	$$PWD/nodeElement.h \
	$$PWD/sdfRenderer.h \
	$$PWD/label.h \
	$$PWD/labelFactory.h \
	$$PWD/contextMenuAction.h \
	$$PWD/embedded/linkers/embeddedLinker.h \
	$$PWD/embedded/linkers/embeddedLinkers.h \
	$$PWD/serializationData.h \
	$$PWD/private/sceneGridHandler.h \
	$$PWD/private/resizeHandler.h \
	$$PWD/private/umlPortHandler.h \
	$$PWD/private/borderChecker.h \
	$$PWD/private/portHandler.h \
	$$PWD/private/copyHandler.h \
	$$PWD/private/resizeCommand.h \
	$$PWD/private/foldCommand.h \
	$$PWD/private/reshapeEdgeCommand.h \
	$$PWD/private/fontCache.h \
	$$PWD/ports/portFactory.h \
	$$PWD/ports/statLine.h \
	$$PWD/ports/statPoint.h \

SOURCES += \
	$$PWD/edgeElement.cpp \
	$$PWD/element.cpp \
	$$PWD/nodeElement.cpp \
	$$PWD/sdfRenderer.cpp \
	$$PWD/label.cpp \
	$$PWD/labelFactory.cpp \
	$$PWD/contextMenuAction.cpp \
	$$PWD/embedded/linkers/embeddedLinker.cpp \
	$$PWD/embedded/linkers/embeddedLinkers.cpp \
	$$PWD/serializationData.cpp \
	$$PWD/private/sceneGridHandler.cpp \
	$$PWD/private/resizeHandler.cpp \
	$$PWD/private/umlPortHandler.cpp \
	$$PWD/private/borderChecker.cpp \
	$$PWD/private/portHandler.cpp \
	$$PWD/private/copyHandler.cpp \
	$$PWD/private/resizeCommand.cpp \
	$$PWD/private/foldCommand.cpp \
	$$PWD/private/reshapeEdgeCommand.cpp \
	$$PWD/private/fontCache.cpp \
	$$PWD/private/expandCommand.cpp \
	$$PWD/ports/portFactory.cpp \
	$$PWD/ports/statLine.cpp \
	$$PWD/ports/statPoint.cpp \

RESOURCES += \
	$$PWD/contextIcons.qrc \

HEADERS += \
	$$PWD/edgeElement.h \
	$$PWD/element.h \
	$$PWD/nodeElement.h \
	$$PWD/sdfRenderer.h \
	$$PWD/label.h \
	$$PWD/labelFactory.h \
	$$PWD/contextMenuAction.h \
	$$PWD/embedded/linkers/embeddedLinker.h \
	$$PWD/embedded/linkers/embeddedLinkers.h \
	$$PWD/serializationData.h \
	$$PWD/private/sceneGridHandler.h \
	$$PWD/private/resizeHandler.h \
	$$PWD/private/umlPortHandler.h \
	$$PWD/private/borderChecker.h \
	$$PWD/private/portHandler.h \
	$$PWD/private/copyHandler.h \
	$$PWD/private/resizeCommand.h \
	$$PWD/private/foldCommand.h \
	$$PWD/private/reshapeEdgeCommand.h \
	$$PWD/private/fontCache.h \
	$$PWD/private/nodeElementInterface.h
	$$PWD/ports/portFactory.h \
	$$PWD/ports/statLine.h \
	$$PWD/ports/statPoint.h \

SOURCES += \
	$$PWD/edgeElement.cpp \
	$$PWD/element.cpp \
	$$PWD/nodeElement.cpp \
	$$PWD/sdfRenderer.cpp \
	$$PWD/label.cpp \
	$$PWD/labelFactory.cpp \
	$$PWD/contextMenuAction.cpp \
	$$PWD/embedded/linkers/embeddedLinker.cpp \
	$$PWD/embedded/linkers/embeddedLinkers.cpp \
	$$PWD/serializationData.cpp \
	$$PWD/private/sceneGridHandler.cpp \
	$$PWD/private/resizeHandler.cpp \
	$$PWD/private/umlPortHandler.cpp \
	$$PWD/private/borderChecker.cpp \
	$$PWD/private/portHandler.cpp \
	$$PWD/private/copyHandler.cpp \
	$$PWD/private/resizeCommand.cpp \
	$$PWD/private/foldCommand.cpp \
	$$PWD/private/reshapeEdgeCommand.cpp \
	$$PWD/private/fontCache.cpp \
	$$PWD/private/expandCommand.cpp \
	$$PWD/ports/portFactory.cpp \
	$$PWD/ports/statLine.cpp \
	$$PWD/ports/statPoint.cpp \

RESOURCES += \
	$$PWD/contextIcons.qrc \


make use of QMAKE_SUBSTITUTES less bizarre

qmake should work well enough for that now. we use the same construct in
app.pro, anyway.

Change-Id: Iabee60e9b898e92e003850e0a8c88673fa3ced6d
Reviewed-by: Eike Ziller <c142da16c73a95a82d35191bcc55b22835617128@nokia.com>

include(../qtcreator.pri)

# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h

isEmpty(PROVIDER) {
    PROVIDER = Nokia
}

isEmpty(USE_USER_DESTDIR) {
    DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
} else {
    win32 {
        DESTDIRAPPNAME = "qtcreator"
        DESTDIRBASE = "$$(LOCALAPPDATA)"
        isEmpty(DESTDIRBASE):DESTDIRBASE="$$(USERPROFILE)\Local Settings\Application Data"
    } else:macx {
        DESTDIRAPPNAME = "Qt Creator"
        DESTDIRBASE = "$$(HOME)/Library/Application Support"
    } else:unix {
        DESTDIRAPPNAME = "qtcreator"
        DESTDIRBASE = "$$(XDG_DATA_HOME)"
        isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share"
    }
    DESTDIR = "$$DESTDIRBASE/Nokia/$$DESTDIRAPPNAME/plugins/$$QTCREATOR_VERSION/$$PROVIDER"
}
LIBS += -L$$DESTDIR

# copy the plugin spec
isEmpty(TARGET) {
    error("qtcreatorplugin.pri: You must provide a TARGET")
}

defineReplace(stripOutDir) {
    1 ~= s|^$$re_escape($$OUT_PWD/)||$$i_flag
    return($$1)
}

PLUGINSPEC = $$_PRO_FILE_PWD_/$${TARGET}.pluginspec
PLUGINSPEC_IN = $${PLUGINSPEC}.in
exists($$PLUGINSPEC_IN) {
    OTHER_FILES += $$PLUGINSPEC_IN
    QMAKE_SUBSTITUTES += $$PLUGINSPEC_IN
    PLUGINSPEC = $$OUT_PWD/$${TARGET}.pluginspec
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripOutDir}
} else {
    # need to support that for external plugins
    OTHER_FILES += $$PLUGINSPEC
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripSrcDir}
}
copy2build.input = PLUGINSPEC
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copy2build.name = COPY ${QMAKE_FILE_IN}
copy2build.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += copy2build

macx {
    !isEmpty(TIGER_COMPAT_MODE) {
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
    } else {
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
        QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
    }
} else:linux-* {
    #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
    QMAKE_RPATHDIR += \$\$ORIGIN
    QMAKE_RPATHDIR += \$\$ORIGIN/..
    QMAKE_RPATHDIR += \$\$ORIGIN/../..
    IDE_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
    QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${IDE_PLUGIN_RPATH}\'
    QMAKE_RPATHDIR =
}

contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols

CONFIG += plugin plugin_with_soname
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

!macx {
    target.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
    pluginspec.files += $${TARGET}.pluginspec
    pluginspec.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
    INSTALLS += target pluginspec
}

TARGET = $$qtLibraryName($$TARGET)

include(../qtcreator.pri)

# use gui precompiled header for plugins by default
isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h

isEmpty(PROVIDER) {
    PROVIDER = Nokia
}

isEmpty(USE_USER_DESTDIR) {
    DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
} else {
    win32 {
        DESTDIRAPPNAME = "qtcreator"
        DESTDIRBASE = "$$(LOCALAPPDATA)"
        isEmpty(DESTDIRBASE):DESTDIRBASE="$$(USERPROFILE)\Local Settings\Application Data"
    } else:macx {
        DESTDIRAPPNAME = "Qt Creator"
        DESTDIRBASE = "$$(HOME)/Library/Application Support"
    } else:unix {
        DESTDIRAPPNAME = "qtcreator"
        DESTDIRBASE = "$$(XDG_DATA_HOME)"
        isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share"
    }
    DESTDIR = "$$DESTDIRBASE/Nokia/$$DESTDIRAPPNAME/plugins/$$QTCREATOR_VERSION/$$PROVIDER"
}
LIBS += -L$$DESTDIR

# copy the plugin spec
isEmpty(TARGET) {
    error("qtcreatorplugin.pri: You must provide a TARGET")
}

defineReplace(stripOutDir) {
    1 ~= s|^$$re_escape($$OUT_PWD/)||$$i_flag
    return($$1)
}

PLUGINSPEC = $$_PRO_FILE_PWD_/$${TARGET}.pluginspec
PLUGINSPEC_IN = $${PLUGINSPEC}.in
exists($$PLUGINSPEC_IN) {
    OTHER_FILES += $$PLUGINSPEC_IN
    PLUGINSPEC = $$OUT_PWD/$${TARGET}.pluginspec
    QMAKE_SUBSTITUTES += $${PLUGINSPEC}.in
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripOutDir}
} else {
    # need to support that for external plugins
    OTHER_FILES += $$PLUGINSPEC
    copy2build.output = $$DESTDIR/${QMAKE_FUNC_FILE_IN_stripSrcDir}
}
copy2build.input = PLUGINSPEC
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copy2build.name = COPY ${QMAKE_FILE_IN}
copy2build.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += copy2build

macx {
    !isEmpty(TIGER_COMPAT_MODE) {
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
    } else {
        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
        QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
    }
} else:linux-* {
    #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
    QMAKE_RPATHDIR += \$\$ORIGIN
    QMAKE_RPATHDIR += \$\$ORIGIN/..
    QMAKE_RPATHDIR += \$\$ORIGIN/../..
    IDE_PLUGIN_RPATH = $$join(QMAKE_RPATHDIR, ":")
    QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${IDE_PLUGIN_RPATH}\'
    QMAKE_RPATHDIR =
}

contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols

CONFIG += plugin plugin_with_soname
linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

!macx {
    target.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
    pluginspec.files += $${TARGET}.pluginspec
    pluginspec.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
    INSTALLS += target pluginspec
}

TARGET = $$qtLibraryName($$TARGET)


Updated signalwatcher configuration

Updated signalwatcher configuration

HEADERS += \
	$$PWD/../libs/qt_signalwatcher/src/signalwatcher.h \
	$$PWD/../libs/qt_signalwatcher/src/helpers_p.h \
	$$PWD/../libs/qt_signalwatcher/src/qt4compat.h

unix:!symbian {
	system('cc -E $$PWD/../libs/qt_signalwatcher/src/conftests/signalfd.h -o /dev/null 2> /dev/null') {
		SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_signalfd.cpp
	}
	else:system('cc -E $$PWD/../libs/qt_signalwatcher/src/conftests/eventfd.h -o /dev/null 2> /dev/null'): {
		SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_eventfd.cpp
	}
	else {
		SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_pipe.cpp
	}
}
else {
	SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_none.cpp
}

INCLUDEPATH += $$PWD/../libs/qt_signalwatcher/src
DEPENDPATH  += $$PWD/../libs/qt_signalwatcher/src

HEADERS += \
	$$PWD/../libs/qt_signalwatcher/src/signalwatcher.h \
	$$PWD/../libs/qt_signalwatcher/src/helpers_p.h \
	$$PWD/../libs/qt_signalwatcher/src/qt4compat.h

unix:!symbian {
	exists(/usr/include/sys/signalfd.h):     SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_signalfd.cpp
	else:exists(/usr/include/sys/eventfd.h): SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_eventfd.cpp
	else:                                    SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_pipe.cpp
}
else {
	SOURCES += $$PWD/../libs/qt_signalwatcher/src/signalwatcher_none.cpp
}


gcc9 test

gcc9 test

#
# GAMS - General Algebraic Modeling System C++ API
#
# Copyright (c) 2017-2020 GAMS Software GmbH <support@gams.com>
# Copyright (c) 2017-2020 GAMS Development Corp. <support@gams.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG += test
DESTDIR = ../bin

QT += testlib
QT -= gui

include(../gamsdependency.pri)
win32:{
    LIBS += -luser32
    LIBS += -L../../bin/ -lgamscpp
}

unix:{
    LIBS += -ldl -L../../bin -lgamscpp
    !macx{
        LIBS += -lstdc++fs
        # set minimum gcc version
        GCCMAJORVERSION=$$system("gcc -dumpversion")
        lessThan(GCCMAJORVERSION, 9): {
            QMAKE_CC=gcc-9
            QMAKE_CXX=g++-9
        }
    }
}
macx:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15

TESTROOT = $$_PRO_FILE_PWD_/..

INCLUDEPATH += $$TESTROOT $$TESTROOT/../src/

#
# GAMS - General Algebraic Modeling System C++ API
#
# Copyright (c) 2017-2020 GAMS Software GmbH <support@gams.com>
# Copyright (c) 2017-2020 GAMS Development Corp. <support@gams.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG += test
DESTDIR = ../bin

QT += testlib
QT -= gui

include(../gamsdependency.pri)
win32:{
    LIBS += -luser32
    LIBS += -L../../bin/ -lgamscpp
}

unix:{
    LIBS += -ldl -L../../bin -lgamscpp
    !macx{
        LIBS += -lstdc++fs
        # set minimum gcc version
        GCCMAJORVERSION=$$system("gcc -dumpversion")
        lessThan(GCCMAJORVERSION, 8): {
            QMAKE_CC=gcc-8
            QMAKE_CXX=g++-8
        }
    }
}
macx:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15

TESTROOT = $$_PRO_FILE_PWD_/..

INCLUDEPATH += $$TESTROOT $$TESTROOT/../src/


Use the qdoc that was moved to qtbase.

Use the qdoc that was moved to qtbase.

Change-Id: I4bcb44deb76e7b1bb8235199e55f53f82d6f475f
Reviewed-by: Martin Smith <a8cc6484db2755056ccf1c457da8ca771f895dea@nokia.com>

#####################################################################
# Qt documentation build
#####################################################################

DOCS_GENERATION_DEFINES =
GENERATOR = $${QT.help.bins}/qhelpgenerator
MODULE = qtdoc

win32:!win32-g++* {
    unixstyle = false
} else :win32-g++*:isEmpty(QMAKE_SH) {
    unixstyle = false
} else {
    unixstyle = true
}

$$unixstyle {
    SET =
    SEP =
} else {
    SET = set
    SEP = &&
}

# The module names correspond to the names of files in qtbase/mkspecs/modules
# that take the form qt_<module>.pri. This is why we see clucene, not qttools,
# and systeminfo, not systems.

MODULES = activeqt \
          core \ # dbus gui network opengl openvg sql testlib uilib uitools xml
          declarative \
          doc \
          clucene \ # help designer
          location \
          multimedia \
          phonon \
          publishsubscribe \
          3d \
          script \ # scripttools
          sensors \
          serviceframework \
          systeminfo \
          svg \
          webkit \
          webkit-examples-and-demos \
          xmlpatterns \
          qt3support \
          contacts \
          organizer \
          versit \
          bluetooth

# Compile a list of location definitions for each of the modules and a list of
# qdocconf files to include.

LOCATIONS =
INCLUDES =
for(module, MODULES) {

    INCLUDES += $$SET

    # Take the module name and convert it to the name of the variable that
    # contains the sources path, which takes the form, QT.<module name>.sources.

    module_name = $$upper($$module)
    module_name = $$replace(module_name, "-", "_")
    module_value = $$eval(QT.$$replace(module, "-", "_").sources)
    !isEmpty(module_value) {
        LOCATIONS += $$SET
        LOCATIONS += QT_$${module_name}_SOURCES=$$module_value
        LOCATIONS += $$SEP

        INCLUDES += QT_$${module_name}_QDOCCONF=modules/qt$${module}.qdocconf
        debug : message($$module : $$module_value)
    } else {
        INCLUDES += QT_$${module_name}_QDOCCONF=modules/missing.qdocconf
        debug : message($$module not found.)
    }
    INCLUDES += $$SEP
}

# Output the locations and includes as build messages. This helps the user to
# see which modules have been installed and diagnose any problems.

message($$LOCATIONS)
message($$INCLUDES)

# Input files in the source tree
ONLINE_QDOCCONF = $${QT.doc.sources}/doc/config/qt-build-docs-online.qdocconf
ONLINE_QDOCCONF = $$replace(ONLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

DITA_QDOCCONF = $${QT.doc.sources}/doc/config/qt-ditaxml.qdocconf
DITA_QDOCCONF = $$replace(DITA_QDOCCONF, "/", $$QMAKE_DIR_SEP)

OFFLINE_QDOCCONF = $${QT.doc.sources}/doc/config/qt-build-docs.qdocconf
OFFLINE_QDOCCONF = $$replace(OFFLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

MODULE_ONLINE_QDOCCONF = $${QT.doc.sources}/doc/config/$${MODULE}-online.qdocconf
MODULE_ONLINE_QDOCCONF = $$replace(ONLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

MODULE_OFFLINE_QDOCCONF = $${QT.doc.sources}/doc/config/$${MODULE}.qdocconf
MODULE_OFFLINE_QDOCCONF = $$replace(OFFLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

# Output files in the build tree
QHP_FILE = html/qt.qhp
QHP_FILE = $$replace(QHP_FILE, "/", $$QMAKE_DIR_SEP)
QCH_FILE = qch/qt.qch
QCH_FILE = $$replace(QCH_FILE, "/", $$QMAKE_DIR_SEP)

INDEX_FILE = html/qt.index
INDEX_FILE = $$replace(INDEX_FILE, "/", $$QMAKE_DIR_SEP)
INDEX_DEST = $$INDEX_DESTDIR/qt.index
INDEX_DEST = $$replace(INDEX_DEST, "/", $$QMAKE_DIR_SEP)

MODULE_QHP_FILE = html/$${MODULE}.qhp
MODULE_QHP_FILE = $$replace(QHP_FILE, "/", $$QMAKE_DIR_SEP)
MODULE_QCH_FILE = qch/$${MODULE}.qch
MODULE_QCH_FILE = $$replace(QCH_FILE, "/", $$QMAKE_DIR_SEP)

MODULE_INDEX_FILE = html/$${MODULE}.index
MODULE_INDEX_FILE = $$replace(INDEX_FILE, "/", $$QMAKE_DIR_SEP)
MODULE_INDEX_DEST = $$INDEX_DESTDIR/$${MODULE}.index
MODULE_INDEX_DEST = $$replace(INDEX_DEST, "/", $$QMAKE_DIR_SEP)

$$unixstyle {
    QDOC = $$LOCATIONS $$INCLUDES MODULE_SOURCE_TREE=$${QT.doc.sources} MODULE_BUILD_TREE=$$MODULE_BUILD_DIR $$QT.core.bins/qdoc $$DOCS_GENERATION_DEFINES
} else {
    QDOC = $$LOCATIONS $$INCLUDES set MODULE_SOURCE_TREE=$${QT.doc.sources} && set MODULE_BUILD_TREE=$$MODULE_BUILD_DIR && $$QT.core.bins/qdoc.exe $$DOCS_GENERATION_DEFINES
    QDOC = $$replace(QDOC, "/", $$QMAKE_DIR_SEP)
}

# Build rules:

online_docs.commands = ($$QDOC $$ONLINE_QDOCCONF)

dita_docs.commands = ($$QDOC $$DITA_QDOCCONF)

qch_docs.commands = ($$QDOC $$OFFLINE_QDOCCONF && \
                     $$GENERATOR -platform minimal $$QHP_FILE -o $$QCH_FILE)

docs.commands = ($$QDOC $$OFFLINE_QDOCCONF && \
                 $$GENERATOR -platform minimal $$QHP_FILE -o $$QCH_FILE && \
                 $$QDOC $$ONLINE_QDOCCONF)

# Install rules

htmldocs.files = html
htmldocs.path = $$[QT_INSTALL_DOCS]
htmldocs.CONFIG += no_check_exist directory

qchdocs.files= qch
qchdocs.path = $$[QT_INSTALL_DOCS]
qchdocs.CONFIG += no_check_exist directory

docimages.files = src/images
docimages.path = $$[QT_INSTALL_DOCS]/src

QMAKE_EXTRA_TARGETS += online_docs qch_docs docs dita_docs
INSTALLS += htmldocs qchdocs docimages

#####################################################################
# Qt documentation build
#####################################################################

DOCS_GENERATION_DEFINES =
GENERATOR = $${QT.help.bins}/qhelpgenerator
MODULE = qtdoc

win32:!win32-g++* {
    unixstyle = false
} else :win32-g++*:isEmpty(QMAKE_SH) {
    unixstyle = false
} else {
    unixstyle = true
}

$$unixstyle {
    SET =
    SEP =
} else {
    SET = set
    SEP = &&
}

# The module names correspond to the names of files in qtbase/mkspecs/modules
# that take the form qt_<module>.pri. This is why we see clucene, not qttools,
# and systeminfo, not systems.

MODULES = activeqt \
          core \ # dbus gui network opengl openvg sql testlib uilib uitools xml
          declarative \
          doc \
          clucene \ # help designer
          location \
          multimedia \
          phonon \
          publishsubscribe \
          3d \
          script \ # scripttools
          sensors \
          serviceframework \
          systeminfo \
          svg \
          webkit \
          webkit-examples-and-demos \
          xmlpatterns \
          qt3support \
          contacts \
          organizer \
          versit \
          bluetooth

# Compile a list of location definitions for each of the modules and a list of
# qdocconf files to include.

LOCATIONS =
INCLUDES =
for(module, MODULES) {

    INCLUDES += $$SET

    # Take the module name and convert it to the name of the variable that
    # contains the sources path, which takes the form, QT.<module name>.sources.

    module_name = $$upper($$module)
    module_name = $$replace(module_name, "-", "_")
    module_value = $$eval(QT.$$replace(module, "-", "_").sources)
    !isEmpty(module_value) {
        LOCATIONS += $$SET
        LOCATIONS += QT_$${module_name}_SOURCES=$$module_value
        LOCATIONS += $$SEP

        INCLUDES += QT_$${module_name}_QDOCCONF=modules/qt$${module}.qdocconf
        debug : message($$module : $$module_value)
    } else {
        INCLUDES += QT_$${module_name}_QDOCCONF=modules/missing.qdocconf
        debug : message($$module not found.)
    }
    INCLUDES += $$SEP
}

# Output the locations and includes as build messages. This helps the user to
# see which modules have been installed and diagnose any problems.

message($$LOCATIONS)
message($$INCLUDES)

# Input files in the source tree
ONLINE_QDOCCONF = $${QT.doc.sources}/doc/config/qt-build-docs-online.qdocconf
ONLINE_QDOCCONF = $$replace(ONLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

DITA_QDOCCONF = $${QT.doc.sources}/doc/config/qt-ditaxml.qdocconf
DITA_QDOCCONF = $$replace(DITA_QDOCCONF, "/", $$QMAKE_DIR_SEP)

OFFLINE_QDOCCONF = $${QT.doc.sources}/doc/config/qt-build-docs.qdocconf
OFFLINE_QDOCCONF = $$replace(OFFLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

MODULE_ONLINE_QDOCCONF = $${QT.doc.sources}/doc/config/$${MODULE}-online.qdocconf
MODULE_ONLINE_QDOCCONF = $$replace(ONLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

MODULE_OFFLINE_QDOCCONF = $${QT.doc.sources}/doc/config/$${MODULE}.qdocconf
MODULE_OFFLINE_QDOCCONF = $$replace(OFFLINE_QDOCCONF, "/", $$QMAKE_DIR_SEP)

# Output files in the build tree
QHP_FILE = html/qt.qhp
QHP_FILE = $$replace(QHP_FILE, "/", $$QMAKE_DIR_SEP)
QCH_FILE = qch/qt.qch
QCH_FILE = $$replace(QCH_FILE, "/", $$QMAKE_DIR_SEP)

INDEX_FILE = html/qt.index
INDEX_FILE = $$replace(INDEX_FILE, "/", $$QMAKE_DIR_SEP)
INDEX_DEST = $$INDEX_DESTDIR/qt.index
INDEX_DEST = $$replace(INDEX_DEST, "/", $$QMAKE_DIR_SEP)

MODULE_QHP_FILE = html/$${MODULE}.qhp
MODULE_QHP_FILE = $$replace(QHP_FILE, "/", $$QMAKE_DIR_SEP)
MODULE_QCH_FILE = qch/$${MODULE}.qch
MODULE_QCH_FILE = $$replace(QCH_FILE, "/", $$QMAKE_DIR_SEP)

MODULE_INDEX_FILE = html/$${MODULE}.index
MODULE_INDEX_FILE = $$replace(INDEX_FILE, "/", $$QMAKE_DIR_SEP)
MODULE_INDEX_DEST = $$INDEX_DESTDIR/$${MODULE}.index
MODULE_INDEX_DEST = $$replace(INDEX_DEST, "/", $$QMAKE_DIR_SEP)

$$unixstyle {
    QDOC = $$LOCATIONS $$INCLUDES MODULE_SOURCE_TREE=$${QT.doc.sources} MODULE_BUILD_TREE=$$MODULE_BUILD_DIR $$QT.doc.bins/qdoc3 $$DOCS_GENERATION_DEFINES
} else {
    QDOC = $$LOCATIONS $$INCLUDES set MODULE_SOURCE_TREE=$${QT.doc.sources} && set MODULE_BUILD_TREE=$$MODULE_BUILD_DIR && $$QT.doc.bins/qdoc3.exe $$DOCS_GENERATION_DEFINES
    QDOC = $$replace(QDOC, "/", $$QMAKE_DIR_SEP)
}

# Build rules:

online_docs.commands = ($$QDOC $$ONLINE_QDOCCONF)

dita_docs.commands = ($$QDOC $$DITA_QDOCCONF)

qch_docs.commands = ($$QDOC $$OFFLINE_QDOCCONF && \
                     $$GENERATOR -platform minimal $$QHP_FILE -o $$QCH_FILE)

docs.commands = ($$QDOC $$OFFLINE_QDOCCONF && \
                 $$GENERATOR -platform minimal $$QHP_FILE -o $$QCH_FILE && \
                 $$QDOC $$ONLINE_QDOCCONF)

# Install rules

htmldocs.files = html
htmldocs.path = $$[QT_INSTALL_DOCS]
htmldocs.CONFIG += no_check_exist directory

qchdocs.files= qch
qchdocs.path = $$[QT_INSTALL_DOCS]
qchdocs.CONFIG += no_check_exist directory

docimages.files = src/images
docimages.path = $$[QT_INSTALL_DOCS]/src

QMAKE_EXTRA_TARGETS += online_docs qch_docs docs dita_docs
INSTALLS += htmldocs qchdocs docimages


Skip build if it doesn't find airmapd

Skip build if it doesn't find airmapd


clean up qws some more

clean up qws some more

HEADERS  += qxtbasespinbox.h
HEADERS  += qxtcheckcombobox.h
HEADERS  += qxtcheckcombobox_p.h
HEADERS  += qxtconfigdialog.h
HEADERS  += qxtconfigdialog_p.h
HEADERS  += qxtconfirmationmessage.h
HEADERS  += qxtcountrycombobox.h
HEADERS  += qxtcountrycombobox_p.h
HEADERS  += qxtcountrymodel.h
HEADERS  += qxtcountrymodel_p.h
HEADERS  += qxtcrumbview.h
HEADERS  += qxtcrumbview_p.h
HEADERS  += qxtdockwidget.h
HEADERS  += qxtflowview.h
HEADERS  += qxtflowview_p.h
HEADERS  += qxtgui.h
HEADERS  += qxtgroupbox.h
HEADERS  += qxtheaderview.h
HEADERS  += qxtitemdelegate.h
HEADERS  += qxtitemdelegate_p.h
HEADERS  += qxtitemeditorcreator.h
HEADERS  += qxtitemeditorcreatorbase.h
HEADERS  += qxtlabel.h
HEADERS  += qxtletterboxwidget.h
HEADERS  += qxtletterboxwidget_p.h
HEADERS  += qxtlistwidget.h
HEADERS  += qxtlistwidget_p.h
HEADERS  += qxtlistwidgetitem.h
HEADERS  += qxtlanguagecombobox.h
HEADERS  += qxtlanguagecombobox_p.h
HEADERS  += qxtnativeeventfilter.h
HEADERS  += qxtprogresslabel.h
HEADERS  += qxtproxystyle.h
HEADERS  += qxtpushbutton.h
HEADERS  += qxtspanslider.h
HEADERS  += qxtspanslider_p.h
HEADERS  += qxtstandarditemeditorcreator.h
HEADERS  += qxtstars.h
HEADERS  += qxtstringspinbox.h
HEADERS  += qxtstringvalidator.h
HEADERS  += qxtstringvalidator_p.h
HEADERS  += qxttabbar.h
HEADERS  += qxttablewidget.h
HEADERS  += qxttablewidget_p.h
HEADERS  += qxttablewidgetitem.h
HEADERS  += qxttabwidget.h
HEADERS  += qxttabwidget_p.h
HEADERS  += qxttooltip.h
HEADERS  += qxttooltip_p.h
HEADERS  += qxttreewidget.h
HEADERS  += qxttreewidget_p.h
HEADERS  += qxttreewidgetitem.h

HEADERS  += qxtscheduleheaderwidget.h
HEADERS  += qxtscheduleitemdelegate.h
HEADERS  += qxtscheduleview.h
HEADERS  += qxtscheduleviewheadermodel_p.h
HEADERS  += qxtscheduleview_p.h
HEADERS  += qxtstyleoptionscheduleviewitem.h

SOURCES  += qxtbasespinbox.cpp
SOURCES  += qxtcheckcombobox.cpp
SOURCES  += qxtconfigdialog.cpp
SOURCES  += qxtconfirmationmessage.cpp
SOURCES  += qxtcountrymodel.cpp
SOURCES  += qxtcountrycombobox.cpp
SOURCES  += qxtcrumbview.cpp
SOURCES  += qxtdockwidget.cpp
SOURCES  += qxtflowview.cpp
SOURCES  += qxtflowview_p.cpp
SOURCES  += qxtgroupbox.cpp
SOURCES  += qxtheaderview.cpp
SOURCES  += qxtitemdelegate.cpp
SOURCES  += qxtlabel.cpp
SOURCES  += qxtletterboxwidget.cpp
SOURCES  += qxtlistwidget.cpp
SOURCES  += qxtlistwidgetitem.cpp
SOURCES  += qxtlanguagecombobox.cpp
SOURCES  += qxtprogresslabel.cpp
SOURCES  += qxtproxystyle.cpp
SOURCES  += qxtpushbutton.cpp
SOURCES  += qxtspanslider.cpp
SOURCES  += qxtstars.cpp
SOURCES  += qxtstringspinbox.cpp
SOURCES  += qxtstringvalidator.cpp
SOURCES	 += qxttabbar.cpp
SOURCES  += qxttablewidget.cpp
SOURCES  += qxttablewidgetitem.cpp
SOURCES  += qxttabwidget.cpp
SOURCES  += qxttooltip.cpp
SOURCES  += qxttreewidget.cpp
SOURCES  += qxttreewidgetitem.cpp

SOURCES  += qxtscheduleitemdelegate.cpp
SOURCES  += qxtscheduleview.cpp
SOURCES  += qxtscheduleview_p.cpp
SOURCES  += qxtscheduleviewheadermodel_p.cpp
SOURCES  += qxtstyleoptionscheduleviewitem.cpp
SOURCES  += qxtscheduleheaderwidget.cpp

!qws {
    # QxtApplication, QxtGlobalShortcut, and QxtWindowSystem are disabled for QWS pending implementation
    HEADERS  += qxtapplication.h
    HEADERS  += qxtapplication_p.h
    HEADERS  += qxtglobalshortcut.h
    HEADERS  += qxtglobalshortcut_p.h
    HEADERS  += qxtwindowsystem.h

    SOURCES  += qxtapplication.cpp
    SOURCES  += qxtglobalshortcut.cpp
    SOURCES  += qxtwindowsystem.cpp

    unix:!macx:  SOURCES += qxtapplication_x11.cpp qxtwindowsystem_x11.cpp qxtglobalshortcut_x11.cpp
    macx {
           SOURCES += qxtapplication_mac.cpp
           SOURCES += qxtglobalshortcut_mac.cpp
           SOURCES -= qxtwindowsystem.cpp
           HEADERS -= qxtwindowsystem.h
    }
    win32: SOURCES += qxtapplication_win.cpp qxtwindowsystem_win.cpp qxtglobalshortcut_win.cpp
}

RESOURCES += resources.qrc

HEADERS  += qxtbasespinbox.h
HEADERS  += qxtcheckcombobox.h
HEADERS  += qxtcheckcombobox_p.h
HEADERS  += qxtconfigdialog.h
HEADERS  += qxtconfigdialog_p.h
HEADERS  += qxtconfirmationmessage.h
HEADERS  += qxtcountrycombobox.h
HEADERS  += qxtcountrycombobox_p.h
HEADERS  += qxtcountrymodel.h
HEADERS  += qxtcountrymodel_p.h
HEADERS  += qxtcrumbview.h
HEADERS  += qxtcrumbview_p.h
HEADERS  += qxtdockwidget.h
HEADERS  += qxtflowview.h
HEADERS  += qxtflowview_p.h
HEADERS  += qxtgui.h
HEADERS  += qxtgroupbox.h
HEADERS  += qxtheaderview.h
HEADERS  += qxtitemdelegate.h
HEADERS  += qxtitemdelegate_p.h
HEADERS  += qxtitemeditorcreator.h
HEADERS  += qxtitemeditorcreatorbase.h
HEADERS  += qxtlabel.h
HEADERS  += qxtletterboxwidget.h
HEADERS  += qxtletterboxwidget_p.h
HEADERS  += qxtlistwidget.h
HEADERS  += qxtlistwidget_p.h
HEADERS  += qxtlistwidgetitem.h
HEADERS  += qxtlanguagecombobox.h
HEADERS  += qxtlanguagecombobox_p.h
HEADERS  += qxtnativeeventfilter.h
HEADERS  += qxtprogresslabel.h
HEADERS  += qxtproxystyle.h
HEADERS  += qxtpushbutton.h
HEADERS  += qxtspanslider.h
HEADERS  += qxtspanslider_p.h
HEADERS  += qxtstandarditemeditorcreator.h
HEADERS  += qxtstars.h
HEADERS  += qxtstringspinbox.h
HEADERS  += qxtstringvalidator.h
HEADERS  += qxtstringvalidator_p.h
HEADERS  += qxttabbar.h
HEADERS  += qxttablewidget.h
HEADERS  += qxttablewidget_p.h
HEADERS  += qxttablewidgetitem.h
HEADERS  += qxttabwidget.h
HEADERS  += qxttabwidget_p.h
HEADERS  += qxttooltip.h
HEADERS  += qxttooltip_p.h
HEADERS  += qxttreewidget.h
HEADERS  += qxttreewidget_p.h
HEADERS  += qxttreewidgetitem.h

HEADERS  += qxtscheduleheaderwidget.h
HEADERS  += qxtscheduleitemdelegate.h
HEADERS  += qxtscheduleview.h
HEADERS  += qxtscheduleviewheadermodel_p.h
HEADERS  += qxtscheduleview_p.h
HEADERS  += qxtstyleoptionscheduleviewitem.h

SOURCES  += qxtapplication.cpp
SOURCES  += qxtbasespinbox.cpp
SOURCES  += qxtcheckcombobox.cpp
SOURCES  += qxtconfigdialog.cpp
SOURCES  += qxtconfirmationmessage.cpp
SOURCES  += qxtcountrymodel.cpp
SOURCES  += qxtcountrycombobox.cpp
SOURCES  += qxtcrumbview.cpp
SOURCES  += qxtdockwidget.cpp
SOURCES  += qxtflowview.cpp
SOURCES  += qxtflowview_p.cpp
SOURCES  += qxtgroupbox.cpp
SOURCES  += qxtheaderview.cpp
SOURCES  += qxtitemdelegate.cpp
SOURCES  += qxtlabel.cpp
SOURCES  += qxtletterboxwidget.cpp
SOURCES  += qxtlistwidget.cpp
SOURCES  += qxtlistwidgetitem.cpp
SOURCES  += qxtlanguagecombobox.cpp
SOURCES  += qxtprogresslabel.cpp
SOURCES  += qxtproxystyle.cpp
SOURCES  += qxtpushbutton.cpp
SOURCES  += qxtspanslider.cpp
SOURCES  += qxtstars.cpp
SOURCES  += qxtstringspinbox.cpp
SOURCES  += qxtstringvalidator.cpp
SOURCES	 += qxttabbar.cpp
SOURCES  += qxttablewidget.cpp
SOURCES  += qxttablewidgetitem.cpp
SOURCES  += qxttabwidget.cpp
SOURCES  += qxttooltip.cpp
SOURCES  += qxttreewidget.cpp
SOURCES  += qxttreewidgetitem.cpp
SOURCES  += qxtwindowsystem.cpp

SOURCES  += qxtscheduleitemdelegate.cpp
SOURCES  += qxtscheduleview.cpp
SOURCES  += qxtscheduleview_p.cpp
SOURCES  += qxtscheduleviewheadermodel_p.cpp
SOURCES  += qxtstyleoptionscheduleviewitem.cpp
SOURCES  += qxtscheduleheaderwidget.cpp

!qws {
    HEADERS  += qxtapplication.h
    HEADERS  += qxtapplication_p.h
    HEADERS  += qxtglobalshortcut.h
    HEADERS  += qxtglobalshortcut_p.h
    HEADERS  += qxtwindowsystem.h
    SOURCES  += qxtglobalshortcut.cpp
    unix:!macx:  SOURCES += qxtapplication_x11.cpp qxtwindowsystem_x11.cpp qxtglobalshortcut_x11.cpp
    macx {
           SOURCES += qxtapplication_mac.cpp
           SOURCES += qxtglobalshortcut_mac.cpp
           SOURCES -= qxtwindowsystem.cpp
           HEADERS -= qxtwindowsystem.h
    }
    win32: SOURCES += qxtapplication_win.cpp qxtwindowsystem_win.cpp qxtglobalshortcut_win.cpp
}

RESOURCES += resources.qrc


Version 0.144

Version 0.144


Fix libsodium linking on Windows

Fix libsodium linking on Windows

MEGASDK_BASE_PATH = $$PWD/../../

# Define MEGA_USE_C_ARES by default. Allow disabling c-ares code
# by defining env var MEGA_USE_C_ARES=no before running qmake.
ENV_MEGA_USE_C_ARES=$$(MEGA_USE_C_ARES)
!equals(ENV_MEGA_USE_C_ARES, "no") {
DEFINES += MEGA_USE_C_ARES
}

THIRDPARTY_VCPKG_PATH = $$THIRDPARTY_VCPKG_BASE_PATH/vcpkg/installed/$$VCPKG_TRIPLET
exists($$THIRDPARTY_VCPKG_PATH) {
   CONFIG += vcpkg
}
vcpkg:debug:message("Building DEBUG with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH")
vcpkg:release:message("Building RELEASE with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH")
!vcpkg:message("vcpkg not used")

debug:DEBUG_SUFFIX = "d"
else:DEBUG_SUFFIX = ""
debug:DASH_DEBUG_SUFFIX = "-d"
else:DASH_DEBUG_SUFFIX = ""
debug:UNDERSCORE_DEBUG_SUFFIX = "_d"
else:UNDERSCORE_DEBUG_SUFFIX = ""

debug:win32:DEBUG_SUFFIX_WO = "d"
else:DEBUG_SUFFIX_WO = ""

MI_DEBUG_SUFFIX = ""
debug:macx:MI_DEBUG_SUFFIX = "_debug"
debug:win32:MI_DEBUG_SUFFIX = "d"

VPATH += $$MEGASDK_BASE_PATH
SOURCES += src/attrmap.cpp \
    src/backofftimer.cpp \
    src/base64.cpp \
    src/command.cpp \
    src/commands.cpp \
    src/db.cpp \
    src/gfx.cpp \
    src/file.cpp \
    src/fileattributefetch.cpp \
    src/filefingerprint.cpp \
    src/filesystem.cpp \
    src/http.cpp \
    src/json.cpp \
    src/megaclient.cpp \
    src/node.cpp \
    src/pubkeyaction.cpp \
    src/request.cpp \
    src/serialize64.cpp \
    src/share.cpp \
    src/sharenodekeys.cpp \
    src/sync.cpp \
    src/transfer.cpp \
    src/transferslot.cpp \
    src/treeproc.cpp \
    src/user.cpp \
    src/useralerts.cpp \
    src/utils.cpp \
    src/logging.cpp \
    src/waiterbase.cpp  \
    src/proxy.cpp \
    src/pendingcontactrequest.cpp \
    src/textchat.cpp \
    src/crypto/cryptopp.cpp  \
    src/crypto/sodium.cpp  \
    src/db/sqlite.cpp  \
    src/gfx/external.cpp \
    src/mega_utf8proc.cpp \
    src/mega_ccronexpr.cpp \
    src/mega_evt_tls.cpp \
    src/mega_zxcvbn.cpp \
    src/mediafileattribute.cpp \
    src/raid.cpp \
    src/testhooks.cpp \
    src/heartbeats.cpp

CONFIG(USE_MEGAAPI) {
  SOURCES += src/megaapi.cpp src/megaapi_impl.cpp

  CONFIG(qt) {
    SOURCES += bindings/qt/QTMegaRequestListener.cpp \
        bindings/qt/QTMegaTransferListener.cpp \
        bindings/qt/QTMegaGlobalListener.cpp \
        bindings/qt/QTMegaListener.cpp \
        bindings/qt/QTMegaEvent.cpp
  }
}

!win32 {
    QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Wconversion -Wno-unused-parameter

    unix:!macx {
        GCC_VERSION = $$system("g++ -dumpversion")
        !lessThan(GCC_VERSION, 5) {
            LIBS += -lstdc++fs
        }
    }
}
else {
    # flags synced with contrib/cmake/CMakeLists.txt
    QMAKE_CXXFLAGS_WARN_ON ~= s/-W3/-W4
    QMAKE_CXXFLAGS += /wd4201 /wd4100 /wd4706 /wd4458 /wd4324 /wd4456 /wd4266
}

CONFIG(ENABLE_WERROR_COMPILATION) {
    !win32 {
        QMAKE_CXXFLAGS += -Werror
    }
    else {
        QMAKE_CXXFLAGS += /WX
    }
}

CONFIG(USE_ROTATIVEPERFORMANCELOGGER) {
  SOURCES += src/rotativeperformancelogger.cpp
}

CONFIG(USE_AUTOCOMPLETE) {
    SOURCES += src/autocomplete.cpp
    HEADERS += include/mega/autocomplete.h
}

CONFIG(USE_POLL) {
    DEFINES += USE_POLL
}

CONFIG(USE_CONSOLE) {
    win32 {

        HEADERS += include/mega/win32/megaconsole.h
        HEADERS += include/mega/win32/megaconsolewaiter.h

        CONFIG(noreadline) {
            DEFINES += NO_READLINE
            SOURCES += src/win32/console.cpp
            SOURCES += src/win32/consolewaiter.cpp
        }
        else {
            DEFINES += USE_READLINE_STATIC
            SOURCES += src/wincurl/console.cpp
            SOURCES += src/wincurl/consolewaiter.cpp
            LIBS += -lreadline
        }
        QMAKE_CXXFLAGS+=/Zc:__cplusplus /std:c++ #this will set _cplusplus correctly in MSVC >= 2017 15.7 Preview 3
    }
    else {
        HEADERS += include/mega/posix/megaconsole.h
        HEADERS += include/mega/posix/megaconsolewaiter.h
        SOURCES += src/posix/console.cpp
        SOURCES += src/posix/consolewaiter.cpp
        LIBS += -lreadline
        macx:vcpkg{
            debug:LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libhistory.a
            !debug:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libhistory.a
            LIBS += -ltermcap
        }
    }
}

CONFIG(ENABLE_CHAT) {
    CONFIG += USE_LIBUV

    !macx {
        !vcpkg:exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a -lcap
        }
        else {
            vcpkg:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libwebsockets.a -lcap
            !vcpkg:LIBS += -lwebsockets -lcap
        }
    }
    else {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a
        }
        else {
        LIBS += -lwebsockets
        }
    }
}

CONFIG(USE_LIBUV) {
    SOURCES += src/mega_http_parser.cpp
    DEFINES += HAVE_LIBUV
    vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/libuv
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libuv
    win32 {
        LIBS += -llibuv -lIphlpapi -lUserenv -lpsapi
    }

    unix:!macx {
       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libuv.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libuv.a
       }
       else {
        vcpkg:LIBS += -llibuv
        else:LIBS += -luv
       }
    }

    macx {
        vcpkg:LIBS += -llibuv
        !vcpkg:LIBS += -luv
    }
}

CONFIG(USE_MEDIAINFO) {
    DEFINES += USE_MEDIAINFO UNICODE

    vcpkg:LIBS += -lmediainfo$$MI_DEBUG_SUFFIX -lzen$$MI_DEBUG_SUFFIX
    vcpkg:win32:LIBS += -lzlib$$DEBUG_SUFFIX
    vcpkg:!win32:LIBS += -lz

    !vcpkg:win32 {
        vcpkg:LIBS += -lmediainfo$$DEBUG_SUFFIX -lzen$$DEBUG_SUFFIX -lzlib$$DEBUG_SUFFIX
        else:LIBS += -lMediaInfo -lZenLib -lzlibstat
    }

    !vcpkg:macx {
        LIBS += -lmediainfo -lzen -lz
    }

    !vcpkg:unix:!macx {

       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libmediainfo.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libmediainfo.a
       }
       else {
        LIBS += -lmediainfo
       }
       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libzen.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libzen.a
       }
       else {
        LIBS += -lzen
       }
    }
}

CONFIG(USE_LIBRAW) {
    DEFINES += HAVE_LIBRAW

    vcpkg:LIBS += -lraw_r$$DEBUG_SUFFIX -ljasper$$DEBUG_SUFFIX
    vcpkg:win32:LIBS += -ljpeg
    vcpkg:!win32:LIBS += -ljpeg
    vcpkg:unix:!macx:LIBS += -lgomp
    vcpkg:!CONFIG(USE_PDFIUM):LIBS += -llcms$$DEBUG_SUFFIX

    win32 {
        DEFINES += LIBRAW_NODLL
        !vcpkg:LIBS += -llibraw
    }

    !vcpkg:macx {
        LIBS += -lraw
    }

    !vcpkg:unix:!macx {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libraw.a) {
            LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libraw.a -fopenmp
        }
        else {
            LIBS += -lraw -fopenmp
        }
    }
}

CONFIG(USE_PDFIUM) {

    SOURCES += src/gfx/gfx_pdfium.cpp

    vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/pdfium
    vcpkg:LIBS += -lpdfium -lfreetype$$DEBUG_SUFFIX -ljpeg -lopenjp2  -llcms$$DEBUG_SUFFIX

    #make sure we get the vcpkg built icu libraries and not a system one with the same name
    vcpkg {
        win32 {
            vcpkg:LIBS += -lbz2$$DEBUG_SUFFIX_WO -licudt$$DEBUG_SUFFIX_WO
            debug: LIBS += -l$$THIRDPARTY_VCPKG_PATH/debug/lib/icuucd -l$$THIRDPARTY_VCPKG_PATH/debug/lib/icuiod
            !debug: LIBS += -l$$THIRDPARTY_VCPKG_PATH/lib/icuuc$$DEBUG_SUFFIX_WO.lib -l$$THIRDPARTY_VCPKG_PATH/lib/icuio$$DEBUG_SUFFIX_WO.lib
            #QMAKE_LFLAGS_WINDOWS += /VERBOSE
        }
        else {
            debug {
                # icu doesn't build debug libs with 'd' suffix, but check anyway
                exists($$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc$$DEBUG_SUFFIX.a) {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc$$DEBUG_SUFFIX.a
                }
                else {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc.a
                }
                exists($$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio$$DEBUG_SUFFIX.a) {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio$$DEBUG_SUFFIX.a
                }
                else {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio.a
                }
            }
            !debug: LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libicuuc.a $$THIRDPARTY_VCPKG_PATH/lib/libicuio.a
        }
    }

    vcpkg:unix:!macx:LIBS += -lharfbuzz #freetype dependencies. ideally we could use pkg-config to get these
    vcpkg:unix:LIBS += -lpng
    # is it needed? win has it, mac does not -licuin$$DEBUG_SUFFIX_WO
    vcpkg:win32:LIBS += -lGdi32  -llibpng16$$DEBUG_SUFFIX
    vcpkg:DEFINES += HAVE_PDFIUM

    !vcpkg {
        unix:!macx {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libpdfium.a) {
                DEFINES += HAVE_PDFIUM
                INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium
                LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libpdfium.a
            }
            else:exists(/usr/include/fpdfview.h) {
                DEFINES += HAVE_PDFIUM
                LIBS += -lpdfium
            }
        }
        else {#win/mac
            DEFINES += HAVE_PDFIUM
            INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium
            LIBS += -lpdfium
        }
    }
}

CONFIG(USE_FFMPEG) {

    unix:!macx {
        # On Linux, vcpkg provides libavresample instead of libswresample
        vcpkg:LIBS += -lavformat -lavcodec -lavutil -lswscale -lavresample
        else {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg):exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libavcodec.a) {
            DEFINES += HAVE_FFMPEG
                INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg
                FFMPEGLIBPATH = $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib
            }
            else:exists(/usr/include/ffmpeg-mega) {
                DEFINES += HAVE_FFMPEG
                INCLUDEPATH += /usr/include/ffmpeg-mega
                exists(/usr/lib64/libavcodec.a) {
                    FFMPEGLIBPATH = /usr/lib64
                }
                else:exists(/usr/lib32/libavcodec.a) {
                    FFMPEGLIBPATH = /usr/lib32
                }
                else {
                   FFMPEGLIBPATH = /usr/lib
                }
            }
            else:packagesExist(ffmpeg)|packagesExist(libavcodec) {
                DEFINES += HAVE_FFMPEG
                LIBS += -lavcodec -lavformat -lavutil -lswscale -lswresample
            }

            FFMPEGSTATICLIBS = libavformat.a libavcodec.a libavutil.a libswscale.a

            for(ffmpeglib, FFMPEGSTATICLIBS) {
                exists($$FFMPEGLIBPATH/$$ffmpeglib) {
                    LIBS += $$FFMPEGLIBPATH/$$ffmpeglib
                }
            }

            #particular distros requirements
            exists(/usr/lib64/libbz2.so*)|exists(/usr/lib/libbz2.so*) {
                LIBS += -lbz2 #required in fedora ffmpeg/arch compilation
            }

            exists(/usr/lib/liblzma.so*):exists(/etc/arch-release) {
                LIBS += -llzma #required in arch ffmpeg compilation
            }
            CONFIG(FFMPEG_WITH_LZMA) {
                LIBS += -llzma #required in fedora >= 35 ffmpeg compilation
            }
        }
    }
    else { #win/mac
        DEFINES += HAVE_FFMPEG
        vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/ffmpeg
        else:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg
        LIBS += -lavcodec -lavformat -lavutil -lswscale
        vcpkg:macx {
            debug:LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libbz2d.a
            else:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libbz2.a
        }
    }
}

CONFIG(USE_WEBRTC) {

    DEFINES += ENABLE_WEBRTC V8_DEPRECATION_WARNINGS USE_OPENSSL_CERTS=1 NO_TCMALLOC DISABLE_NACL SAFE_BROWSING_DB_REMOTE \
               CHROMIUM_BUILD FIELDTRIAL_TESTING_ENABLED _FILE_OFFSET_BITS=64 __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS \
               _FORTIFY_SOURCE=2 __GNU_SOURCE=1 __compiler_offsetof=__builtin_offsetof NVALGRIND DYNAMIC_ANNOTATIONS_ENABLED=0 \
               WEBRTC_ENABLE_PROTOBUF=1 WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE EXPAT_RELATIVE_PATH HAVE_SCTP

    unix {
        DEFINES += WEBRTC_POSIX WEBRTC_LINUX WEBRTC_BUILD_LIBEVENT
    }

    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/webrtc \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/boringssl/src/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/libyuv/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/abseil-cpp
    !macx {
    exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a -ldl -lX11
    }
    else {
        LIBS += -lwebrtc -ldl -lX11
    }
    }
    else {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a -ldl
        }
        else {
        LIBS += -lwebrtc -ldl
        }
    }
}

CONFIG(USE_ROTATIVEPERFORMANCELOGGER) {
    DEFINES += USE_ROTATIVEPERFORMANCELOGGER
    DEFINES += ENABLE_LOG_PERFORMANCE
}

win32 {
    # comment this line to use WinHTTP on Windows
    CONFIG += USE_CURL

    CONFIG(USE_CURL) {
        SOURCES += src/wincurl/net.cpp  \
            src/wincurl/fs.cpp  \
            src/wincurl/waiter.cpp
        HEADERS += include/mega/wincurl/meganet.h
        DEFINES += USE_CURL USE_OPENSSL
        !vcpkg:LIBS +=  -llibcurl -lcares -llibeay32 -lssleay32
    }
    else {
        SOURCES += src/win32/net.cpp \
            src/win32/fs.cpp \
            src/win32/waiter.cpp
        HEADERS += include/mega/win32/meganet.h
    }

    # link winhttp anyway (required for automatic proxy detection)
    LIBS += -lwinhttp -ladvapi32
    DEFINES += _CRT_SECURE_NO_WARNINGS
}
else:CONFIG += USE_CURL

unix {
SOURCES += src/posix/net.cpp  \
    src/posix/fs.cpp  \
    src/posix/waiter.cpp
}

HEADERS  += include/mega.h \
            include/mega/account.h \
            include/mega/attrmap.h \
            include/mega/backofftimer.h \
            include/mega/base64.h \
            include/mega/command.h \
            include/mega/console.h \
            include/mega/db.h \
            include/mega/gfx.h \
            include/mega/file.h \
            include/mega/fileattributefetch.h \
            include/mega/filefingerprint.h \
            include/mega/filesystem.h \
            include/mega/http.h \
            include/mega/json.h \
            include/mega/megaapp.h \
            include/mega/megaclient.h \
            include/mega/node.h \
            include/mega/pubkeyaction.h \
            include/mega/request.h \
            include/mega/serialize64.h \
            include/mega/share.h \
            include/mega/sharenodekeys.h \
            include/mega/sync.h \
            include/mega/heartbeats.h \
            include/mega/transfer.h \
            include/mega/transferslot.h \
            include/mega/treeproc.h \
            include/mega/types.h \
            include/mega/user.h \
            include/mega/useralerts.h \
            include/mega/utils.h \
            include/mega/logging.h \
            include/mega/waiter.h \
            include/mega/proxy.h \
            include/mega/pendingcontactrequest.h \
            include/mega/textchat.h \
            include/mega/crypto/cryptopp.h  \
            include/mega/crypto/sodium.h  \
            include/mega/db/sqlite.h  \
            include/mega/gfx/freeimage.h \
            include/mega/gfx/gfx_pdfium.h \
            include/mega/gfx/external.h \
            include/mega/thread.h \
            include/mega/thread/cppthread.h \
            include/megaapi.h \
            include/megaapi_impl.h \
            include/mega/mega_utf8proc.h \
            include/mega/mega_ccronexpr.h \
            include/mega/mega_evt_tls.h \
            include/mega/mega_evt_queue.h \
            include/mega/thread/posixthread.h \
            include/mega/mega_zxcvbn.h \
            include/mega/mediafileattribute.h \
            include/mega/raid.h \
            include/mega/testhooks.h \
            include/mega/drivenotify.h

CONFIG(USE_MEGAAPI) {
    HEADERS += bindings/qt/QTMegaRequestListener.h \
            bindings/qt/QTMegaTransferListener.h \
            bindings/qt//QTMegaGlobalListener.h \
            bindings/qt/QTMegaListener.h \
            bindings/qt/QTMegaEvent.h
}

win32 {
    HEADERS  += include/mega/win32/megasys.h  \
            include/mega/win32/megafs.h  \
            include/mega/win32/megawaiter.h

    !vcpkg:SOURCES += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/sqlite3.c
}

unix {
    !exists($$MEGASDK_BASE_PATH/include/mega/config.h) {
        error("Configuration file not found! Please re-run configure script located in the project's root directory!")
    }
    HEADERS  += include/mega/posix/meganet.h  \
            include/mega/posix/megasys.h  \
            include/mega/posix/megafs.h  \
            include/mega/posix/megawaiter.h \
            include/mega/config.h
}

CONFIG(USE_PCRE) {
  DEFINES += USE_PCRE
}

CONFIG(qt) {
  DEFINES += USE_QT MEGA_QT_LOGGING
}

win32 {
    DEFINES += USE_CPPTHREAD
    SOURCES += src/thread/cppthread.cpp
}
else {
    DEFINES += USE_PTHREAD
    SOURCES += src/thread/posixthread.cpp
    LIBS += -lpthread
}

!CONFIG(nofreeimage) {
    DEFINES += USE_FREEIMAGE
    SOURCES += src/gfx/freeimage.cpp

    vcpkg {
        win32:LIBS += -llibpng16$$DEBUG_SUFFIX -llibwebpmux$$DEBUG_SUFFIX
        else {
            LIBS += -lpng16$$DEBUG_SUFFIX -lwebpmux$$DEBUG_SUFFIX
        }

        LIBS += -lfreeimage$$DEBUG_SUFFIX -ljpeg -ltiff$$DEBUG_SUFFIX \
        -lIlmImf-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIex-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIlmThread-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -lIexMath-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIlmImfUtil-2_5$$UNDERSCORE_DEBUG_SUFFIX -lImath-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -lwebpdecoder$$DEBUG_SUFFIX -lwebpdemux$$DEBUG_SUFFIX -lwebp$$DEBUG_SUFFIX \
        -ljpegxr$$DEBUG_SUFFIX -ljxrglue$$DEBUG_SUFFIX -lHalf-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -llzma$$DEBUG_SUFFIX -ljasper$$DEBUG_SUFFIX -lraw_r$$DEBUG_SUFFIX -lopenjp2
    }
    else {
        macx{
            INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/FreeImage/Source
            LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a
        }
        else {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.so.3) {
                LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.so.3
            }
            else {
                exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a) {
                    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a
                }
                else {
                    LIBS += -lfreeimage
                }
            }
        }
    }
}

DEFINES += USE_SQLITE USE_CRYPTOPP ENABLE_SYNC ENABLE_CHAT
INCLUDEPATH += $$MEGASDK_BASE_PATH/include
INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt
vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include
else:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include

!release {
    DEFINES += SQLITE_DEBUG DEBUG
}
else {
    DEFINES += NDEBUG
}

vcpkg {
    INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/zlib
    INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/libsodium

    CONFIG(USE_CURL) {
        !macx:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/openssl
        INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/cares
        win32:LIBS +=  -llibcurl$$DASH_DEBUG_SUFFIX -lcares -llibcrypto -llibssl
        else {
            LIBS +=  -lcurl$$DASH_DEBUG_SUFFIX -lcares
            !macx:LIBS += -lcrypto -lssl
        }
    }

    CONFIG(USE_PCRE) {
        INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/pcre
        DEFINES += PCRE_STATIC
        LIBS += -lpcre
    }

    CONFIG(USE_PDFIUM):INCLUDEPATH += $$THIRDPARTY_VCPKG_BASE_PATH/pdfium/pdfium/public

    release:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/lib"
    debug:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/debug/lib"

    win32:LIBS += -llibsodium -lcryptopp-static -lzlib$$DEBUG_SUFFIX
    else:LIBS += -lsodium -lcryptopp -lz
    win32:DEFINES += SODIUM_STATIC
    LIBS += -lsqlite3
}

win32 {
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/zlib
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libsodium

    CONFIG(USE_CURL) {
        INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/wincurl
        !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/openssl
        !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/cares
    }
    else {
        INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/win32
    }

    !vcpkg:contains(CONFIG, BUILDX64) {
       release {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x64"
        }
        else {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x64d"
        }
    }

    !vcpkg:!contains(CONFIG, BUILDX64) {
        release {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x32"
        }
        else {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x32d"
        }
    }

    CONFIG(USE_PCRE) {
     INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pcre
     DEFINES += PCRE_STATIC
     LIBS += -lpcre
    }

    LIBS += -lshlwapi -lws2_32 -luser32
    !vcpkg:LIBS += -lsodium -lcryptopp -lzlibstat

    DEFINES += NOMINMAX
}

unix:!macx {
   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/posix
   LIBS += -lsqlite3 -lrt

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a) {
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a
   }
   else {
    vcpkg:LIBS += -lcurl$$DASH_DEBUG_SUFFIX
    else:LIBS += -lcurl
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libz.a) {
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libz.a
   }
   else {
    LIBS += -lz
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a
   }
   else {
    LIBS += -lssl
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a
   }
   else {
    LIBS += -lcrypto
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcryptopp.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcryptopp.a
   }
   else {
    LIBS += -lcryptopp
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a
   }
   else {
    LIBS += -lcares
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a
   }
   else {
    LIBS += -lsodium
   }

   CONFIG(USE_PCRE) {
    DEFINES += PCRE_STATIC
    exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libpcre.a) {
     LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libpcre.a
    }
    else {
     LIBS += -lpcre
    }
   }
}

macx {
   # recreate source folder tree for object files. Needed to build osx/fs.cpp and posix/fs.cpp,
   # otherwise all obj files are placed into same directory, causing overwrite.
   CONFIG += object_parallel_to_source

   HEADERS += $$MEGASDK_BASE_PATH/include/mega/osx/megafs.h
   SOURCES += $$MEGASDK_BASE_PATH/src/osx/fs.cpp

   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/osx
   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/posix

   OBJECTIVE_SOURCES += $$MEGASDK_BASE_PATH/src/osx/osxutils.mm

   !vcpkg:SOURCES += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/sqlite3.c

   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/curl
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libsodium
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/cares
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/mediainfo
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/zenlib
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium

   !vcpkg:CONFIG(USE_PCRE) {
    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pcre
    DEFINES += PCRE_STATIC
    LIBS += -lpcre
   }

   DEFINES += _DARWIN_FEATURE_64_BIT_INODE CRYPTOPP_DISABLE_ASM

   !vcpkg:LIBS += -L$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/ $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a \
                    $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a -lcryptopp
   LIBS += -lz

   !vcpkg:CONFIG(USE_OPENSSL) {
    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/openssl
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a
   }

   LIBS += -framework SystemConfiguration

   vcpkg:LIBS += -liconv -framework CoreServices -framework CoreFoundation -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework CoreMedia -framework VideoToolbox -framework ImageIO -framework CoreVideo
}

# DriveNotify settings
CONFIG(USE_DRIVE_NOTIFICATIONS) {
    DEFINES += USE_DRIVE_NOTIFICATIONS
    SOURCES += src/drivenotify.cpp

    win32 {
        # Allegedly not supported by non-msvc compilers.
        HEADERS += include/mega/win32/drivenotifywin.h
        SOURCES += src/win32/drivenotifywin.cpp
        LIBS += -lwbemuuid
    }
    unix:!macx {
        HEADERS += include/mega/posix/drivenotifyposix.h
        SOURCES += src/posix/drivenotifyposix.cpp
        LIBS += -ludev
    }
    macx {
        HEADERS += include/mega/osx/drivenotifyosx.h
        SOURCES += src/osx/drivenotifyosx.cpp
        LIBS += -framework DiskArbitration -framework CoreFoundation
    }
}

MEGASDK_BASE_PATH = $$PWD/../../

# Define MEGA_USE_C_ARES by default. Allow disabling c-ares code
# by defining env var MEGA_USE_C_ARES=no before running qmake.
ENV_MEGA_USE_C_ARES=$$(MEGA_USE_C_ARES)
!equals(ENV_MEGA_USE_C_ARES, "no") {
DEFINES += MEGA_USE_C_ARES
}

THIRDPARTY_VCPKG_PATH = $$THIRDPARTY_VCPKG_BASE_PATH/vcpkg/installed/$$VCPKG_TRIPLET
exists($$THIRDPARTY_VCPKG_PATH) {
   CONFIG += vcpkg
}
vcpkg:debug:message("Building DEBUG with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH")
vcpkg:release:message("Building RELEASE with VCPKG 3rdparty at $$THIRDPARTY_VCPKG_PATH")
!vcpkg:message("vcpkg not used")

debug:DEBUG_SUFFIX = "d"
else:DEBUG_SUFFIX = ""
debug:DASH_DEBUG_SUFFIX = "-d"
else:DASH_DEBUG_SUFFIX = ""
debug:UNDERSCORE_DEBUG_SUFFIX = "_d"
else:UNDERSCORE_DEBUG_SUFFIX = ""

debug:win32:DEBUG_SUFFIX_WO = "d"
else:DEBUG_SUFFIX_WO = ""

MI_DEBUG_SUFFIX = ""
debug:macx:MI_DEBUG_SUFFIX = "_debug"
debug:win32:MI_DEBUG_SUFFIX = "d"

VPATH += $$MEGASDK_BASE_PATH
SOURCES += src/attrmap.cpp \
    src/backofftimer.cpp \
    src/base64.cpp \
    src/command.cpp \
    src/commands.cpp \
    src/db.cpp \
    src/gfx.cpp \
    src/file.cpp \
    src/fileattributefetch.cpp \
    src/filefingerprint.cpp \
    src/filesystem.cpp \
    src/http.cpp \
    src/json.cpp \
    src/megaclient.cpp \
    src/node.cpp \
    src/pubkeyaction.cpp \
    src/request.cpp \
    src/serialize64.cpp \
    src/share.cpp \
    src/sharenodekeys.cpp \
    src/sync.cpp \
    src/transfer.cpp \
    src/transferslot.cpp \
    src/treeproc.cpp \
    src/user.cpp \
    src/useralerts.cpp \
    src/utils.cpp \
    src/logging.cpp \
    src/waiterbase.cpp  \
    src/proxy.cpp \
    src/pendingcontactrequest.cpp \
    src/textchat.cpp \
    src/crypto/cryptopp.cpp  \
    src/crypto/sodium.cpp  \
    src/db/sqlite.cpp  \
    src/gfx/external.cpp \
    src/mega_utf8proc.cpp \
    src/mega_ccronexpr.cpp \
    src/mega_evt_tls.cpp \
    src/mega_zxcvbn.cpp \
    src/mediafileattribute.cpp \
    src/raid.cpp \
    src/testhooks.cpp \
    src/heartbeats.cpp

CONFIG(USE_MEGAAPI) {
  SOURCES += src/megaapi.cpp src/megaapi_impl.cpp

  CONFIG(qt) {
    SOURCES += bindings/qt/QTMegaRequestListener.cpp \
        bindings/qt/QTMegaTransferListener.cpp \
        bindings/qt/QTMegaGlobalListener.cpp \
        bindings/qt/QTMegaListener.cpp \
        bindings/qt/QTMegaEvent.cpp
  }
}

!win32 {
    QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Wconversion -Wno-unused-parameter

    unix:!macx {
        GCC_VERSION = $$system("g++ -dumpversion")
        !lessThan(GCC_VERSION, 5) {
            LIBS += -lstdc++fs
        }
    }
}
else {
    # flags synced with contrib/cmake/CMakeLists.txt
    QMAKE_CXXFLAGS_WARN_ON ~= s/-W3/-W4
    QMAKE_CXXFLAGS += /wd4201 /wd4100 /wd4706 /wd4458 /wd4324 /wd4456 /wd4266
}

CONFIG(ENABLE_WERROR_COMPILATION) {
    !win32 {
        QMAKE_CXXFLAGS += -Werror
    }
    else {
        QMAKE_CXXFLAGS += /WX
    }
}

CONFIG(USE_ROTATIVEPERFORMANCELOGGER) {
  SOURCES += src/rotativeperformancelogger.cpp
}

CONFIG(USE_AUTOCOMPLETE) {
    SOURCES += src/autocomplete.cpp
    HEADERS += include/mega/autocomplete.h
}

CONFIG(USE_POLL) {
    DEFINES += USE_POLL
}

CONFIG(USE_CONSOLE) {
    win32 {

        HEADERS += include/mega/win32/megaconsole.h
        HEADERS += include/mega/win32/megaconsolewaiter.h

        CONFIG(noreadline) {
            DEFINES += NO_READLINE
            SOURCES += src/win32/console.cpp
            SOURCES += src/win32/consolewaiter.cpp
        }
        else {
            DEFINES += USE_READLINE_STATIC
            SOURCES += src/wincurl/console.cpp
            SOURCES += src/wincurl/consolewaiter.cpp
            LIBS += -lreadline
        }
        QMAKE_CXXFLAGS+=/Zc:__cplusplus /std:c++ #this will set _cplusplus correctly in MSVC >= 2017 15.7 Preview 3
    }
    else {
        HEADERS += include/mega/posix/megaconsole.h
        HEADERS += include/mega/posix/megaconsolewaiter.h
        SOURCES += src/posix/console.cpp
        SOURCES += src/posix/consolewaiter.cpp
        LIBS += -lreadline
        macx:vcpkg{
            debug:LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libhistory.a
            !debug:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libhistory.a
            LIBS += -ltermcap
        }
    }
}

CONFIG(ENABLE_CHAT) {
    CONFIG += USE_LIBUV

    !macx {
        !vcpkg:exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a -lcap
        }
        else {
            vcpkg:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libwebsockets.a -lcap
            !vcpkg:LIBS += -lwebsockets -lcap
        }
    }
    else {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebsockets.a
        }
        else {
        LIBS += -lwebsockets
        }
    }
}

CONFIG(USE_LIBUV) {
    SOURCES += src/mega_http_parser.cpp
    DEFINES += HAVE_LIBUV
    vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/libuv
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libuv
    win32 {
        LIBS += -llibuv -lIphlpapi -lUserenv -lpsapi
    }

    unix:!macx {
       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libuv.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libuv.a
       }
       else {
        vcpkg:LIBS += -llibuv
        else:LIBS += -luv
       }
    }

    macx {
        vcpkg:LIBS += -llibuv
        !vcpkg:LIBS += -luv
    }
}

CONFIG(USE_MEDIAINFO) {
    DEFINES += USE_MEDIAINFO UNICODE

    vcpkg:LIBS += -lmediainfo$$MI_DEBUG_SUFFIX -lzen$$MI_DEBUG_SUFFIX
    vcpkg:win32:LIBS += -lzlib$$DEBUG_SUFFIX
    vcpkg:!win32:LIBS += -lz

    !vcpkg:win32 {
        vcpkg:LIBS += -lmediainfo$$DEBUG_SUFFIX -lzen$$DEBUG_SUFFIX -lzlib$$DEBUG_SUFFIX
        else:LIBS += -lMediaInfo -lZenLib -lzlibstat
    }

    !vcpkg:macx {
        LIBS += -lmediainfo -lzen -lz
    }

    !vcpkg:unix:!macx {

       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libmediainfo.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libmediainfo.a
       }
       else {
        LIBS += -lmediainfo
       }
       exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libzen.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libzen.a
       }
       else {
        LIBS += -lzen
       }
    }
}

CONFIG(USE_LIBRAW) {
    DEFINES += HAVE_LIBRAW

    vcpkg:LIBS += -lraw_r$$DEBUG_SUFFIX -ljasper$$DEBUG_SUFFIX
    vcpkg:win32:LIBS += -ljpeg
    vcpkg:!win32:LIBS += -ljpeg
    vcpkg:unix:!macx:LIBS += -lgomp
    vcpkg:!CONFIG(USE_PDFIUM):LIBS += -llcms$$DEBUG_SUFFIX

    win32 {
        DEFINES += LIBRAW_NODLL
        !vcpkg:LIBS += -llibraw
    }

    !vcpkg:macx {
        LIBS += -lraw
    }

    !vcpkg:unix:!macx {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libraw.a) {
            LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libraw.a -fopenmp
        }
        else {
            LIBS += -lraw -fopenmp
        }
    }
}

CONFIG(USE_PDFIUM) {

    SOURCES += src/gfx/gfx_pdfium.cpp

    vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/pdfium
    vcpkg:LIBS += -lpdfium -lfreetype$$DEBUG_SUFFIX -ljpeg -lopenjp2  -llcms$$DEBUG_SUFFIX

    #make sure we get the vcpkg built icu libraries and not a system one with the same name
    vcpkg {
        win32 {
            vcpkg:LIBS += -lbz2$$DEBUG_SUFFIX_WO -licudt$$DEBUG_SUFFIX_WO
            debug: LIBS += -l$$THIRDPARTY_VCPKG_PATH/debug/lib/icuucd -l$$THIRDPARTY_VCPKG_PATH/debug/lib/icuiod
            !debug: LIBS += -l$$THIRDPARTY_VCPKG_PATH/lib/icuuc$$DEBUG_SUFFIX_WO.lib -l$$THIRDPARTY_VCPKG_PATH/lib/icuio$$DEBUG_SUFFIX_WO.lib
            #QMAKE_LFLAGS_WINDOWS += /VERBOSE
        }
        else {
            debug {
                # icu doesn't build debug libs with 'd' suffix, but check anyway
                exists($$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc$$DEBUG_SUFFIX.a) {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc$$DEBUG_SUFFIX.a
                }
                else {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuuc.a
                }
                exists($$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio$$DEBUG_SUFFIX.a) {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio$$DEBUG_SUFFIX.a
                }
                else {
                    LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libicuio.a
                }
            }
            !debug: LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libicuuc.a $$THIRDPARTY_VCPKG_PATH/lib/libicuio.a
        }
    }

    vcpkg:unix:!macx:LIBS += -lharfbuzz #freetype dependencies. ideally we could use pkg-config to get these
    vcpkg:unix:LIBS += -lpng
    # is it needed? win has it, mac does not -licuin$$DEBUG_SUFFIX_WO
    vcpkg:win32:LIBS += -lGdi32  -llibpng16$$DEBUG_SUFFIX
    vcpkg:DEFINES += HAVE_PDFIUM

    !vcpkg {
        unix:!macx {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libpdfium.a) {
                DEFINES += HAVE_PDFIUM
                INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium
                LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libpdfium.a
            }
            else:exists(/usr/include/fpdfview.h) {
                DEFINES += HAVE_PDFIUM
                LIBS += -lpdfium
            }
        }
        else {#win/mac
            DEFINES += HAVE_PDFIUM
            INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium
            LIBS += -lpdfium
        }
    }
}

CONFIG(USE_FFMPEG) {

    unix:!macx {
        # On Linux, vcpkg provides libavresample instead of libswresample
        vcpkg:LIBS += -lavformat -lavcodec -lavutil -lswscale -lavresample
        else {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg):exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib/libavcodec.a) {
            DEFINES += HAVE_FFMPEG
                INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg
                FFMPEGLIBPATH = $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/lib
            }
            else:exists(/usr/include/ffmpeg-mega) {
                DEFINES += HAVE_FFMPEG
                INCLUDEPATH += /usr/include/ffmpeg-mega
                exists(/usr/lib64/libavcodec.a) {
                    FFMPEGLIBPATH = /usr/lib64
                }
                else:exists(/usr/lib32/libavcodec.a) {
                    FFMPEGLIBPATH = /usr/lib32
                }
                else {
                   FFMPEGLIBPATH = /usr/lib
                }
            }
            else:packagesExist(ffmpeg)|packagesExist(libavcodec) {
                DEFINES += HAVE_FFMPEG
                LIBS += -lavcodec -lavformat -lavutil -lswscale -lswresample
            }

            FFMPEGSTATICLIBS = libavformat.a libavcodec.a libavutil.a libswscale.a

            for(ffmpeglib, FFMPEGSTATICLIBS) {
                exists($$FFMPEGLIBPATH/$$ffmpeglib) {
                    LIBS += $$FFMPEGLIBPATH/$$ffmpeglib
                }
            }

            #particular distros requirements
            exists(/usr/lib64/libbz2.so*)|exists(/usr/lib/libbz2.so*) {
                LIBS += -lbz2 #required in fedora ffmpeg/arch compilation
            }

            exists(/usr/lib/liblzma.so*):exists(/etc/arch-release) {
                LIBS += -llzma #required in arch ffmpeg compilation
            }
            CONFIG(FFMPEG_WITH_LZMA) {
                LIBS += -llzma #required in fedora >= 35 ffmpeg compilation
            }
        }
    }
    else { #win/mac
        DEFINES += HAVE_FFMPEG
        vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/ffmpeg
        else:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/ffmpeg
        LIBS += -lavcodec -lavformat -lavutil -lswscale
        vcpkg:macx {
            debug:LIBS += $$THIRDPARTY_VCPKG_PATH/debug/lib/libbz2d.a
            else:LIBS += $$THIRDPARTY_VCPKG_PATH/lib/libbz2.a
        }
    }
}

CONFIG(USE_WEBRTC) {

    DEFINES += ENABLE_WEBRTC V8_DEPRECATION_WARNINGS USE_OPENSSL_CERTS=1 NO_TCMALLOC DISABLE_NACL SAFE_BROWSING_DB_REMOTE \
               CHROMIUM_BUILD FIELDTRIAL_TESTING_ENABLED _FILE_OFFSET_BITS=64 __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS \
               _FORTIFY_SOURCE=2 __GNU_SOURCE=1 __compiler_offsetof=__builtin_offsetof NVALGRIND DYNAMIC_ANNOTATIONS_ENABLED=0 \
               WEBRTC_ENABLE_PROTOBUF=1 WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE EXPAT_RELATIVE_PATH HAVE_SCTP

    unix {
        DEFINES += WEBRTC_POSIX WEBRTC_LINUX WEBRTC_BUILD_LIBEVENT
    }

    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/webrtc \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/boringssl/src/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/libyuv/include \
                   $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/webrtc/include/third_party/abseil-cpp
    !macx {
    exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a -ldl -lX11
    }
    else {
        LIBS += -lwebrtc -ldl -lX11
    }
    }
    else {
        exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a) {
        LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libwebrtc.a -ldl
        }
        else {
        LIBS += -lwebrtc -ldl
        }
    }
}

CONFIG(USE_ROTATIVEPERFORMANCELOGGER) {
    DEFINES += USE_ROTATIVEPERFORMANCELOGGER
    DEFINES += ENABLE_LOG_PERFORMANCE
}

win32 {
    # comment this line to use WinHTTP on Windows
    CONFIG += USE_CURL

    CONFIG(USE_CURL) {
        SOURCES += src/wincurl/net.cpp  \
            src/wincurl/fs.cpp  \
            src/wincurl/waiter.cpp
        HEADERS += include/mega/wincurl/meganet.h
        DEFINES += USE_CURL USE_OPENSSL
        !vcpkg:LIBS +=  -llibcurl -lcares -llibeay32 -lssleay32
    }
    else {
        SOURCES += src/win32/net.cpp \
            src/win32/fs.cpp \
            src/win32/waiter.cpp
        HEADERS += include/mega/win32/meganet.h
    }

    # link winhttp anyway (required for automatic proxy detection)
    LIBS += -lwinhttp -ladvapi32
    DEFINES += _CRT_SECURE_NO_WARNINGS
}
else:CONFIG += USE_CURL

unix {
SOURCES += src/posix/net.cpp  \
    src/posix/fs.cpp  \
    src/posix/waiter.cpp
}

HEADERS  += include/mega.h \
            include/mega/account.h \
            include/mega/attrmap.h \
            include/mega/backofftimer.h \
            include/mega/base64.h \
            include/mega/command.h \
            include/mega/console.h \
            include/mega/db.h \
            include/mega/gfx.h \
            include/mega/file.h \
            include/mega/fileattributefetch.h \
            include/mega/filefingerprint.h \
            include/mega/filesystem.h \
            include/mega/http.h \
            include/mega/json.h \
            include/mega/megaapp.h \
            include/mega/megaclient.h \
            include/mega/node.h \
            include/mega/pubkeyaction.h \
            include/mega/request.h \
            include/mega/serialize64.h \
            include/mega/share.h \
            include/mega/sharenodekeys.h \
            include/mega/sync.h \
            include/mega/heartbeats.h \
            include/mega/transfer.h \
            include/mega/transferslot.h \
            include/mega/treeproc.h \
            include/mega/types.h \
            include/mega/user.h \
            include/mega/useralerts.h \
            include/mega/utils.h \
            include/mega/logging.h \
            include/mega/waiter.h \
            include/mega/proxy.h \
            include/mega/pendingcontactrequest.h \
            include/mega/textchat.h \
            include/mega/crypto/cryptopp.h  \
            include/mega/crypto/sodium.h  \
            include/mega/db/sqlite.h  \
            include/mega/gfx/freeimage.h \
            include/mega/gfx/gfx_pdfium.h \
            include/mega/gfx/external.h \
            include/mega/thread.h \
            include/mega/thread/cppthread.h \
            include/megaapi.h \
            include/megaapi_impl.h \
            include/mega/mega_utf8proc.h \
            include/mega/mega_ccronexpr.h \
            include/mega/mega_evt_tls.h \
            include/mega/mega_evt_queue.h \
            include/mega/thread/posixthread.h \
            include/mega/mega_zxcvbn.h \
            include/mega/mediafileattribute.h \
            include/mega/raid.h \
            include/mega/testhooks.h \
            include/mega/drivenotify.h

CONFIG(USE_MEGAAPI) {
    HEADERS += bindings/qt/QTMegaRequestListener.h \
            bindings/qt/QTMegaTransferListener.h \
            bindings/qt//QTMegaGlobalListener.h \
            bindings/qt/QTMegaListener.h \
            bindings/qt/QTMegaEvent.h
}

win32 {
    HEADERS  += include/mega/win32/megasys.h  \
            include/mega/win32/megafs.h  \
            include/mega/win32/megawaiter.h

    !vcpkg:SOURCES += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/sqlite3.c
}

unix {
    !exists($$MEGASDK_BASE_PATH/include/mega/config.h) {
        error("Configuration file not found! Please re-run configure script located in the project's root directory!")
    }
    HEADERS  += include/mega/posix/meganet.h  \
            include/mega/posix/megasys.h  \
            include/mega/posix/megafs.h  \
            include/mega/posix/megawaiter.h \
            include/mega/config.h
}

CONFIG(USE_PCRE) {
  DEFINES += USE_PCRE
}

CONFIG(qt) {
  DEFINES += USE_QT MEGA_QT_LOGGING
}

win32 {
    DEFINES += USE_CPPTHREAD
    SOURCES += src/thread/cppthread.cpp
}
else {
    DEFINES += USE_PTHREAD
    SOURCES += src/thread/posixthread.cpp
    LIBS += -lpthread
}

!CONFIG(nofreeimage) {
    DEFINES += USE_FREEIMAGE
    SOURCES += src/gfx/freeimage.cpp

    vcpkg {
        win32:LIBS += -llibpng16$$DEBUG_SUFFIX -llibwebpmux$$DEBUG_SUFFIX
        else {
            LIBS += -lpng16$$DEBUG_SUFFIX -lwebpmux$$DEBUG_SUFFIX
        }

        LIBS += -lfreeimage$$DEBUG_SUFFIX -ljpeg -ltiff$$DEBUG_SUFFIX \
        -lIlmImf-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIex-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIlmThread-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -lIexMath-2_5$$UNDERSCORE_DEBUG_SUFFIX -lIlmImfUtil-2_5$$UNDERSCORE_DEBUG_SUFFIX -lImath-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -lwebpdecoder$$DEBUG_SUFFIX -lwebpdemux$$DEBUG_SUFFIX -lwebp$$DEBUG_SUFFIX \
        -ljpegxr$$DEBUG_SUFFIX -ljxrglue$$DEBUG_SUFFIX -lHalf-2_5$$UNDERSCORE_DEBUG_SUFFIX \
        -llzma$$DEBUG_SUFFIX -ljasper$$DEBUG_SUFFIX -lraw_r$$DEBUG_SUFFIX -lopenjp2
    }
    else {
        macx{
            INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/FreeImage/Source
            LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a
        }
        else {
            exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.so.3) {
                LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.so.3
            }
            else {
                exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a) {
                    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libfreeimage.a
                }
                else {
                    LIBS += -lfreeimage
                }
            }
        }
    }
}

DEFINES += USE_SQLITE USE_CRYPTOPP ENABLE_SYNC ENABLE_CHAT
INCLUDEPATH += $$MEGASDK_BASE_PATH/include
INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt
vcpkg:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include
else:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include

!release {
    DEFINES += SQLITE_DEBUG DEBUG
}
else {
    DEFINES += NDEBUG
}

vcpkg {
    INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/zlib
    INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/libsodium

    CONFIG(USE_CURL) {
        !macx:INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/openssl
        INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/cares
        win32:LIBS +=  -llibcurl$$DASH_DEBUG_SUFFIX -lcares -llibcrypto -llibssl
        else {
            LIBS +=  -lcurl$$DASH_DEBUG_SUFFIX -lcares
            !macx:LIBS += -lcrypto -lssl
        }
    }

    CONFIG(USE_PCRE) {
        INCLUDEPATH += $$THIRDPARTY_VCPKG_PATH/include/pcre
        DEFINES += PCRE_STATIC
        LIBS += -lpcre
    }

    CONFIG(USE_PDFIUM):INCLUDEPATH += $$THIRDPARTY_VCPKG_BASE_PATH/pdfium/pdfium/public

    release:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/lib"
    debug:LIBS += -L"$$THIRDPARTY_VCPKG_PATH/debug/lib"

    win32:LIBS += -llibsodium -lcryptopp-static -lzlib$$DEBUG_SUFFIX
    else:LIBS += -lsodium -lcryptopp -lz
    LIBS += -lsqlite3
}

win32 {
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/zlib
    !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libsodium

    CONFIG(USE_CURL) {
        INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/wincurl
        !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/openssl
        !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/cares
    }
    else {
        INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/win32
    }

    !vcpkg:contains(CONFIG, BUILDX64) {
       release {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x64"
        }
        else {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x64d"
        }
    }

    !vcpkg:!contains(CONFIG, BUILDX64) {
        release {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x32"
        }
        else {
            LIBS += -L"$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/x32d"
        }
    }

    CONFIG(USE_PCRE) {
     INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pcre
     DEFINES += PCRE_STATIC
     LIBS += -lpcre
    }

    LIBS += -lshlwapi -lws2_32 -luser32
    !vcpkg:LIBS += -lsodium -lcryptopp -lzlibstat

    DEFINES += NOMINMAX
}

unix:!macx {
   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/posix
   LIBS += -lsqlite3 -lrt

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a) {
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a
   }
   else {
    vcpkg:LIBS += -lcurl$$DASH_DEBUG_SUFFIX
    else:LIBS += -lcurl
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libz.a) {
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libz.a
   }
   else {
    LIBS += -lz
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a
   }
   else {
    LIBS += -lssl
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a
   }
   else {
    LIBS += -lcrypto
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcryptopp.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcryptopp.a
   }
   else {
    LIBS += -lcryptopp
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a
   }
   else {
    LIBS += -lcares
   }

   exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a) {
    LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a
   }
   else {
    LIBS += -lsodium
   }

   CONFIG(USE_PCRE) {
    DEFINES += PCRE_STATIC
    exists($$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libpcre.a) {
     LIBS +=  $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libpcre.a
    }
    else {
     LIBS += -lpcre
    }
   }
}

macx {
   # recreate source folder tree for object files. Needed to build osx/fs.cpp and posix/fs.cpp,
   # otherwise all obj files are placed into same directory, causing overwrite.
   CONFIG += object_parallel_to_source

   HEADERS += $$MEGASDK_BASE_PATH/include/mega/osx/megafs.h
   SOURCES += $$MEGASDK_BASE_PATH/src/osx/fs.cpp

   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/osx
   INCLUDEPATH += $$MEGASDK_BASE_PATH/include/mega/posix

   OBJECTIVE_SOURCES += $$MEGASDK_BASE_PATH/src/osx/osxutils.mm

   !vcpkg:SOURCES += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/sqlite3.c

   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/curl
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/libsodium
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/cares
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/mediainfo
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/zenlib
   !vcpkg:INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pdfium

   !vcpkg:CONFIG(USE_PCRE) {
    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/pcre
    DEFINES += PCRE_STATIC
    LIBS += -lpcre
   }

   DEFINES += _DARWIN_FEATURE_64_BIT_INODE CRYPTOPP_DISABLE_ASM

   !vcpkg:LIBS += -L$$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/ $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcares.a $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcurl.a \
                    $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libsodium.a -lcryptopp
   LIBS += -lz

   !vcpkg:CONFIG(USE_OPENSSL) {
    INCLUDEPATH += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/include/openssl
    LIBS += $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libssl.a $$MEGASDK_BASE_PATH/bindings/qt/3rdparty/libs/libcrypto.a
   }

   LIBS += -framework SystemConfiguration

   vcpkg:LIBS += -liconv -framework CoreServices -framework CoreFoundation -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework CoreMedia -framework VideoToolbox -framework ImageIO -framework CoreVideo
}

# DriveNotify settings
CONFIG(USE_DRIVE_NOTIFICATIONS) {
    DEFINES += USE_DRIVE_NOTIFICATIONS
    SOURCES += src/drivenotify.cpp

    win32 {
        # Allegedly not supported by non-msvc compilers.
        HEADERS += include/mega/win32/drivenotifywin.h
        SOURCES += src/win32/drivenotifywin.cpp
        LIBS += -lwbemuuid
    }
    unix:!macx {
        HEADERS += include/mega/posix/drivenotifyposix.h
        SOURCES += src/posix/drivenotifyposix.cpp
        LIBS += -ludev
    }
    macx {
        HEADERS += include/mega/osx/drivenotifyosx.h
        SOURCES += src/osx/drivenotifyosx.cpp
        LIBS += -framework DiskArbitration -framework CoreFoundation
    }
}