revert .pri file that couses compilation issues on windows

# -------------------------------------------------------------------
# This file contains shared rules used both when building leveldb
# itself, and by targets that use leveldb.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------

win: DEFINES += OS_WIN
macx: DEFINES += OS_MACOSX
ios: DEFINES += OS_MACOSX

android {
    DEFINES += OS_ANDROID
} else{

 linux {
    DEFINES += OS_LINUX
    QMAKE_CFLAGS += -fno-builtin-memcmp -pthread
    QMAKE_CXXFLAGS += -fno-builtin-memcmp -pthread
    QMAKE_LFLAGS += -pthread -lrt
}
}

DEFINES += LEVELDB_PLATFORM_QT

android:
freebsd*: DEFINES += OS_FREEBSD

SOURCE_DIR = $$PWD/leveldb
INCLUDEPATH += \
    $$SOURCE_DIR/include \
    $$SOURCE_DIR

PRIVATE_HEADERS += \
    $$SOURCE_DIR/db/builder.h \
    $$SOURCE_DIR/db/dbformat.h \
    $$SOURCE_DIR/db/db_impl.h \
    $$SOURCE_DIR/db/db_iter.h \
    $$SOURCE_DIR/db/filename.h \
    $$SOURCE_DIR/db/log_format.h \
    $$SOURCE_DIR/db/log_reader.h \
    $$SOURCE_DIR/db/log_writer.h \
    $$SOURCE_DIR/db/memtable.h \
    $$SOURCE_DIR/db/skiplist.h \
    $$SOURCE_DIR/db/snapshot.h \
    $$SOURCE_DIR/db/table_cache.h \
    $$SOURCE_DIR/db/version_edit.h \
    $$SOURCE_DIR/db/version_set.h \
    $$SOURCE_DIR/db/write_batch_internal.h \
    $$SOURCE_DIR/port/port.h \
    $$SOURCE_DIR/port/port.qt \
    $$SOURCE_DIR/port/thread_annotations.h \
    $$SOURCE_DIR/port/win/stdint.h \
    $$SOURCE_DIR/helpers/memenv/memenv.h \
    $$SOURCE_DIR/table/block_builder.h \
    $$SOURCE_DIR/table/block.h \
    $$SOURCE_DIR/table/filter_block.h \
    $$SOURCE_DIR/table/format.h \
    $$SOURCE_DIR/table/iterator_wrapper.h \
    $$SOURCE_DIR/table/merger.h \
    $$SOURCE_DIR/table/two_level_iterator.h \
    $$SOURCE_DIR/include/leveldb/cache.h \
    $$SOURCE_DIR/include/leveldb/c.h \
    $$SOURCE_DIR/include/leveldb/comparator.h \
    $$SOURCE_DIR/include/leveldb/db.h \
    $$SOURCE_DIR/include/leveldb/env.h \
    $$SOURCE_DIR/include/leveldb/filter_policy.h \
    $$SOURCE_DIR/include/leveldb/iterator.h \
    $$SOURCE_DIR/include/leveldb/options.h \
    $$SOURCE_DIR/include/leveldb/slice.h \
    $$SOURCE_DIR/include/leveldb/status.h \
    $$SOURCE_DIR/include/leveldb/table_builder.h \
    $$SOURCE_DIR/include/leveldb/table.h \
    $$SOURCE_DIR/include/leveldb/write_batch.h \
    $$SOURCE_DIR/util/arena.h \
    $$SOURCE_DIR/util/coding.h \
    $$SOURCE_DIR/util/crc32c.h \
    $$SOURCE_DIR/util/hash.h \
    $$SOURCE_DIR/util/histogram.h \
    $$SOURCE_DIR/util/logging.h \
    $$SOURCE_DIR/util/mutexlock.h \
    $$SOURCE_DIR/util/qt_logger.h \
    $$SOURCE_DIR/util/random.h

MEMENV_SOURCES=helpers/memenv/memenv.cc
SOURCES += \
    $$SOURCE_DIR/db/builder.cc \
    $$SOURCE_DIR/db/c.cc \
    $$SOURCE_DIR/db/dbformat.cc \
    $$SOURCE_DIR/db/db_impl.cc \
    $$SOURCE_DIR/db/db_iter.cc \
    $$SOURCE_DIR/db/filename.cc \
#    $$SOURCE_DIR/db/leveldb_main.cc \
    $$SOURCE_DIR/db/log_reader.cc \
    $$SOURCE_DIR/db/log_writer.cc \
    $$SOURCE_DIR/db/memtable.cc \
    $$SOURCE_DIR/db/repair.cc \
    $$SOURCE_DIR/db/table_cache.cc \
    $$SOURCE_DIR/db/version_edit.cc \
    $$SOURCE_DIR/db/version_set.cc \
    $$SOURCE_DIR/db/write_batch.cc \
    $$SOURCE_DIR/table/block_builder.cc \
    $$SOURCE_DIR/table/block.cc \
    $$SOURCE_DIR/table/filter_block.cc \
    $$SOURCE_DIR/table/format.cc \
    $$SOURCE_DIR/table/iterator.cc \
    $$SOURCE_DIR/table/merger.cc \
    $$SOURCE_DIR/table/table_builder.cc \
    $$SOURCE_DIR/table/table.cc \
    $$SOURCE_DIR/table/two_level_iterator.cc \
    $$SOURCE_DIR/helpers/memenv/memenv.cc \
    $$SOURCE_DIR/util/arena.cc \
    $$SOURCE_DIR/util/bloom.cc \
    $$SOURCE_DIR/util/cache.cc \
    $$SOURCE_DIR/util/coding.cc \
    $$SOURCE_DIR/util/comparator.cc \
    $$SOURCE_DIR/util/crc32c.cc \
    $$SOURCE_DIR/util/env.cc \
    $$SOURCE_DIR/util/env_qt.cc \
    $$SOURCE_DIR/util/filter_policy.cc \
    $$SOURCE_DIR/util/hash.cc \
    $$SOURCE_DIR/util/histogram.cc \
    $$SOURCE_DIR/util/logging.cc \
    $$SOURCE_DIR/util/options.cc \
    $$SOURCE_DIR/util/status.cc

# -------------------------------------------------------------------
# This file contains shared rules used both when building leveldb
# itself, and by targets that use leveldb.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------

win32: DEFINES += OS_WIN
win64: DEFINES += OS_WIN
macx: DEFINES += OS_MACOSX
ios: DEFINES += OS_MACOSX
linux: {
    DEFINES += OS_LINUX LEVELDB_PLATFORM_POSIX
    QMAKE_CFLAGS += -fno-builtin-memcmp -pthread
    QMAKE_CXXFLAGS += -fno-builtin-memcmp -pthread
    QMAKE_LFLAGS += -pthread -lrt

}
android: DEFINES += OS_ANDROID
freebsd*: DEFINES += OS_FREEBSD

SOURCE_DIR = $$PWD/leveldb
INCLUDEPATH += \
    $$SOURCE_DIR/include \
    $$SOURCE_DIR

PRIVATE_HEADERS += \
    $$SOURCE_DIR/db/builder.h \
    $$SOURCE_DIR/db/dbformat.h \
    $$SOURCE_DIR/db/db_impl.h \
    $$SOURCE_DIR/db/db_iter.h \
    $$SOURCE_DIR/db/filename.h \
    $$SOURCE_DIR/db/log_format.h \
    $$SOURCE_DIR/db/log_reader.h \
    $$SOURCE_DIR/db/log_writer.h \
    $$SOURCE_DIR/db/memtable.h \
    $$SOURCE_DIR/db/skiplist.h \
    $$SOURCE_DIR/db/snapshot.h \
    $$SOURCE_DIR/db/table_cache.h \
    $$SOURCE_DIR/db/version_edit.h \
    $$SOURCE_DIR/db/version_set.h \
    $$SOURCE_DIR/db/write_batch_internal.h \
    $$SOURCE_DIR/port/port.h \
    $$SOURCE_DIR/port/port_posix.h \
    $$SOURCE_DIR/port/thread_annotations.h \
    $$SOURCE_DIR/port/win/stdint.h \
    $$SOURCE_DIR/helpers/memenv/memenv.h \
    $$SOURCE_DIR/table/block_builder.h \
    $$SOURCE_DIR/table/block.h \
    $$SOURCE_DIR/table/filter_block.h \
    $$SOURCE_DIR/table/format.h \
    $$SOURCE_DIR/table/iterator_wrapper.h \
    $$SOURCE_DIR/table/merger.h \
    $$SOURCE_DIR/table/two_level_iterator.h \
    $$SOURCE_DIR/include/leveldb/cache.h \
    $$SOURCE_DIR/include/leveldb/c.h \
    $$SOURCE_DIR/include/leveldb/comparator.h \
    $$SOURCE_DIR/include/leveldb/db.h \
    $$SOURCE_DIR/include/leveldb/env.h \
    $$SOURCE_DIR/include/leveldb/filter_policy.h \
    $$SOURCE_DIR/include/leveldb/iterator.h \
    $$SOURCE_DIR/include/leveldb/options.h \
    $$SOURCE_DIR/include/leveldb/slice.h \
    $$SOURCE_DIR/include/leveldb/status.h \
    $$SOURCE_DIR/include/leveldb/table_builder.h \
    $$SOURCE_DIR/include/leveldb/table.h \
    $$SOURCE_DIR/include/leveldb/write_batch.h \
    $$SOURCE_DIR/util/arena.h \
    $$SOURCE_DIR/util/coding.h \
    $$SOURCE_DIR/util/crc32c.h \
    $$SOURCE_DIR/util/hash.h \
    $$SOURCE_DIR/util/histogram.h \
    $$SOURCE_DIR/util/logging.h \
    $$SOURCE_DIR/util/mutexlock.h \
    $$SOURCE_DIR/util/qt_logger.h \
    $$SOURCE_DIR/util/random.h

MEMENV_SOURCES=helpers/memenv/memenv.cc
SOURCES += \
    $$SOURCE_DIR/port/port_posix.cc \
    $$SOURCE_DIR/db/builder.cc \
    $$SOURCE_DIR/db/c.cc \
    $$SOURCE_DIR/db/dbformat.cc \
    $$SOURCE_DIR/db/db_impl.cc \
    $$SOURCE_DIR/db/db_iter.cc \
    $$SOURCE_DIR/db/filename.cc \
#    $$SOURCE_DIR/db/leveldb_main.cc \
    $$SOURCE_DIR/db/log_reader.cc \
    $$SOURCE_DIR/db/log_writer.cc \
    $$SOURCE_DIR/db/memtable.cc \
    $$SOURCE_DIR/db/repair.cc \
    $$SOURCE_DIR/db/table_cache.cc \
    $$SOURCE_DIR/db/version_edit.cc \
    $$SOURCE_DIR/db/version_set.cc \
    $$SOURCE_DIR/db/write_batch.cc \
    $$SOURCE_DIR/table/block_builder.cc \
    $$SOURCE_DIR/table/block.cc \
    $$SOURCE_DIR/table/filter_block.cc \
    $$SOURCE_DIR/table/format.cc \
    $$SOURCE_DIR/table/iterator.cc \
    $$SOURCE_DIR/table/merger.cc \
    $$SOURCE_DIR/table/table_builder.cc \
    $$SOURCE_DIR/table/table.cc \
    $$SOURCE_DIR/table/two_level_iterator.cc \
    $$SOURCE_DIR/helpers/memenv/memenv.cc \
    $$SOURCE_DIR/util/arena.cc \
    $$SOURCE_DIR/util/bloom.cc \
    $$SOURCE_DIR/util/cache.cc \
    $$SOURCE_DIR/util/coding.cc \
    $$SOURCE_DIR/util/comparator.cc \
    $$SOURCE_DIR/util/crc32c.cc \
    $$SOURCE_DIR/util/env.cc \
    $$SOURCE_DIR/util/env_posix.cc \
    $$SOURCE_DIR/util/filter_policy.cc \
    $$SOURCE_DIR/util/hash.cc \
    $$SOURCE_DIR/util/histogram.cc \
    $$SOURCE_DIR/util/logging.cc \
    $$SOURCE_DIR/util/options.cc \
    $$SOURCE_DIR/util/status.cc


modified include directory

modified include directory

################################################################################
#
# (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
#
# QGroundControl is licensed according to the terms in the file
# COPYING.md in the root of the source code directory.
#
################################################################################

#
# [REQUIRED] Add support for <inttypes.h> to Windows.
#
WindowsBuild {
    INCLUDEPATH += libs/msinttypes
}

#
# [REQUIRED] Add support for the MAVLink communications protocol.
#
# By default MAVLink dialect is hardwired to arudpilotmega. The reason being
# the current codebase supports both PX4 and APM flight stack. PX4 flight stack
# only uses common MAVLink specifications, whereas APM flight stack uses custom
# MAVLink specifications which adds to common. So by using the adupilotmega dialect
# QGC can support both in the same codebase.

# Once the mavlink helper routines include support for multiple dialects within
# a single compiled codebase this hardwiring of dialect can go away. But until then
# this "workaround" is needed.

# In the mean time, it’s possible to define a completely different dialect by defining the
# location and name below.

# check for user defined settings in user_config.pri if not already set as qmake argument
isEmpty(MAVLINKPATH_REL) {
    exists(user_config.pri):infile(user_config.pri, MAVLINKPATH_REL) {
        MAVLINKPATH_REL = $$fromfile(user_config.pri, MAVLINKPATH_REL)
        message($$sprintf("Using user-supplied relativ mavlink path '%1' specified in user_config.pri", $$MAVLINKPATH_REL))
    } else {
        MAVLINKPATH_REL = libs/mavlink/include/mavlink/v2.0
    }
}

isEmpty(MAVLINKPATH) {
    exists(user_config.pri):infile(user_config.pri, MAVLINKPATH) {
        MAVLINKPATH     = $$fromfile(user_config.pri, MAVLINKPATH)
        message($$sprintf("Using user-supplied mavlink path '%1' specified in user_config.pri", $$MAVLINKPATH))
    } else {
        MAVLINKPATH     = $$SOURCE_DIR/$$MAVLINKPATH_REL
    }
}

isEmpty(MAVLINK_CONF) {
    exists(user_config.pri):infile(user_config.pri, MAVLINK_CONF) {
        MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
        message($$sprintf("Using user-supplied mavlink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF))
    } else {
        MAVLINK_CONF = ardupilotmega
    }
}

# If defined, all APM specific MAVLink messages are disabled
contains (CONFIG, QGC_DISABLE_APM_MAVLINK) {
    message("Disable APM MAVLink support")
    DEFINES += NO_ARDUPILOT_DIALECT
    CONFIG  += ArdupilotDisabled
} else {
    CONFIG  += ArdupilotEnabled
}

# First we select the dialect, checking for valid user selection
# Users can override all other settings by specifying MAVLINK_CONF as an argument to qmake
!isEmpty(MAVLINK_CONF) {
    message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
}

# Then we add the proper include paths dependent on the dialect.
INCLUDEPATH += $$MAVLINKPATH

exists($$MAVLINKPATH/common) {
    !isEmpty(MAVLINK_CONF) {
        count(MAVLINK_CONF, 1) {
            exists($$MAVLINKPATH/$$MAVLINK_CONF) {
                INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF
                DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF))
            } else {
                error($$sprintf("MAVLink dialect '%1' does not exist at '%2'!", $$MAVLINK_CONF, $$MAVLINKPATH_REL))
            }
        } else {
            error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
        }
    } else {
        INCLUDEPATH += $$MAVLINKPATH/common
    }
} else {
    error($$sprintf("MAVLink folder does not exist at '%1'! Run 'git submodule init && git submodule update' on the command line.",$$MAVLINKPATH_REL))
}

#
# [REQUIRED] EIGEN matrix library
# NOMINMAX constant required to make internal min/max work.
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

#
# [REQUIRED] shapelib library
INCLUDEPATH += libs/shapelib
SOURCES += \
    libs/shapelib/shpopen.c \
    libs/shapelib/safileio.c

#
# [REQUIRED] zlib library
WindowsBuild {
    INCLUDEPATH +=  $$SOURCE_DIR/libs/zlib/windows/include
    LIBS += -L$$SOURCE_DIR/libs/zlib/windows/lib
    LIBS += -lzlibstat
} else {
    LIBS += -lz
}

#
# [REQUIRED] LZMA decompression library
HEADERS+= \
    libs/xz-embedded/linux/include/linux/xz.h \
    libs/xz-embedded/linux/lib/xz/xz_lzma2.h \
    libs/xz-embedded/linux/lib/xz/xz_private.h \
    libs/xz-embedded/linux/lib/xz/xz_stream.h \
    libs/xz-embedded/userspace/xz_config.h
SOURCES += \
    libs/xz-embedded/linux/lib/xz/xz_crc32.c \
    libs/xz-embedded/linux/lib/xz/xz_crc64.c \
    libs/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \
    libs/xz-embedded/linux/lib/xz/xz_dec_stream.c
INCLUDEPATH += \
    libs/xz-embedded/userspace \
    libs/xz-embedded/linux/include/linux
DEFINES += XZ_DEC_ANY_CHECK XZ_USE_CRC64

#
# [REQUIRED] SDL dependency. Provides joystick/gamepad support.
# The SDL is packaged with QGC for the Mac and Windows. Linux support requires installing the SDL
# library (development libraries and static binaries).
#
MacBuild {
    INCLUDEPATH += \
        $$SOURCE_DIR/libs/Frameworks/SDL2.framework/Headers
    LIBS += \
        -F$$SOURCE_DIR/libs/Frameworks \
        -framework SDL2
} else:LinuxBuild {
    PKGCONFIG = sdl2
} else:WindowsBuild {
    INCLUDEPATH += $$SOURCE_DIR/libs/sdl2/msvc/include
    INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Windows/x64/include
    LIBS += -L$$SOURCE_DIR/libs/sdl2/msvc/lib/x64
    LIBS += -lSDL2
}

# Include Android OpenSSL libs
AndroidBuild {
    include($$SOURCE_DIR/libs/OpenSSL/android_openssl/openssl.pri)
    message("ANDROID_EXTRA_LIBS")
    message($$ANDROID_TARGET_ARCH)
    message($$ANDROID_EXTRA_LIBS)
}

# Pairing
contains(DEFINES, QGC_ENABLE_PAIRING) {
    MacBuild {
        #- Pairing is generally not supported on macOS. This is here solely for development.
        exists(/usr/local/Cellar/openssl/1.0.2t/include) {
            INCLUDEPATH += /usr/local/Cellar/openssl/1.0.2t/include
            LIBS += -L/usr/local/Cellar/openssl/1.0.2t/lib
            LIBS += -lcrypto
        } else {
            # There is some circular reference settings going on between QGCExternalLibs.pri and gqgroundcontrol.pro.
            # So this duplicates some of the enable/disable logic which would normally be in qgroundcontrol.pro.
            DEFINES -= QGC_ENABLE_PAIRING
        }
    } else:WindowsBuild {
        #- Pairing is not supported on Windows
        DEFINES -= QGC_ENABLE_PAIRING
    } else {
        LIBS += -lcrypto
        AndroidBuild {
            contains(QT_ARCH, arm) {
                LIBS += $$ANDROID_EXTRA_LIBS
                INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Android/arch-armeabi-v7a/include
            } else {
                LIBS += $$ANDROID_EXTRA_LIBS
                INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Android/arch-x86/include
            }
        }
    }
}

#
# [OPTIONAL] Zeroconf for UDP links
#
contains (DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from command line)")
    DEFINES -= DISABLE_ZEROCONF
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from user_config.pri)")
# Mac support is built into OS
} else:MacBuild|iOSBuild {
    message("Including support for Zeroconf (Bonjour)")
    DEFINES += QGC_ZEROCONF_ENABLED
} else {
    message("Skipping support for Zeroconf (unsupported platform)")
}

#
# [OPTIONAL] AirMap Support
#
contains (DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from command line)")
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from user_config.pri)")
} else {
    AIRMAP_PLATFORM_SDK_PATH    = $${PWD}/libs/airmapd
    AIRMAP_QT_PATH              = Qt.$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}
    message('Looking for Airmap in folder "$${AIRMAP_PLATFORM_SDK_PATH}", variant: "$$AIRMAP_QT_PATH"')
    MacBuild {
        exists("$${AIRMAPD_PATH}/macOS/$$AIRMAP_QT_PATH") {
            message("Including support for AirMap for macOS")
            LIBS += -L$${AIRMAPD_PATH}/macOS/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        }
    } else:LinuxBuild {
        exists("$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH") {
            message("Including support for AirMap for Linux")
            LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        } else {
            #-- Download and install platform-sdk libs and headers
            message("Installing AirMap platform-sdk libs and headers")
            AIRMAP_PLATFORM_SDK_URL = "https://github.com/airmap/platform-sdk/releases/download/v1.1/airmap-platform-sdk-1.1.0-Linux.deb"
            AIRMAP_PLATFORM_SDK_FILENAME = "airmap-platform-sdk.deb"
            AIRMAP_PLATFORM_SDK_INSTALL_PREFIX = "airmap-platform-sdk"
            !exists("$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}") {
                system("mkdir -p $${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}")
            }
            !exists("$${AIRMAP_PLATFORM_SDK_PATH}/include/airmap") {
                system("mkdir -p $${AIRMAP_PLATFORM_SDK_PATH}/include/airmap")
            }
            system("wget -q -O $${AIRMAP_PLATFORM_SDK_FILENAME} $${AIRMAP_PLATFORM_SDK_URL} && dpkg -x $${AIRMAP_PLATFORM_SDK_FILENAME} $${AIRMAP_PLATFORM_SDK_PATH}/")
            system("mv $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}/lib/* $${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}/")
            system("mv $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}/include/airmap/* $${AIRMAP_PLATFORM_SDK_PATH}/include/airmap/")
            system("rm -rf $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}")
            system("rm $${AIRMAP_PLATFORM_SDK_FILENAME}")

            exists($${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH) {
                message("Including support for AirMap for Linux")
                LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
                DEFINES += QGC_AIRMAP_ENABLED
            } else {
                message("Failed to install AirMap support for Linux")
            }
        }
    } else {
        message("Skipping support for Airmap (unsupported platform)")
    }
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        INCLUDEPATH += \
            $${AIRMAP_PLATFORM_SDK_PATH}/include/airmap/
    }
}

################################################################################
#
# (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
#
# QGroundControl is licensed according to the terms in the file
# COPYING.md in the root of the source code directory.
#
################################################################################

#
# [REQUIRED] Add support for <inttypes.h> to Windows.
#
WindowsBuild {
    INCLUDEPATH += libs/msinttypes
}

#
# [REQUIRED] Add support for the MAVLink communications protocol.
#
# By default MAVLink dialect is hardwired to arudpilotmega. The reason being
# the current codebase supports both PX4 and APM flight stack. PX4 flight stack
# only uses common MAVLink specifications, whereas APM flight stack uses custom
# MAVLink specifications which adds to common. So by using the adupilotmega dialect
# QGC can support both in the same codebase.

# Once the mavlink helper routines include support for multiple dialects within
# a single compiled codebase this hardwiring of dialect can go away. But until then
# this "workaround" is needed.

# In the mean time, it’s possible to define a completely different dialect by defining the
# location and name below.

# check for user defined settings in user_config.pri if not already set as qmake argument
isEmpty(MAVLINKPATH_REL) {
    exists(user_config.pri):infile(user_config.pri, MAVLINKPATH_REL) {
        MAVLINKPATH_REL = $$fromfile(user_config.pri, MAVLINKPATH_REL)
        message($$sprintf("Using user-supplied relativ mavlink path '%1' specified in user_config.pri", $$MAVLINKPATH_REL))
    } else {
        MAVLINKPATH_REL = libs/mavlink/include/mavlink/v2.0
    }
}

isEmpty(MAVLINKPATH) {
    exists(user_config.pri):infile(user_config.pri, MAVLINKPATH) {
        MAVLINKPATH     = $$fromfile(user_config.pri, MAVLINKPATH)
        message($$sprintf("Using user-supplied mavlink path '%1' specified in user_config.pri", $$MAVLINKPATH))
    } else {
        MAVLINKPATH     = $$SOURCE_DIR/$$MAVLINKPATH_REL
    }
}

isEmpty(MAVLINK_CONF) {
    exists(user_config.pri):infile(user_config.pri, MAVLINK_CONF) {
        MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
        message($$sprintf("Using user-supplied mavlink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF))
    } else {
        MAVLINK_CONF = ardupilotmega
    }
}

# If defined, all APM specific MAVLink messages are disabled
contains (CONFIG, QGC_DISABLE_APM_MAVLINK) {
    message("Disable APM MAVLink support")
    DEFINES += NO_ARDUPILOT_DIALECT
    CONFIG  += ArdupilotDisabled
} else {
    CONFIG  += ArdupilotEnabled
}

# First we select the dialect, checking for valid user selection
# Users can override all other settings by specifying MAVLINK_CONF as an argument to qmake
!isEmpty(MAVLINK_CONF) {
    message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
}

# Then we add the proper include paths dependent on the dialect.
INCLUDEPATH += $$MAVLINKPATH

exists($$MAVLINKPATH/common) {
    !isEmpty(MAVLINK_CONF) {
        count(MAVLINK_CONF, 1) {
            exists($$MAVLINKPATH/$$MAVLINK_CONF) {
                INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF
                DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF))
            } else {
                error($$sprintf("MAVLink dialect '%1' does not exist at '%2'!", $$MAVLINK_CONF, $$MAVLINKPATH_REL))
            }
        } else {
            error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
        }
    } else {
        INCLUDEPATH += $$MAVLINKPATH/common
    }
} else {
    error($$sprintf("MAVLink folder does not exist at '%1'! Run 'git submodule init && git submodule update' on the command line.",$$MAVLINKPATH_REL))
}

#
# [REQUIRED] EIGEN matrix library
# NOMINMAX constant required to make internal min/max work.
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

#
# [REQUIRED] shapelib library
INCLUDEPATH += libs/shapelib
SOURCES += \
    libs/shapelib/shpopen.c \
    libs/shapelib/safileio.c

#
# [REQUIRED] zlib library
WindowsBuild {
    INCLUDEPATH +=  $$SOURCE_DIR/libs/zlib/windows/include
    LIBS += -L$$SOURCE_DIR/libs/zlib/windows/lib
    LIBS += -lzlibstat
} else {
    LIBS += -lz
}

#
# [REQUIRED] LZMA decompression library
HEADERS+= \
    libs/xz-embedded/linux/include/linux/xz.h \
    libs/xz-embedded/linux/lib/xz/xz_lzma2.h \
    libs/xz-embedded/linux/lib/xz/xz_private.h \
    libs/xz-embedded/linux/lib/xz/xz_stream.h \
    libs/xz-embedded/userspace/xz_config.h
SOURCES += \
    libs/xz-embedded/linux/lib/xz/xz_crc32.c \
    libs/xz-embedded/linux/lib/xz/xz_crc64.c \
    libs/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \
    libs/xz-embedded/linux/lib/xz/xz_dec_stream.c
INCLUDEPATH += \
    libs/xz-embedded/userspace \
    libs/xz-embedded/linux/include/linux
DEFINES += XZ_DEC_ANY_CHECK XZ_USE_CRC64

#
# [REQUIRED] SDL dependency. Provides joystick/gamepad support.
# The SDL is packaged with QGC for the Mac and Windows. Linux support requires installing the SDL
# library (development libraries and static binaries).
#
MacBuild {
    INCLUDEPATH += \
        $$SOURCE_DIR/libs/Frameworks/SDL2.framework/Headers
    LIBS += \
        -F$$SOURCE_DIR/libs/Frameworks \
        -framework SDL2
} else:LinuxBuild {
    PKGCONFIG = sdl2
} else:WindowsBuild {
    INCLUDEPATH += $$SOURCE_DIR/libs/sdl2/msvc/include
    INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Windows/x64/include
    LIBS += -L$$SOURCE_DIR/libs/sdl2/msvc/lib/x64
    LIBS += -lSDL2
}

# Include Android OpenSSL libs
AndroidBuild {
    include($$SOURCE_DIR/libs/OpenSSL/android_openssl/openssl.pri)
    message("ANDROID_EXTRA_LIBS")
    message($$ANDROID_TARGET_ARCH)
    message($$ANDROID_EXTRA_LIBS)
}

# Pairing
contains(DEFINES, QGC_ENABLE_PAIRING) {
    MacBuild {
        #- Pairing is generally not supported on macOS. This is here solely for development.
        exists(/usr/local/Cellar/openssl/1.0.2t/include) {
            INCLUDEPATH += /usr/local/Cellar/openssl/1.0.2t/include
            LIBS += -L/usr/local/Cellar/openssl/1.0.2t/lib
            LIBS += -lcrypto
        } else {
            # There is some circular reference settings going on between QGCExternalLibs.pri and gqgroundcontrol.pro.
            # So this duplicates some of the enable/disable logic which would normally be in qgroundcontrol.pro.
            DEFINES -= QGC_ENABLE_PAIRING
        }
    } else:WindowsBuild {
        #- Pairing is not supported on Windows
        DEFINES -= QGC_ENABLE_PAIRING
    } else {
        LIBS += -lcrypto
        AndroidBuild {
            contains(QT_ARCH, arm) {
                LIBS += $$ANDROID_EXTRA_LIBS
                INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Android/arch-armeabi-v7a/include
            } else {
                LIBS += $$ANDROID_EXTRA_LIBS
                INCLUDEPATH += $$SOURCE_DIR/libs/OpenSSL/Android/arch-x86/include
            }
        }
    }
}

#
# [OPTIONAL] Zeroconf for UDP links
#
contains (DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from command line)")
    DEFINES -= DISABLE_ZEROCONF
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from user_config.pri)")
# Mac support is built into OS
} else:MacBuild|iOSBuild {
    message("Including support for Zeroconf (Bonjour)")
    DEFINES += QGC_ZEROCONF_ENABLED
} else {
    message("Skipping support for Zeroconf (unsupported platform)")
}

#
# [OPTIONAL] AirMap Support
#
contains (DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from command line)")
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from user_config.pri)")
} else {
    AIRMAP_PLATFORM_SDK_PATH    = $${PWD}/libs/airmapd
    AIRMAP_QT_PATH              = Qt.$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}
    message('Looking for Airmap in folder "$${AIRMAP_PLATFORM_SDK_PATH}", variant: "$$AIRMAP_QT_PATH"')
    MacBuild {
        exists("$${AIRMAPD_PATH}/macOS/$$AIRMAP_QT_PATH") {
            message("Including support for AirMap for macOS")
            LIBS += -L$${AIRMAPD_PATH}/macOS/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        }
    } else:LinuxBuild {
        exists("$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH") {
            message("Including support for AirMap for Linux")
            LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        } else {
            #-- Download and install platform-sdk libs and headers
            message("Installing AirMap platform-sdk libs and headers")
            AIRMAP_PLATFORM_SDK_URL = "https://github.com/airmap/platform-sdk/releases/download/v1.1/airmap-platform-sdk-1.1.0-Linux.deb"
            AIRMAP_PLATFORM_SDK_FILENAME = "airmap-platform-sdk.deb"
            AIRMAP_PLATFORM_SDK_INSTALL_PREFIX = "airmap-platform-sdk"
            !exists("$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}") {
                system("mkdir -p $${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}")
            }
            !exists("$${AIRMAP_PLATFORM_SDK_PATH}/include") {
                system("mkdir -p $${AIRMAP_PLATFORM_SDK_PATH}/include")
            }
            system("wget -q -O $${AIRMAP_PLATFORM_SDK_FILENAME} $${AIRMAP_PLATFORM_SDK_URL} && dpkg -x $${AIRMAP_PLATFORM_SDK_FILENAME} $${AIRMAP_PLATFORM_SDK_PATH}/")
            system("mv $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}/lib/* $${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}/")
            system("mv $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}/include/airmap/* $${AIRMAP_PLATFORM_SDK_PATH}/include/")
            system("rm -rf $${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_PREFIX}")
            system("rm $${AIRMAP_PLATFORM_SDK_FILENAME}")

            exists($${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH) {
                message("Including support for AirMap for Linux")
                LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
                DEFINES += QGC_AIRMAP_ENABLED
            } else {
                message("Failed to install AirMap support for Linux")
            }
        }
    } else {
        message("Skipping support for Airmap (unsupported platform)")
    }
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        INCLUDEPATH += \
            $${AIRMAP_PLATFORM_SDK_PATH}/include
    }
}


Fix ut_minputcontextplugin with nomeegootouch

Details: include mconfig.pri into tests. Link to libmaliit in
ut_minputcontextplugin in nomeegotouch case. Add maliit to
LD_LIBRARY_PATH in runtests.sh

Full, original commit at 74a1e676f6243ca8fc41cad50afe06644e8038f6 in maliit-framework

include(../mconfig.pri)

OBJECTS_DIR = .obj
MOC_DIR = .moc

CONFIG += debug
QT += testlib xml

QMAKE_CLEAN += *.log *~

target.path = /usr/lib/meego-im-framework-tests/$$TARGET
INSTALLS += target

SRC_DIR = ../../src
PASSTHROUGH_DIR = ../../passthroughserver

INCLUDEPATH += . \
               $$SRC_DIR \
               $$PASSTHROUGH_DIR

code_coverage_option=off
for(OPTION,$$list($$lower($$COV_OPTION))){
    isEqual(OPTION, on){
        code_coverage_option=on
    }
}


[SC-174] Remove FFTW flag

[SC-174] Remove FFTW flag

############################################## GLOBAL FUNCTIONS ###############################################
#Define minQtVersion Test
defineTest(minQtVersion) {
    maj = $$1
    min = $$2
    patch = $$3
    isEqual(QT_MAJOR_VERSION, $$maj) {
        isEqual(QT_MINOR_VERSION, $$min) {
            isEqual(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
            greaterThan(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
        }
        greaterThan(QT_MINOR_VERSION, $$min) {
            return(true)
        }
    }
    greaterThan(QT_MAJOR_VERSION, $$maj) {
        return(true)
    }
    return(false)
}

defineReplace(macDeployArgs) {
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    mne_library_dir = $$4
    extra_args = $$5

    isEmpty(target_ext) {
        target_ext = .app
    }

    deploy_cmd = macdeployqt

    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))

    deploy_libs_to_copy = -libpath=$${mne_library_dir}
    !isEmpty(extra_args) {
      deploy_libs_to_copy += $${extra_args}
    }
    return($$deploy_cmd $$deploy_target $$deploy_libs_to_copy)
}

defineReplace(winDeployLibArgs) {
    # Copy library to bin folder
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    mne_library_dir = $$4
    extra_args = $$5

    isEmpty(target_ext) {
        target_ext = .dll
    }

    file = $$shell_quote($$shell_path($${mne_library_dir}/$${target}$${target_ext}))
    final_deploy_command += $${QMAKE_COPY} $${file} $$shell_quote($${mne_binary_dir}) $$escape_expand(\\n\\t)

    # Deploy qt dependecies for the library
    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))
    deploy_cmd = windeployqt

    final_deploy_command += $$deploy_cmd $$deploy_target $$extra_args $$escape_expand(\\n\\t)

    return($${final_deploy_command})
}

defineReplace(winDeployAppArgs) {
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    extra_args = $$5

    # Deploy qt dependecies for the application
    isEmpty(target_ext) {
        target_ext = .exe
    }

    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))
    deploy_cmd = windeployqt

    final_deploy_command += $$deploy_cmd $$deploy_target $$extra_args $$escape_expand(\\n\\t)

    return($${final_deploy_command})
}

defineReplace(copyResources) {
    resource_files = $$1

    for(FILE, resource_files) {
        FILEDIR = $$dirname(FILE)
        FILEDIR ~= s,/resources,/bin/resources,g
        FILEDIR = $$shell_path($${FILEDIR})
        TRGTDIR = $${FILEDIR}

        final_copy_command += $$sprintf($${QMAKE_MKDIR_CMD}, "$${TRGTDIR}") $$escape_expand(\n\t)

        FILE = $$shell_path($${FILE})
        final_copy_command += $${QMAKE_COPY} $$quote($${FILE}) $$quote($${TRGTDIR}) $$escape_expand(\\n\\t)
    }

    return($${final_copy_command})
}

############################################### GLOBAL DEFINES ################################################

MNE_CPP_VERSION = 1.0.0
MNE_LIB_VERSION = 1

QMAKE_TARGET_PRODUCT = mne-cpp
QMAKE_TARGET_DESCRIPTION = MNE Qt 5 based C++ library.
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2019 Authors of mne-cpp. All rights reserved.

########################################### PROJECT CONFIGURATION #############################################

## To build only the minimal version, i.e, for mne_rt_server run: qmake MNECPP_CONFIG+=minimalVersion
## To set CodeCov coverage compiler flag run: qmake MNECPP_CONFIG+=withCodeCov
## To disable tests run: qmake MNECPP_CONFIG+=noTests
## To disable examples run: qmake MNECPP_CONFIG+=noExamples
## To disable applications run: qmake MNECPP_CONFIG+=noApplications
## To build basic MNE Scan version run: qmake MNECPP_CONFIG+=buildBasicMneScanVersion
## To build MNE-CPP libraries as static libs: qmake MNECPP_CONFIG+=static
## To build MNE-CPP Deep library based CNTK: qmake MNECPP_CONFIG+=buildDeep
## To build MNE-CPP with FFTW support in Eigen (make sure to specify FFTW_DIRs below): qmake MNECPP_CONFIG+=useFFTW
## To build MNE-CPP Disp library and MNE Browse with OpenGL support (default is with OpenGL support): qmake MNECPP_CONFIG+=dispOpenGL

# Default flags
MNECPP_CONFIG += dispOpenGL

#Build minimalVersion for qt versions < 5.10.0
!minQtVersion(5, 10, 0) {
    message("Building minimal version due to Qt version $${QT_VERSION}.")
    MNECPP_CONFIG += minimalVersion
}

########################################### DIRECTORY DEFINITIONS #############################################

# Eigen
EIGEN_INCLUDE_DIR = $$EIGEN_INCLUDE_DIR
isEmpty(EIGEN_INCLUDE_DIR) {
    EIGEN_INCLUDE_DIR = $$shell_path($${PWD}/include/3rdParty/eigen3)
}

#CNTK
CNTK_INCLUDE_DIR = $$CNTK_INCLUDE_DIR
isEmpty( CNTK_INCLUDE_DIR ) {
    # Check CNTK Path options
    exists($$shell_path($$(CNTKPATH)/cntk/Include/Eval.h)) {
        CNTK_TEST_DIR = $$shell_path($$(CNTKPATH)/cntk)
    }
    exists($$shell_path($$(CNTKPATH)/Include/Eval.h)) {
        CNTK_TEST_DIR = $$(CNTKPATH)
    }
    exists($$shell_path($$(MYCNTKPATH)/cntk/Include/Eval.h)) {
        CNTK_TEST_DIR = $$shell_path($$(MYCNTKPATH)/cntk)
    }
    exists($$shell_path($$(MYCNTKPATH)/Include/Eval.h)) {
        CNTK_TEST_DIR = $$(MYCNTKPATH)
    }
    # Set CNTK path variables
    !isEmpty( CNTK_TEST_DIR ) {
        CNTK_INCLUDE_DIR = $$shell_path($${CNTK_TEST_DIR}/Include)
        CNTK_LIBRARY_DIR = $$shell_path($${CNTK_TEST_DIR}/cntk)
    }
}

# include
MNE_INCLUDE_DIR = $$MNE_INCLUDE_DIR
isEmpty( MNE_INCLUDE_DIR ) {
    MNE_INCLUDE_DIR = $$shell_path($${PWD}/libraries)
}
MNE_SCAN_INCLUDE_DIR = $$MNE_SCAN_INCLUDE_DIR
isEmpty( MNE_SCAN_INCLUDE_DIR ) {
    MNE_SCAN_INCLUDE_DIR = $$shell_path($${PWD}/applications/mne_scan/libs)
}
MNE_ANALYZE_INCLUDE_DIR = $$MNE_ANALYZE_INCLUDE_DIR
isEmpty( MNE_ANALYZE_INCLUDE_DIR ) {
    MNE_ANALYZE_INCLUDE_DIR = $$shell_path($${PWD}/applications/mne_analyze/libs)
}
MNE_ANALYZE_EXTENSIONS_DIR = $$MNE_ANALYZE_EXTENSIONS_DIR
isEmpty( MNE_ANALYZE_EXTENSIONS_DIR ) {
    MNE_ANALYZE_EXTENSIONS_DIR = $$shell_path($${PWD}/applications/mne_analyze/extensions)
}

# lib
MNE_LIBRARY_DIR = $$MNE_LIBRARY_DIR
isEmpty( MNE_LIBRARY_DIR ) {
    MNE_LIBRARY_DIR = $$shell_path($${PWD}/lib)
}
contains(MNECPP_CONFIG, buildDeep) {
    CNTK_LIBRARY_DIR = $$CNTK_LIBRARY_DIR
    isEmpty( CNTK_LIBRARY_DIR ) {
        CNTK_LIBRARY_DIR = $$shell_path(C:/local/cntk/cntk)
    }
}

# bin
MNE_BINARY_DIR = $$MNE_BINARY_DIR
isEmpty( MNE_BINARY_DIR ) {
    MNE_BINARY_DIR = $$shell_path($${PWD}/bin)
}

# repository dir
ROOT_DIR = $${PWD}

# install
MNE_INSTALL_INCLUDE_DIR = $$MNE_INSTALL_INCLUDE_DIR
isEmpty( MNE_INSTALL_INCLUDE_DIR ) {
    MNE_INSTALL_INCLUDE_DIR = $$shell_path($${PWD}/include)
}

# FFTW dir
FFTW_DIR_LIBS = $$shell_path(C:\fftw-3.3.5-dll64)
FFTW_DIR_INCLUDE = $$shell_path(C:\fftw-3.3.5-dll64)

############################################## GLOBAL FUNCTIONS ###############################################
#Define minQtVersion Test
defineTest(minQtVersion) {
    maj = $$1
    min = $$2
    patch = $$3
    isEqual(QT_MAJOR_VERSION, $$maj) {
        isEqual(QT_MINOR_VERSION, $$min) {
            isEqual(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
            greaterThan(QT_PATCH_VERSION, $$patch) {
                return(true)
            }
        }
        greaterThan(QT_MINOR_VERSION, $$min) {
            return(true)
        }
    }
    greaterThan(QT_MAJOR_VERSION, $$maj) {
        return(true)
    }
    return(false)
}

defineReplace(macDeployArgs) {
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    mne_library_dir = $$4
    extra_args = $$5

    isEmpty(target_ext) {
        target_ext = .app
    }

    deploy_cmd = macdeployqt

    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))

    deploy_libs_to_copy = -libpath=$${mne_library_dir}
    !isEmpty(extra_args) {
      deploy_libs_to_copy += $${extra_args}
    }
    return($$deploy_cmd $$deploy_target $$deploy_libs_to_copy)
}

defineReplace(winDeployLibArgs) {
    # Copy library to bin folder
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    mne_library_dir = $$4
    extra_args = $$5

    isEmpty(target_ext) {
        target_ext = .dll
    }

    file = $$shell_quote($$shell_path($${mne_library_dir}/$${target}$${target_ext}))
    final_deploy_command += $${QMAKE_COPY} $${file} $$shell_quote($${mne_binary_dir}) $$escape_expand(\\n\\t)

    # Deploy qt dependecies for the library
    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))
    deploy_cmd = windeployqt

    final_deploy_command += $$deploy_cmd $$deploy_target $$extra_args $$escape_expand(\\n\\t)

    return($${final_deploy_command})
}

defineReplace(winDeployAppArgs) {
    target = $$1
    target_ext = $$2
    mne_binary_dir = $$3
    extra_args = $$5

    # Deploy qt dependecies for the application
    isEmpty(target_ext) {
        target_ext = .exe
    }

    deploy_target = $$shell_quote($$shell_path($${mne_binary_dir}/$${target}$${target_ext}))
    deploy_cmd = windeployqt

    final_deploy_command += $$deploy_cmd $$deploy_target $$extra_args $$escape_expand(\\n\\t)

    return($${final_deploy_command})
}

defineReplace(copyResources) {
    resource_files = $$1

    for(FILE, resource_files) {
        FILEDIR = $$dirname(FILE)
        FILEDIR ~= s,/resources,/bin/resources,g
        FILEDIR = $$shell_path($${FILEDIR})
        TRGTDIR = $${FILEDIR}

        final_copy_command += $$sprintf($${QMAKE_MKDIR_CMD}, "$${TRGTDIR}") $$escape_expand(\n\t)

        FILE = $$shell_path($${FILE})
        final_copy_command += $${QMAKE_COPY} $$quote($${FILE}) $$quote($${TRGTDIR}) $$escape_expand(\\n\\t)
    }

    return($${final_copy_command})
}

############################################### GLOBAL DEFINES ################################################

MNE_CPP_VERSION = 1.0.0
MNE_LIB_VERSION = 1

QMAKE_TARGET_PRODUCT = mne-cpp
QMAKE_TARGET_DESCRIPTION = MNE Qt 5 based C++ library.
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2019 Authors of mne-cpp. All rights reserved.

########################################### PROJECT CONFIGURATION #############################################

## To build only the minimal version, i.e, for mne_rt_server run: qmake MNECPP_CONFIG+=minimalVersion
## To set CodeCov coverage compiler flag run: qmake MNECPP_CONFIG+=withCodeCov
## To disable tests run: qmake MNECPP_CONFIG+=noTests
## To disable examples run: qmake MNECPP_CONFIG+=noExamples
## To disable applications run: qmake MNECPP_CONFIG+=noApplications
## To build basic MNE Scan version run: qmake MNECPP_CONFIG+=buildBasicMneScanVersion
## To build MNE-CPP libraries as static libs: qmake MNECPP_CONFIG+=static
## To build MNE-CPP Deep library based CNTK: qmake MNECPP_CONFIG+=buildDeep
## To build MNE-CPP with FFTW support in Eigen (make sure to specify FFTW_DIRs below): qmake MNECPP_CONFIG+=useFFTW
## To build MNE-CPP Disp library and MNE Browse with OpenGL support (default is with OpenGL support): qmake MNECPP_CONFIG+=dispOpenGL

# Default flags
MNECPP_CONFIG += dispOpenGL useFFTW

#Build minimalVersion for qt versions < 5.10.0
!minQtVersion(5, 10, 0) {
    message("Building minimal version due to Qt version $${QT_VERSION}.")
    MNECPP_CONFIG += minimalVersion
}

########################################### DIRECTORY DEFINITIONS #############################################

# Eigen
EIGEN_INCLUDE_DIR = $$EIGEN_INCLUDE_DIR
isEmpty(EIGEN_INCLUDE_DIR) {
    EIGEN_INCLUDE_DIR = $$shell_path($${PWD}/include/3rdParty/eigen3)
}

#CNTK
CNTK_INCLUDE_DIR = $$CNTK_INCLUDE_DIR
isEmpty( CNTK_INCLUDE_DIR ) {
    # Check CNTK Path options
    exists($$shell_path($$(CNTKPATH)/cntk/Include/Eval.h)) {
        CNTK_TEST_DIR = $$shell_path($$(CNTKPATH)/cntk)
    }
    exists($$shell_path($$(CNTKPATH)/Include/Eval.h)) {
        CNTK_TEST_DIR = $$(CNTKPATH)
    }
    exists($$shell_path($$(MYCNTKPATH)/cntk/Include/Eval.h)) {
        CNTK_TEST_DIR = $$shell_path($$(MYCNTKPATH)/cntk)
    }
    exists($$shell_path($$(MYCNTKPATH)/Include/Eval.h)) {
        CNTK_TEST_DIR = $$(MYCNTKPATH)
    }
    # Set CNTK path variables
    !isEmpty( CNTK_TEST_DIR ) {
        CNTK_INCLUDE_DIR = $$shell_path($${CNTK_TEST_DIR}/Include)
        CNTK_LIBRARY_DIR = $$shell_path($${CNTK_TEST_DIR}/cntk)
    }
}

# include
MNE_INCLUDE_DIR = $$MNE_INCLUDE_DIR
isEmpty( MNE_INCLUDE_DIR ) {
    MNE_INCLUDE_DIR = $$shell_path($${PWD}/libraries)
}
MNE_SCAN_INCLUDE_DIR = $$MNE_SCAN_INCLUDE_DIR
isEmpty( MNE_SCAN_INCLUDE_DIR ) {
    MNE_SCAN_INCLUDE_DIR = $$shell_path($${PWD}/applications/mne_scan/libs)
}
MNE_ANALYZE_INCLUDE_DIR = $$MNE_ANALYZE_INCLUDE_DIR
isEmpty( MNE_ANALYZE_INCLUDE_DIR ) {
    MNE_ANALYZE_INCLUDE_DIR = $$shell_path($${PWD}/applications/mne_analyze/libs)
}
MNE_ANALYZE_EXTENSIONS_DIR = $$MNE_ANALYZE_EXTENSIONS_DIR
isEmpty( MNE_ANALYZE_EXTENSIONS_DIR ) {
    MNE_ANALYZE_EXTENSIONS_DIR = $$shell_path($${PWD}/applications/mne_analyze/extensions)
}

# lib
MNE_LIBRARY_DIR = $$MNE_LIBRARY_DIR
isEmpty( MNE_LIBRARY_DIR ) {
    MNE_LIBRARY_DIR = $$shell_path($${PWD}/lib)
}
contains(MNECPP_CONFIG, buildDeep) {
    CNTK_LIBRARY_DIR = $$CNTK_LIBRARY_DIR
    isEmpty( CNTK_LIBRARY_DIR ) {
        CNTK_LIBRARY_DIR = $$shell_path(C:/local/cntk/cntk)
    }
}

# bin
MNE_BINARY_DIR = $$MNE_BINARY_DIR
isEmpty( MNE_BINARY_DIR ) {
    MNE_BINARY_DIR = $$shell_path($${PWD}/bin)
}

# repository dir
ROOT_DIR = $${PWD}

# install
MNE_INSTALL_INCLUDE_DIR = $$MNE_INSTALL_INCLUDE_DIR
isEmpty( MNE_INSTALL_INCLUDE_DIR ) {
    MNE_INSTALL_INCLUDE_DIR = $$shell_path($${PWD}/include)
}

# FFTW dir
FFTW_DIR_LIBS = $$shell_path(C:\fftw-3.3.5-dll64)
FFTW_DIR_INCLUDE = $$shell_path(C:\fftw-3.3.5-dll64)


Added Symbian resources for QtGui.

Added Symbian resources for QtGui.

# This block serves the minimalistic resource file for S60 3.1 platforms.
# Note there is no way to ifdef S60 version in mmp file, that is why the resource
# file is always compiled for WINSCW
minimalAppResource31 = \
    "SOURCEPATH s60framework" \
    "START RESOURCE s60main.rss" \
    "HEADER" \
    "TARGETPATH resource\apps" \
    "END"
MMP_RULES += minimalAppResource31

SYMBIAN_RESOURCES += s60framework/s60main.rss

SOURCES += s60framework/qs60mainapplication.cpp \
           s60framework/qs60mainappui.cpp \
           s60framework/qs60maindocument.cpp

HEADERS += s60framework/qs60mainapplication_p.h \
           s60framework/qs60mainapplication.h \
           s60framework/qs60mainappui.h \
           s60framework/qs60maindocument.h

# This block serves the minimalistic resource file for S60 3.1 platforms.
# Note there is no way to ifdef S60 version in mmp file, that is why the resource
# file is always compiled for WINSCW
minimalAppResource31 = \
    "SOURCEPATH s60framework" \
    "START RESOURCE s60main.rss" \
    "HEADER" \
    "TARGETPATH resource\apps" \
    "END"
MMP_RULES += minimalAppResource31

SOURCES += s60framework/qs60mainapplication.cpp \
           s60framework/qs60mainappui.cpp \
           s60framework/qs60maindocument.cpp

HEADERS += s60framework/qs60mainapplication_p.h \
           s60framework/qs60mainapplication.h \
           s60framework/qs60mainappui.h \
           s60framework/qs60maindocument.h


fixed project file

fixed project file

QT += widgets

INCLUDEPATH += \
	$$PWD/include/ \
	$$PWD/../../../../ \
	$$PWD/../../../../qrgui \
	$$PWD/../../interpreters/interpreterBase/include \

LIBS += -L../../../../bin -lqrkernel -lqrutils -lqrrepo -linterpreterBase

DEFINES += ROBOTS_GENERATOR_LIBRARY

TRANSLATIONS = generatorBase_ru.ts

RESOURCES = generatorBase.qrc

HEADERS += \
	$$PWD/include/generatorBase/robotsGeneratorDeclSpec.h \
	$$PWD/include/generatorBase/generatorKitPluginInterface.h \
	$$PWD/include/generatorBase/robotsGeneratorPluginBase.h \
	$$PWD/include/generatorBase/masterGeneratorBase.h \
	$$PWD/include/generatorBase/generatorCustomizer.h \
	$$PWD/include/generatorBase/controlFlowGeneratorBase.h \
	$$PWD/include/generatorBase/generatorFactoryBase.h \
	$$PWD/include/generatorBase/templateParametrizedEntity.h \
	$$PWD/include/generatorBase/robotsDiagramVisitor.h \
	$$PWD/include/generatorBase/primaryControlFlowValidator.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree.h \
	$$PWD/include/generatorBase/semanticTree/semanticNode.h \
	$$PWD/include/generatorBase/semanticTree/nonZoneNode.h \
	$$PWD/include/generatorBase/semanticTree/zoneNode.h \
	$$PWD/include/generatorBase/semanticTree/simpleNode.h \
	$$PWD/include/generatorBase/semanticTree/finalNode.h \
	$$PWD/include/generatorBase/semanticTree/conditionalNode.h \
	$$PWD/include/generatorBase/semanticTree/ifNode.h \
	$$PWD/include/generatorBase/semanticTree/loopNode.h \
	$$PWD/include/generatorBase/semanticTree/rootNode.h \
	$$PWD/include/generatorBase/parts/variables.h \
	$$PWD/include/generatorBase/parts/subprograms.h \
	$$PWD/include/generatorBase/parts/engines.h \
	$$PWD/include/generatorBase/parts/initTerminateCodeGenerator.h \
	$$PWD/include/generatorBase/parts/sensors.h \
	$$PWD/include/generatorBase/parts/functions.h \
	$$PWD/include/generatorBase/parts/images.h \

HEADERS += \
	$$PWD/src/readableControlFlowGenerator.h \
	$$PWD/src/gotoControlFlowGenerator.h \
	$$PWD/src/rules/semanticTransformationRule.h \
	$$PWD/src/rules/simpleRules/simpleBlockRuleBase.h \
	$$PWD/src/rules/simpleRules/simpleUnvisitedRule.h \
	$$PWD/src/rules/simpleRules/simpleVisitedOneZoneRule.h \
	$$PWD/src/rules/simpleRules/simpleVisitedRuleBase.h \
	$$PWD/src/rules/simpleRules/simpleMergedIfBranchesRule.h \
	$$PWD/src/rules/simpleRules/simpleIfInsideCycleRule.h \
	$$PWD/src/rules/ifRules/ifBlockRuleBase.h \
	$$PWD/src/rules/ifRules/ifWithBothUnvisitedRule.h \
	$$PWD/src/rules/ifRules/ifWithOneVisitedRule.h \
	$$PWD/src/rules/loopRules/loopBlockRuleBase.h \
	$$PWD/src/rules/loopRules/loopWithBothUnvisitedRule.h \
	$$PWD/src/rules/loopRules/loopWithIterationVisitedRule.h \
	$$PWD/src/rules/loopRules/loopWithNextVisitedRule.h \

SOURCES += \
	$$PWD/src/robotsGeneratorPluginBase.cpp \
	$$PWD/src/masterGeneratorBase.cpp \
	$$PWD/src/generatorCustomizer.cpp \
	$$PWD/src/controlFlowGeneratorBase.cpp \
	$$PWD/src/readableControlFlowGenerator.cpp \
	$$PWD/src/gotoControlFlowGenerator.cpp \
	$$PWD/src/robotsDiagramVisitor.cpp \
	$$PWD/src/primaryControlFlowValidator.cpp \
	$$PWD/src/generatorFactoryBase.cpp \
	$$PWD/src/templateParametrizedEntity.cpp \
	$$PWD/src/parts/variables.cpp \
	$$PWD/src/parts/subprograms.cpp \
	$$PWD/src/parts/engines.cpp \
	$$PWD/src/parts/initTerminateCodeGenerator.cpp \
	$$PWD/src/parts/sensors.cpp \
	$$PWD/src/parts/functions.cpp \
	$$PWD/src/parts/images.cpp \
	$$PWD/src/semanticTree/semanticTree.cpp \
	$$PWD/src/semanticTree/semanticNode.cpp \
	$$PWD/src/semanticTree/nonZoneNode.cpp \
	$$PWD/src/semanticTree/zoneNode.cpp \
	$$PWD/src/semanticTree/simpleNode.cpp \
	$$PWD/src/semanticTree/finalNode.cpp \
	$$PWD/src/semanticTree/conditionalNode.cpp \
	$$PWD/src/semanticTree/ifNode.cpp \
	$$PWD/src/semanticTree/loopNode.cpp \
	$$PWD/src/semanticTree/rootNode.cpp \
	$$PWD/src/rules/semanticTransformationRule.cpp \
	$$PWD/src/rules/simpleRules/simpleBlockRuleBase.cpp \
	$$PWD/src/rules/simpleRules/simpleUnvisitedRule.cpp \
	$$PWD/src/rules/simpleRules/simpleVisitedOneZoneRule.cpp \
	$$PWD/src/rules/simpleRules/simpleVisitedRuleBase.cpp \
	$$PWD/src/rules/simpleRules/simpleMergedIfBranchesRule.cpp \
	$$PWD/src/rules/simpleRules/simpleIfInsideCycleRule.cpp \
	$$PWD/src/rules/ifRules/ifBlockRuleBase.cpp \
	$$PWD/src/rules/ifRules/ifWithBothUnvisitedRule.cpp \
	$$PWD/src/rules/ifRules/ifWithOneVisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopBlockRuleBase.cpp \
	$$PWD/src/rules/loopRules/loopWithBothUnvisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopWithIterationVisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopWithNextVisitedRule.cpp \

# Simple element generators & converters

HEADERS += \
	$$PWD/include/generatorBase/converters/templateParametrizedConverter.h \
	$$PWD/include/generatorBase/converters/templateParametrizedMultiConverter.h \
	$$PWD/include/generatorBase/converters/stringPropertyConverter.h \
	$$PWD/include/generatorBase/simpleGenerators/abstractSimpleGenerator.h \
	$$PWD/include/generatorBase/simpleGenerators/binding.h \
	$$PWD/include/generatorBase/simpleGenerators/bindingGenerator.h \

HEADERS += \
	$$PWD/src/converters/enumConverterBase.h \
	$$PWD/src/converters/codeConverterBase.h \
	$$PWD/src/converters/intPropertyConverter.h \
	$$PWD/src/converters/floatPropertyConverter.h \
	$$PWD/src/converters/boolPropertyConverter.h \
	$$PWD/src/converters/nameNormalizerConverter.h \
	$$PWD/src/converters/functionBlockConverter.h \
	$$PWD/src/converters/inequalitySignConverter.h \
	$$PWD/src/converters/colorConverter.h \
	$$PWD/src/converters/breakModeConverter.h \
	$$PWD/src/converters/outputPortConverter.h \
	$$PWD/src/converters/enginePortsConverter.h \
	$$PWD/src/converters/typeConverter.h \
	$$PWD/src/converters/inputPortConverter.h \
	$$PWD/src/converters/functionInvocationConverter.h \
	$$PWD/src/simpleGenerators/nullGenerator.h \
	$$PWD/src/simpleGenerators/commentElementGenerator.h \
	$$PWD/src/simpleGenerators/functionElementGenerator.h \
	$$PWD/src/simpleGenerators/ifElementGenerator.h \
	$$PWD/src/simpleGenerators/infiniteLoopGenerator.h \
	$$PWD/src/simpleGenerators/forLoopGenerator.h \
	$$PWD/src/simpleGenerators/whileLoopGenerator.h \
	$$PWD/src/simpleGenerators/enginesStopGenerator.h \
	$$PWD/src/simpleGenerators/timerGenerator.h \
	$$PWD/src/simpleGenerators/beepGenerator.h \
	$$PWD/src/simpleGenerators/playToneGenerator.h \
	$$PWD/src/simpleGenerators/finalNodeGenerator.h \
	$$PWD/src/simpleGenerators/nullificationEncoderGenerator.h \
	$$PWD/src/simpleGenerators/waitForColorBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForColorIntensityBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForLightBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForSonarBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForEncoderBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForTouchSensorBlockGenerator.h \
	$$PWD/src/simpleGenerators/initialNodeGenerator.h \
	$$PWD/src/simpleGenerators/enginesGenerator.h \
	$$PWD/src/simpleGenerators/waitForSoundBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForGyroscopeBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForAccelerometerBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawPixelBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForButtonsBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawLineBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawCircleBlockGenerator.h \
	$$PWD/src/simpleGenerators/printTextBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawRectBlockGenerator.h \
	$$PWD/src/simpleGenerators/clearScreenBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawBlockGenerator.h \
	$$PWD/src/simpleGenerators/subprogramsSimpleGenerator.h \
	$$PWD/src/simpleGenerators/breakGenerator.h \
	$$PWD/src/simpleGenerators/continueGenerator.h \
	$$PWD/src/simpleGenerators/labelGenerator.h \
	$$PWD/src/simpleGenerators/gotoSimpleGenerator.h \

SOURCES += \
	$$PWD/src/converters/templateParametrizedConverter.cpp \
	$$PWD/src/converters/templateParametrizedMultiConverter.cpp \
	$$PWD/src/converters/enumConverterBase.cpp \
	$$PWD/src/converters/codeConverterBase.cpp \
	$$PWD/src/converters/intPropertyConverter.cpp \
	$$PWD/src/converters/floatPropertyConverter.cpp \
	$$PWD/src/converters/boolPropertyConverter.cpp \
	$$PWD/src/converters/stringPropertyConverter.cpp \
	$$PWD/src/converters/nameNormalizerConverter.cpp \
	$$PWD/src/converters/functionBlockConverter.cpp \
	$$PWD/src/converters/inequalitySignConverter.cpp \
	$$PWD/src/converters/colorConverter.cpp \
	$$PWD/src/converters/breakModeConverter.cpp \
	$$PWD/src/converters/outputPortConverter.cpp \
	$$PWD/src/converters/enginePortsConverter.cpp \
	$$PWD/src/converters/typeConverter.cpp \
	$$PWD/src/converters/inputPortConverter.cpp \
	$$PWD/src/converters/functionInvocationConverter.cpp \
	$$PWD/src/simpleGenerators/abstractSimpleGenerator.cpp \
	$$PWD/src/simpleGenerators/nullGenerator.cpp \
	$$PWD/src/simpleGenerators/commentElementGenerator.cpp \
	$$PWD/src/simpleGenerators/functionElementGenerator.cpp \
	$$PWD/src/simpleGenerators/ifElementGenerator.cpp \
	$$PWD/src/simpleGenerators/infiniteLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/forLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/whileLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/bindingGenerator.cpp \
	$$PWD/src/simpleGenerators/binding.cpp \
	$$PWD/src/simpleGenerators/enginesStopGenerator.cpp \
	$$PWD/src/simpleGenerators/timerGenerator.cpp \
	$$PWD/src/simpleGenerators/beepGenerator.cpp \
	$$PWD/src/simpleGenerators/playToneGenerator.cpp \
	$$PWD/src/simpleGenerators/finalNodeGenerator.cpp \
	$$PWD/src/simpleGenerators/nullificationEncoderGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForColorBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForColorIntensityBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForLightBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForSonarBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForEncoderBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForTouchSensorBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/initialNodeGenerator.cpp \
	$$PWD/src/simpleGenerators/enginesGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForSoundBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForGyroscopeBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForAccelerometerBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawPixelBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForButtonsBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawLineBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawCircleBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/printTextBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawRectBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/clearScreenBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/subprogramsSimpleGenerator.cpp \
	$$PWD/src/simpleGenerators/breakGenerator.cpp \
	$$PWD/src/simpleGenerators/continueGenerator.cpp \
	$$PWD/src/simpleGenerators/labelGenerator.cpp \
	$$PWD/src/simpleGenerators/gotoSimpleGenerator.cpp \

QT += widgets

INCLUDEPATH += \
	$$PWD/include/ \
	$$PWD/../../../../ \
	$$PWD/../../../../qrgui \
	$$PWD/../../interpreters/interpreterBase/include \

LIBS += -L../../../../bin -lqrkernel -lqrutils -lqrrepo -linterpreterBase

DEFINES += ROBOTS_GENERATOR_LIBRARY

TRANSLATIONS = generatorBase_ru.ts

RESOURCES = generatorBase.qrc

HEADERS += \
	$$PWD/include/generatorBase/robotsGeneratorDeclSpec.h \
	$$PWD/include/generatorBase/generatorKitPluginInterface.h \
	$$PWD/include/generatorBase/robotsGeneratorPluginBase.h \
	$$PWD/include/generatorBase/masterGeneratorBase.h \
	$$PWD/include/generatorBase/generatorCustomizer.h \
	$$PWD/include/generatorBase/controlFlowGeneratorBase.h \
	$$PWD/include/generatorBase/generatorFactoryBase.h \
	$$PWD/include/generatorBase/templateParametrizedEntity.h \
	$$PWD/include/generatorBase/robotsDiagramVisitor.h \
	$$PWD/include/generatorBase/primaryControlFlowValidator.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/semanticNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/nonZoneNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/zoneNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/simpleNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/finalNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/conditionalNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/ifNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/loopNode.h \
	$$PWD/include/generatorBase/semanticTree/semanticTree/rootNode.h \
	$$PWD/include/generatorBase/parts/variables.h \
	$$PWD/include/generatorBase/parts/subprograms.h \
	$$PWD/include/generatorBase/parts/engines.h \
	$$PWD/include/generatorBase/parts/initTerminateCodeGenerator.h \
	$$PWD/include/generatorBase/parts/sensors.h \
	$$PWD/include/generatorBase/parts/functions.h \
	$$PWD/include/generatorBase/parts/images.h \

HEADERS += \
	$$PWD/src/readableControlFlowGenerator.h \
	$$PWD/src/gotoControlFlowGenerator.h \
	$$PWD/src/rules/semanticTransformationRule.h \
	$$PWD/src/rules/simpleRules/simpleBlockRuleBase.h \
	$$PWD/src/rules/simpleRules/simpleUnvisitedRule.h \
	$$PWD/src/rules/simpleRules/simpleVisitedOneZoneRule.h \
	$$PWD/src/rules/simpleRules/simpleVisitedRuleBase.h \
	$$PWD/src/rules/simpleRules/simpleMergedIfBranchesRule.h \
	$$PWD/src/rules/simpleRules/simpleIfInsideCycleRule.h \
	$$PWD/src/rules/ifRules/ifBlockRuleBase.h \
	$$PWD/src/rules/ifRules/ifWithBothUnvisitedRule.h \
	$$PWD/src/rules/ifRules/ifWithOneVisitedRule.h \
	$$PWD/src/rules/loopRules/loopBlockRuleBase.h \
	$$PWD/src/rules/loopRules/loopWithBothUnvisitedRule.h \
	$$PWD/src/rules/loopRules/loopWithIterationVisitedRule.h \
	$$PWD/src/rules/loopRules/loopWithNextVisitedRule.h \

SOURCES += \
	$$PWD/src/robotsGeneratorPluginBase.cpp \
	$$PWD/src/masterGeneratorBase.cpp \
	$$PWD/src/generatorCustomizer.cpp \
	$$PWD/src/controlFlowGeneratorBase.cpp \
	$$PWD/src/readableControlFlowGenerator.cpp \
	$$PWD/src/gotoControlFlowGenerator.cpp \
	$$PWD/src/robotsDiagramVisitor.cpp \
	$$PWD/src/primaryControlFlowValidator.cpp \
	$$PWD/src/generatorFactoryBase.cpp \
	$$PWD/src/templateParametrizedEntity.cpp \
	$$PWD/src/parts/variables.cpp \
	$$PWD/src/parts/subprograms.cpp \
	$$PWD/src/parts/engines.cpp \
	$$PWD/src/parts/initTerminateCodeGenerator.cpp \
	$$PWD/src/parts/sensors.cpp \
	$$PWD/src/parts/functions.cpp \
	$$PWD/src/parts/images.cpp \
	$$PWD/src/semanticTree/semanticTree.cpp \
	$$PWD/src/semanticTree/semanticNode.cpp \
	$$PWD/src/semanticTree/nonZoneNode.cpp \
	$$PWD/src/semanticTree/zoneNode.cpp \
	$$PWD/src/semanticTree/simpleNode.cpp \
	$$PWD/src/semanticTree/finalNode.cpp \
	$$PWD/src/semanticTree/conditionalNode.cpp \
	$$PWD/src/semanticTree/ifNode.cpp \
	$$PWD/src/semanticTree/loopNode.cpp \
	$$PWD/src/semanticTree/rootNode.cpp \
	$$PWD/src/rules/semanticTransformationRule.cpp \
	$$PWD/src/rules/simpleRules/simpleBlockRuleBase.cpp \
	$$PWD/src/rules/simpleRules/simpleUnvisitedRule.cpp \
	$$PWD/src/rules/simpleRules/simpleVisitedOneZoneRule.cpp \
	$$PWD/src/rules/simpleRules/simpleVisitedRuleBase.cpp \
	$$PWD/src/rules/simpleRules/simpleMergedIfBranchesRule.cpp \
	$$PWD/src/rules/simpleRules/simpleIfInsideCycleRule.cpp \
	$$PWD/src/rules/ifRules/ifBlockRuleBase.cpp \
	$$PWD/src/rules/ifRules/ifWithBothUnvisitedRule.cpp \
	$$PWD/src/rules/ifRules/ifWithOneVisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopBlockRuleBase.cpp \
	$$PWD/src/rules/loopRules/loopWithBothUnvisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopWithIterationVisitedRule.cpp \
	$$PWD/src/rules/loopRules/loopWithNextVisitedRule.cpp \

# Simple element generators & converters

HEADERS += \
	$$PWD/include/generatorBase/converters/templateParametrizedConverter.h \
	$$PWD/include/generatorBase/converters/templateParametrizedMultiConverter.h \
	$$PWD/include/generatorBase/converters/stringPropertyConverter.h \
	$$PWD/include/generatorBase/simpleGenerators/abstractSimpleGenerator.h \
	$$PWD/include/generatorBase/simpleGenerators/binding.h \
	$$PWD/include/generatorBase/simpleGenerators/bindingGenerator.h \

HEADERS += \
	$$PWD/src/converters/enumConverterBase.h \
	$$PWD/src/converters/codeConverterBase.h \
	$$PWD/src/converters/intPropertyConverter.h \
	$$PWD/src/converters/floatPropertyConverter.h \
	$$PWD/src/converters/boolPropertyConverter.h \
	$$PWD/src/converters/nameNormalizerConverter.h \
	$$PWD/src/converters/functionBlockConverter.h \
	$$PWD/src/converters/inequalitySignConverter.h \
	$$PWD/src/converters/colorConverter.h \
	$$PWD/src/converters/breakModeConverter.h \
	$$PWD/src/converters/outputPortConverter.h \
	$$PWD/src/converters/enginePortsConverter.h \
	$$PWD/src/converters/typeConverter.h \
	$$PWD/src/converters/inputPortConverter.h \
	$$PWD/src/converters/functionInvocationConverter.h \
	$$PWD/src/simpleGenerators/nullGenerator.h \
	$$PWD/src/simpleGenerators/commentElementGenerator.h \
	$$PWD/src/simpleGenerators/functionElementGenerator.h \
	$$PWD/src/simpleGenerators/ifElementGenerator.h \
	$$PWD/src/simpleGenerators/infiniteLoopGenerator.h \
	$$PWD/src/simpleGenerators/forLoopGenerator.h \
	$$PWD/src/simpleGenerators/whileLoopGenerator.h \
	$$PWD/src/simpleGenerators/enginesStopGenerator.h \
	$$PWD/src/simpleGenerators/timerGenerator.h \
	$$PWD/src/simpleGenerators/beepGenerator.h \
	$$PWD/src/simpleGenerators/playToneGenerator.h \
	$$PWD/src/simpleGenerators/finalNodeGenerator.h \
	$$PWD/src/simpleGenerators/nullificationEncoderGenerator.h \
	$$PWD/src/simpleGenerators/waitForColorBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForColorIntensityBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForLightBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForSonarBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForEncoderBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForTouchSensorBlockGenerator.h \
	$$PWD/src/simpleGenerators/initialNodeGenerator.h \
	$$PWD/src/simpleGenerators/enginesGenerator.h \
	$$PWD/src/simpleGenerators/waitForSoundBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForGyroscopeBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForAccelerometerBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawPixelBlockGenerator.h \
	$$PWD/src/simpleGenerators/waitForButtonsBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawLineBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawCircleBlockGenerator.h \
	$$PWD/src/simpleGenerators/printTextBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawRectBlockGenerator.h \
	$$PWD/src/simpleGenerators/clearScreenBlockGenerator.h \
	$$PWD/src/simpleGenerators/drawBlockGenerator.h \
	$$PWD/src/simpleGenerators/subprogramsSimpleGenerator.h \
	$$PWD/src/simpleGenerators/breakGenerator.h \
	$$PWD/src/simpleGenerators/continueGenerator.h \
	$$PWD/src/simpleGenerators/labelGenerator.h \
	$$PWD/src/simpleGenerators/gotoSimpleGenerator.h \

SOURCES += \
	$$PWD/src/converters/templateParametrizedConverter.cpp \
	$$PWD/src/converters/templateParametrizedMultiConverter.cpp \
	$$PWD/src/converters/enumConverterBase.cpp \
	$$PWD/src/converters/codeConverterBase.cpp \
	$$PWD/src/converters/intPropertyConverter.cpp \
	$$PWD/src/converters/floatPropertyConverter.cpp \
	$$PWD/src/converters/boolPropertyConverter.cpp \
	$$PWD/src/converters/stringPropertyConverter.cpp \
	$$PWD/src/converters/nameNormalizerConverter.cpp \
	$$PWD/src/converters/functionBlockConverter.cpp \
	$$PWD/src/converters/inequalitySignConverter.cpp \
	$$PWD/src/converters/colorConverter.cpp \
	$$PWD/src/converters/breakModeConverter.cpp \
	$$PWD/src/converters/outputPortConverter.cpp \
	$$PWD/src/converters/enginePortsConverter.cpp \
	$$PWD/src/converters/typeConverter.cpp \
	$$PWD/src/converters/inputPortConverter.cpp \
	$$PWD/src/converters/functionInvocationConverter.cpp \
	$$PWD/src/simpleGenerators/abstractSimpleGenerator.cpp \
	$$PWD/src/simpleGenerators/nullGenerator.cpp \
	$$PWD/src/simpleGenerators/commentElementGenerator.cpp \
	$$PWD/src/simpleGenerators/functionElementGenerator.cpp \
	$$PWD/src/simpleGenerators/ifElementGenerator.cpp \
	$$PWD/src/simpleGenerators/infiniteLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/forLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/whileLoopGenerator.cpp \
	$$PWD/src/simpleGenerators/bindingGenerator.cpp \
	$$PWD/src/simpleGenerators/binding.cpp \
	$$PWD/src/simpleGenerators/enginesStopGenerator.cpp \
	$$PWD/src/simpleGenerators/timerGenerator.cpp \
	$$PWD/src/simpleGenerators/beepGenerator.cpp \
	$$PWD/src/simpleGenerators/playToneGenerator.cpp \
	$$PWD/src/simpleGenerators/finalNodeGenerator.cpp \
	$$PWD/src/simpleGenerators/nullificationEncoderGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForColorBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForColorIntensityBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForLightBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForSonarBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForEncoderBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForTouchSensorBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/initialNodeGenerator.cpp \
	$$PWD/src/simpleGenerators/enginesGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForSoundBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForGyroscopeBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForAccelerometerBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawPixelBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/waitForButtonsBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawLineBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawCircleBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/printTextBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawRectBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/clearScreenBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/drawBlockGenerator.cpp \
	$$PWD/src/simpleGenerators/subprogramsSimpleGenerator.cpp \
	$$PWD/src/simpleGenerators/breakGenerator.cpp \
	$$PWD/src/simpleGenerators/continueGenerator.cpp \
	$$PWD/src/simpleGenerators/labelGenerator.cpp \
	$$PWD/src/simpleGenerators/gotoSimpleGenerator.cpp \


Force GCC to use C99

Force GCC to use C99

INCLUDEPATH += $$PWD/include

!macx* {
    LIBS += -pthread
}

QMAKE_CFLAGS_DEBUG = -std=gnu99
QMAKE_CFLAGS_RELEASE = -std=gnu99

HEADERS += \
    $$PWD/include/DS_Client.h \
    $$PWD/include/DS_Config.h \
    $$PWD/include/DS_Events.h \
    $$PWD/include/DS_Joysticks.h \
    $$PWD/include/DS_Types.h \
    $$PWD/include/DS_Utils.h \
    $$PWD/include/LibDS.h \
    $$PWD/include/DS_Array.h \
    $$PWD/include/DS_Socket.h \
    $$PWD/include/DS_Protocol.h \
    $$PWD/include/DS_DefaultProtocols.h \
    $$PWD/include/DS_Timer.h \
    $$PWD/include/DS_Queue.h

SOURCES += \
    $$PWD/src/protocols/frc_2014.c \
    $$PWD/src/protocols/frc_2015.c \
    $$PWD/src/protocols/frc_2016.c \
    $$PWD/src/client.c \
    $$PWD/src/config.c \
    $$PWD/src/events.c \
    $$PWD/src/init.c \
    $$PWD/src/joysticks.c \
    $$PWD/src/protocols.c \
    $$PWD/src/socket.c \
    $$PWD/src/utils.c \
    $$PWD/src/crc32.c \
    $$PWD/src/array.c \
    $$PWD/src/timer.c \
    $$PWD/src/queue.c

include ($$PWD/lib/SDS/SDS.pri)

INCLUDEPATH += $$PWD/include

!macx* {
    LIBS += -pthread
}

HEADERS += \
    $$PWD/include/DS_Client.h \
    $$PWD/include/DS_Config.h \
    $$PWD/include/DS_Events.h \
    $$PWD/include/DS_Joysticks.h \
    $$PWD/include/DS_Types.h \
    $$PWD/include/DS_Utils.h \
    $$PWD/include/LibDS.h \
    $$PWD/include/DS_Array.h \
    $$PWD/include/DS_Socket.h \
    $$PWD/include/DS_Protocol.h \
    $$PWD/include/DS_DefaultProtocols.h \
    $$PWD/include/DS_Timer.h \
    $$PWD/include/DS_Queue.h

SOURCES += \
    $$PWD/src/protocols/frc_2014.c \
    $$PWD/src/protocols/frc_2015.c \
    $$PWD/src/protocols/frc_2016.c \
    $$PWD/src/client.c \
    $$PWD/src/config.c \
    $$PWD/src/events.c \
    $$PWD/src/init.c \
    $$PWD/src/joysticks.c \
    $$PWD/src/protocols.c \
    $$PWD/src/socket.c \
    $$PWD/src/utils.c \
    $$PWD/src/crc32.c \
    $$PWD/src/array.c \
    $$PWD/src/timer.c \
    $$PWD/src/queue.c

include ($$PWD/lib/SDS/SDS.pri)


Fix QtSsh.pri paths

Fix QtSsh.pri paths

# QtSsh
HEADERS += \
    $$PWD/qtssh/sshtunnelout.h \
    $$PWD/qtssh/sshtunnelin.h \
    $$PWD/qtssh/sshprocess.h \
    $$PWD/qtssh/sshchannel.h \
    $$PWD/qtssh/sshclient.h \
    $$PWD/qtssh/sshtunneloutsrv.h \
    $$PWD/qtssh/sshserviceport.h \
    $$PWD/qtssh/sshscpsend.h \
    $$PWD/qtssh/sshsftp.h \
    $$PWD/qtssh/sshworker.h \
    $$PWD/qtssh/sshinterface.h \
    $$PWD/qtssh/sshfsinterface.h \
    $$PWD/qtssh/sshfilesystemmodel.h \
    $$PWD/qtssh/sshfilesystemnode.h

SOURCES += \
    $$PWD/qtssh/sshtunnelout.cpp \
    $$PWD/qtssh/sshtunnelin.cpp \
    $$PWD/qtssh/sshprocess.cpp \
    $$PWD/qtssh/sshchannel.cpp \
    $$PWD/qtssh/sshclient.cpp \
    $$PWD/qtssh/sshtunneloutsrv.cpp \
    $$PWD/qtssh/sshscpsend.cpp \
    $$PWD/qtssh/sshsftp.cpp \
    $$PWD/qtssh/sshworker.cpp \
    $$PWD/qtssh/sshfilesystemmodel.cpp \
    $$PWD/qtssh/sshfilesystemnode.cpp

INCLUDEPATH += $$PWD/qtssh

# QtSsh
HEADERS += \
    $$PWD/qtsshsshtunnelout.h \
    $$PWD/qtsshsshtunnelin.h \
    $$PWD/qtsshsshprocess.h \
    $$PWD/qtsshsshchannel.h \
    $$PWD/qtsshsshclient.h \
    $$PWD/qtsshsshtunneloutsrv.h \
    $$PWD/qtsshsshserviceport.h \
    $$PWD/qtsshsshscpsend.h \
    $$PWD/qtsshsshsftp.h \
    $$PWD/qtsshsshworker.h \
    $$PWD/qtsshsshinterface.h \
    $$PWD/qtsshsshfsinterface.h \
    $$PWD/qtsshsshfilesystemmodel.h \
    $$PWD/qtsshsshfilesystemnode.h

SOURCES += \
    $$PWD/qtsshsshtunnelout.cpp \
    $$PWD/qtsshsshtunnelin.cpp \
    $$PWD/qtsshsshprocess.cpp \
    $$PWD/qtsshsshchannel.cpp \
    $$PWD/qtsshsshclient.cpp \
    $$PWD/qtsshsshtunneloutsrv.cpp \
    $$PWD/qtsshsshscpsend.cpp \
    $$PWD/qtsshsshsftp.cpp \
    $$PWD/qtsshsshworker.cpp \
    $$PWD/qtsshsshfilesystemmodel.cpp \
    $$PWD/qtsshsshfilesystemnode.cpp

INCLUDEPATH += $$PWD/qtssh


Fix make check for non-legacy mode

Fix make check for non-legacy mode

RevBy: TrustMe
Add missing path to libmaliit to LD_LIBRARY_PATH. Would fail with
./ut_minputcontextplugin: error while loading shared libraries: libmaliit-1.0.so.0: cannot open shared object file: No such file or directory

Full, original commit at 7234e0a93dcc86a90774e0b4b60c46afefbe409a in maliit-framework

QMAKE_EXTRA_TARGETS += check
check.target = check
check.commands = TESTING_IN_SANDBOX=1 TESTPLUGIN_PATH=../plugins LD_LIBRARY_PATH=../../src:../../input-context/:../../passthroughserver/:../../maliit:../plugins:$(LD_LIBRARY_PATH) ./$$TARGET
check.depends += $$TARGET

QMAKE_EXTRA_TARGETS += check-xml
check-xml.target = check-xml
check-xml.commands = ../rt.sh $$TARGET
check-xml.depends += $$TARGET

# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
for(OPTION,$$list($$lower($$COV_OPTION))){
    isEqual(OPTION, on){
        QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs
        LIBS += -lgcov
    }
}
QMAKE_CLEAN += *.gcno *.gcda

QMAKE_EXTRA_TARGETS += check
check.target = check
check.commands = TESTING_IN_SANDBOX=1 TESTPLUGIN_PATH=../plugins LD_LIBRARY_PATH=../../src:../../input-context/:../../passthroughserver/:../plugins:$(LD_LIBRARY_PATH) ./$$TARGET
check.depends += $$TARGET

QMAKE_EXTRA_TARGETS += check-xml
check-xml.target = check-xml
check-xml.commands = ../rt.sh $$TARGET
check-xml.depends += $$TARGET

# coverage flags are off per default, but can be turned on via qmake COV_OPTION=on
for(OPTION,$$list($$lower($$COV_OPTION))){
    isEqual(OPTION, on){
        QMAKE_CXXFLAGS += -ftest-coverage -fprofile-arcs
        LIBS += -lgcov
    }
}
QMAKE_CLEAN += *.gcno *.gcda


Update wallet-libs.pri

Update wallet-libs.pri

greaterThan(QT_MAJOR_VERSION, 4) {
    QT += widgets
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
}

# for boost 1.37, add -mt to the boost libraries
# use: qmake BOOST_LIB_SUFFIX=-mt
# for boost thread win32 with _win32 sufix
# use: BOOST_THREAD_LIB_SUFFIX=_win32-...
# or when linking against a specific BerkelyDB version: BDB_LIB_SUFFIX=-4.8

BOOST_LIB_SUFFIX=
windows:BOOST_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include/boost
windows:BOOST_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/lib
macx:BOOST_LIB_PATH=/usr/local/opt/boost/lib
macx:BOOST_INCLUDE_PATH=/usr/local/opt/boost/include
windows:BDB_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:BDB_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/lib
macx:BDB_LIB_PATH=/usr/local/opt/berkeley-db\@4/lib/
MINIUPNPC_LIB_SUFFIX=-miniupnpc
windows:MINIUPNPC_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:MINIUPNPC_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/libc
macx:OPENSSL_LIB_PATH=/usr/local/opt/openssl@1.1/lib
macx:OPENSSL_INCLUDE_PATH=/usr/local/opt/openssl@1.1/include
macx:MINIUPNPC_INCLUDE_PATH=/usr/local/opt/miniupnpc/include
macx:MINIUPNPC_LIB_PATH=/usr/local/opt/miniupnpc/lib
macx:QRENCODE_INCLUDE_PATH=/usr/local/opt/qrencode/include
macx:QRENCODE_LIB_PATH=/usr/local/opt/qrencode/lib
macx:CURL_LIB_PATH=/usr/local/opt/curl/lib
macx:CURL_INCLUDE_PATH=/usr/local/opt/curl/lib
macx:SODIUM_INCLUDE_PATH=/usr/local/opt/libsodium/include
macx:SODIUM_LIB_PATH=/usr/local/opt/libsodium/lib
windows:QRENCODE_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:QRENCODE_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/libc

# Dependency library locations can be customized with:
#    BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
#    BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively

OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build

# fixes an issue with boost 1.66 and the number of template parameters of basic_socket_acceptor
#DEFINES += BOOST_ASIO_ENABLE_OLD_SERVICES
# TODO: Move to the new standard of boost as current code is deprecated

# use: qmake "RELEASE=1"
contains(RELEASE, 1) {
    # Mac: compile for maximum compatibility (10.12, 32-bit)
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13
    macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.13 -arch x86_64 -Wno-nullability-completeness -Wno-unused-command-line-argument

    !windows:!macx {
        # Linux: static link
        LIBS += -Wl,-Bstatic
    }
}

!win32 {
# for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection
QMAKE_CXXFLAGS *= -fstack-protector-all
QMAKE_LFLAGS *= -fstack-protector-all
# We need to exclude this for Windows cross compile with MinGW 4.2.x, as it will result in a non-working executable!
# This can be enabled for Windows, when we switch to MinGW >= 4.4.x.
}
# for extra security (see: https://wiki.debian.org/Hardening)
QMAKE_CXXFLAGS *= -D_FORTIFY_SOURCE=2
!clang* {
    QMAKE_CXXFLAGS *= -Wl,-z,relro -Wl,-z,now
}
# for extra security on Windows: enable ASLR and DEP via GCC linker flags
compiler_info = $$system("$${QMAKE_CXX} -dumpmachine")
win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat
!contains(compiler_info, .*x86_64.*) {
    win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static
}
#win32:QMAKE_LFLAGS += -static-libgcc -static-libstdc++

# use: qmake "USE_QRCODE=1"
# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support
contains(USE_QRCODE, 1) {
    message(Building with QRCode support)
    DEFINES += USE_QRCODE
    LIBS += -lqrencode
    windows:LIBS += -lpthread
}

# use: qmake "USE_UPNP=1" ( enabled by default; default)
#  or: qmake "USE_UPNP=0" (disabled by default)
#  or: qmake "USE_UPNP=-" (not supported)
# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support
contains(USE_UPNP, -) {
    message(Building without UPNP support)
} else {
    message(Building with UPNP support)
    count(USE_UPNP, 0) {
        USE_UPNP=1
    }
    DEFINES += USE_UPNP=$$USE_UPNP STATICLIB
    INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH
    LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc
    win32:LIBS += -liphlpapi
}

# use: qmake "USE_DBUS=1" or qmake "USE_DBUS=0"
linux:count(USE_DBUS, 0) {
    USE_DBUS=1
}
contains(USE_DBUS, 1) {
    message(Building with DBUS (Freedesktop notifications) support)
    DEFINES += USE_DBUS
    QT += dbus
}

contains(BITCOIN_NEED_QT_PLUGINS, 1) {
    DEFINES += BITCOIN_NEED_QT_PLUGINS
    QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
}

message("Using lmdb as the blockchain database")
!contains(NEBLIO_CONFIG, VL32) {
    contains(compiler_info, .*x86_64.*) | contains(NEBLIO_CONFIG, VL64) {
        message("Compiling LMDB for a 64-bit system")
        LMDB_32_BIT = false
    } else {
        DEFINES += MDB_VL32
        message("Compiling LMDB for a 32-bit system")
        LMDB_32_BIT = true
    }
} else {
    DEFINES += MDB_VL32
    message("Compiling LMDB for a 32-bit system")
    LMDB_32_BIT = true
}
#    LIBS += -llmdb

INCLUDEPATH += $$PWD/liblmdb
macx: INCLUDEPATH += /usr/local/opt/berkeley-db@4/include /usr/local/opt/boost/include /usr/local/opt/openssl@1.1/include
SOURCES += txdb-lmdb.cpp
#    SOURCES += $$PWD/liblmdb/mdb.c $$PWD/liblmdb/midl.c

#NEBLIO_CONFIG += LMDB_TESTS

!win32 {
    LIBS += $$PWD/liblmdb/liblmdb.a
    # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
    #genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" liblmdb.a
    genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC $(MAKE) liblmdb.a
    isEqual(LMDB_32_BIT, true) {
        genlmdb.commands += "CFLAGS=-DMDB_VL32 CXXFLAGS=-DMDB_VL32"
    }

#        contains( NEBLIO_CONFIG, LMDB_TESTS ) {
#            genlmdb.commands += ./arena_test && ./cache_test && ./env_test && ./table_test && ./write_batch_test && ./coding_test && ./db_bench && ./fault_injection_test && ./issue178_test && ./autocompact_test && ./dbformat_test && ./filename_test && ./issue200_test && ./log_test && ./bloom_test && ./corruption_test && ./db_test && ./filter_block_test && ./recovery_test && ./version_edit_test && ./crc32c_test && ./hash_test && ./memenv_test && ./skiplist_test && ./version_set_test && ./c_test && ./env_posix_test
#        }
} else {
#    SOURCES += $$PWD/liblmdb/mdb.c $$PWD/liblmdb/midl.c
    # make an educated guess about what the ranlib command is called
    isEmpty(QMAKE_RANLIB) {
        QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
    }
    LIBS += -lshlwapi
    LIBS += $$PWD/liblmdb/liblmdb.a
    genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC $(MAKE) clean && CC=$$QMAKE_CC $(MAKE) liblmdb.a
    isEqual(LMDB_32_BIT, true) {
        genlmdb.commands += "CFLAGS=-DMDB_VL32 CXXFLAGS=-DMDB_VL32"
    }
    genlmdb.commands += "&& $$QMAKE_RANLIB -t $$PWD/liblmdb/liblmdb.a"
}
genlmdb.target = $$PWD/liblmdb/liblmdb.a
genlmdb.depends = FORCE
PRE_TARGETDEPS += $$PWD/liblmdb/liblmdb.a
QMAKE_EXTRA_TARGETS += genlmdb
# Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
QMAKE_CLEAN += $$PWD/liblmdb/liblmdb.a; cd $$PWD/liblmdb ; $(MAKE) clean

# regenerate build.h
!windows|contains(USE_BUILD_INFO, 1) {
    genbuild.depends = FORCE
    genbuild.commands = cd $$PWD; /bin/sh ../share/genbuild.sh $$OUT_PWD/build/build.h
    genbuild.target = $$OUT_PWD/build/build.h
    PRE_TARGETDEPS += $$OUT_PWD/build/build.h
    QMAKE_EXTRA_TARGETS += genbuild
    DEFINES += HAVE_BUILD_INFO
}

contains(USE_O3, 1) {
    message(Building O3 optimization flag)
    QMAKE_CXXFLAGS_RELEASE -= -O2
    QMAKE_CFLAGS_RELEASE -= -O2
    QMAKE_CXXFLAGS += -O3
    QMAKE_CFLAGS += -O3
}

*-g++-32 {
    message("32 platform, adding -msse2 flag")

    QMAKE_CXXFLAGS += -msse2
    QMAKE_CFLAGS += -msse2
}

QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector

CODECFORTR = UTF-8

# for lrelease/lupdate
# also add new translations to qt/bitcoin.qrc under translations/
TRANSLATIONS = $$files(qt/locale/bitcoin_*.ts)

isEmpty(QMAKE_LRELEASE) {
    QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
}
isEmpty(QM_DIR):QM_DIR = $$PWD/qt/locale
# automatically build translations, so they can be included in resource file
TSQM.name = lrelease ${QMAKE_FILE_IN}
TSQM.input = TRANSLATIONS
TSQM.output = $$QM_DIR/${QMAKE_FILE_BASE}.qm
TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
TSQM.CONFIG = no_link
QMAKE_EXTRA_COMPILERS += TSQM

# "Other files" to show in Qt Creator
OTHER_FILES += \
    doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc

# platform specific defaults, if not overridden on command line
isEmpty(BOOST_LIB_SUFFIX) {
    macx:BOOST_LIB_SUFFIX = -mt
    windows:BOOST_LIB_SUFFIX = -mt
}

isEmpty(BOOST_THREAD_LIB_SUFFIX) {
    win32:BOOST_THREAD_LIB_SUFFIX = _win32$$BOOST_LIB_SUFFIX
    else:BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX
}

windows:DEFINES += WIN32

windows:!contains(MINGW_THREAD_BUGFIX, 0) {
    # At least qmake's win32-g++-cross profile is missing the -lmingwthrd
    # thread-safety flag. GCC has -mthreads to enable this, but it doesn't
    # work with static linking. -lmingwthrd must come BEFORE -lmingw, so
    # it is prepended to QMAKE_LIBS_QT_ENTRY.
    # It can be turned off with MINGW_THREAD_BUGFIX=0, just in case it causes
    # any problems on some untested qmake profile now or in the future.
    DEFINES += _MT BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
    QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY
}

macx:HEADERS += qt/macdockiconhandler.h qt/macnotificationhandler.h
macx:OBJECTIVE_SOURCES += qt/macdockiconhandler.mm qt/macnotificationhandler.mm
macx:LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0
macx:TARGET = "neblio-Qt"
macx:QMAKE_CFLAGS_THREAD += -pthread
macx:QMAKE_LFLAGS_THREAD += -pthread
macx:QMAKE_CXXFLAGS_THREAD += -pthread

# do not include resources while testing
!contains( NEBLIO_TEST, TRUE ) {
    macx:ICON = qt/res/icons/bitcoin.icns
    windows:RC_FILE = qt/res/bitcoin-qt.rc
}

# Set libraries and includes at end, to use platform-defined defaults if not overridden
INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH $$SODIUM_INCLUDE_PATH
LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,) $$join(SODIUM_LIB_PATH,,-L,)
macx: LIBS += $$join(CURL_LIB_PATH,,-L,)
LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
# -lgdi32 has to happen after -lcrypto (see  #681)
windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32
LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_regex$$BOOST_LIB_SUFFIX -lboost_iostreams$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -lboost_chrono$$BOOST_LIB_SUFFIX -lboost_atomic$$BOOST_LIB_SUFFIX -lz
LIBS += -lsodium
windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX
macx: LIBS += -lcurl

# For Fedora
unix:INCLUDEPATH += /usr/include/libdb4/
unix:LIBS        += -L/usr/lib64/libdb4/

!macx {
    PKG_CONFIG_ENV_VAR = $$(PKG_CONFIG_PATH)
    !isEmpty(PKG_CONFIG_ENV_VAR) {
        PKG_CONFIG_PATH = $$(PKG_CONFIG_PATH)
    }
    isEmpty(PKG_CONFIG_PATH_ENV_VAR) {
        message("PKGCONFIG enviroment variable is not set")
        pkgConfPrefix = ""
    } else {
        message("PKGCONFIG enviroment variable is found to be set to: \"$${PKG_CONFIG_ENV_VAR}\"; it will be used for pkg-config")
        pkgConfPrefix = "PKGCONFIG=$${PKG_CONFIG_PATH}"
    }

    !isEmpty(PKG_CONFIG_PATH) {
        message("Setting PKG_CONFIG_PATH to $${PKG_CONFIG_PATH}")
    }

        pkgconf_exec = "$${pkgConfPrefix} $${CROSS_COMPILE}pkg-config"

    QMAKE_CFLAGS += $$system("$${pkgconf_exec} libcurl --cflags")
    QMAKE_CXXFLAGS += $$system("$${pkgconf_exec} libcurl --cflags")

    # static when release
    contains(RELEASE, 1) {
        libcurlPkgconfCmd = "$${pkgconf_exec} libcurl --libs --static"
    } else {
        libcurlPkgconfCmd = "$${pkgconf_exec} libcurl --libs"
    }
    # the testing whether system() has a zero exit code with the third parameter of system() doesn't work on all Qt versions
    libcURL_LIBS = $$system($$libcurlPkgconfCmd)
    # OpenSSL linking is not necessary as it comes with curl
    # openssl_LIBS = $$system($$opensslPkgconfCmd)
    LIBS += $$libcURL_LIBS $$openssl_LIBS
}

contains(RELEASE, 1) {
    !windows:!macx {
        # Linux: turn dynamic linking back on for c/c++ runtime libraries
        LIBS += -Wl,-Bdynamic
    }
}

!windows:!macx {
    DEFINES += LINUX
    LIBS += -lrt -ldl
}

greaterThan(QT_MAJOR_VERSION, 4) {
    QT += widgets
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
}

# for boost 1.37, add -mt to the boost libraries
# use: qmake BOOST_LIB_SUFFIX=-mt
# for boost thread win32 with _win32 sufix
# use: BOOST_THREAD_LIB_SUFFIX=_win32-...
# or when linking against a specific BerkelyDB version: BDB_LIB_SUFFIX=-4.8

BOOST_LIB_SUFFIX=
windows:BOOST_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include/boost
windows:BOOST_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/lib
macx:BOOST_LIB_PATH=/usr/local/opt/boost/lib
macx:BOOST_INCLUDE_PATH=/usr/local/opt/boost/include
windows:BDB_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:BDB_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/lib
macx:BDB_LIB_PATH=/usr/local/opt/berkeley-db\@4/lib/
MINIUPNPC_LIB_SUFFIX=-miniupnpc
windows:MINIUPNPC_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:MINIUPNPC_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/libc
macx:OPENSSL_LIB_PATH=/usr/local/opt/openssl@1.1/lib
macx:OPENSSL_INCLUDE_PATH=/usr/local/opt/openssl@1.1/include
macx:MINIUPNPC_INCLUDE_PATH=/usr/local/opt/miniupnpc/include
macx:MINIUPNPC_LIB_PATH=/usr/local/opt/miniupnpc/lib
macx:QRENCODE_INCLUDE_PATH=/usr/local/opt/qrencode/include
macx:QRENCODE_LIB_PATH=/usr/local/opt/qrencode/lib
macx:CURL_LIB_PATH=/usr/local/opt/curl/lib
macx:CURL_INCLUDE_PATH=/usr/local/opt/curl/lib
macx:SODIUM_INCLUDE_PATH=/usr/local/opt/libsodium/include
macx:SODIUM_LIB_PATH=/usr/local/opt/libsodium/lib
windows:QRENCODE_INCLUDE_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/include
windows:QRENCODE_LIB_PATH=/home/build/Documents/mxe/usr/i686-w64-mingw32.static/libc

# Dependency library locations can be customized with:
#    BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
#    BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively

OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build

# fixes an issue with boost 1.66 and the number of template parameters of basic_socket_acceptor
#DEFINES += BOOST_ASIO_ENABLE_OLD_SERVICES
# TODO: Move to the new standard of boost as current code is deprecated

# use: qmake "RELEASE=1"
contains(RELEASE, 1) {
    # Mac: compile for maximum compatibility (10.12, 32-bit)
    macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.13 -arch x86_64 -Wno-nullability-completeness -Wno-unused-command-line-argument

    !windows:!macx {
        # Linux: static link
        LIBS += -Wl,-Bstatic
    }
}

!win32 {
# for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection
QMAKE_CXXFLAGS *= -fstack-protector-all
QMAKE_LFLAGS *= -fstack-protector-all
# We need to exclude this for Windows cross compile with MinGW 4.2.x, as it will result in a non-working executable!
# This can be enabled for Windows, when we switch to MinGW >= 4.4.x.
}
# for extra security (see: https://wiki.debian.org/Hardening)
QMAKE_CXXFLAGS *= -D_FORTIFY_SOURCE=2
!clang* {
    QMAKE_CXXFLAGS *= -Wl,-z,relro -Wl,-z,now
}
# for extra security on Windows: enable ASLR and DEP via GCC linker flags
compiler_info = $$system("$${QMAKE_CXX} -dumpmachine")
win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat
!contains(compiler_info, .*x86_64.*) {
    win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static
}
#win32:QMAKE_LFLAGS += -static-libgcc -static-libstdc++

# use: qmake "USE_QRCODE=1"
# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support
contains(USE_QRCODE, 1) {
    message(Building with QRCode support)
    DEFINES += USE_QRCODE
    LIBS += -lqrencode
    windows:LIBS += -lpthread
}

# use: qmake "USE_UPNP=1" ( enabled by default; default)
#  or: qmake "USE_UPNP=0" (disabled by default)
#  or: qmake "USE_UPNP=-" (not supported)
# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support
contains(USE_UPNP, -) {
    message(Building without UPNP support)
} else {
    message(Building with UPNP support)
    count(USE_UPNP, 0) {
        USE_UPNP=1
    }
    DEFINES += USE_UPNP=$$USE_UPNP STATICLIB
    INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH
    LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc
    win32:LIBS += -liphlpapi
}

# use: qmake "USE_DBUS=1" or qmake "USE_DBUS=0"
linux:count(USE_DBUS, 0) {
    USE_DBUS=1
}
contains(USE_DBUS, 1) {
    message(Building with DBUS (Freedesktop notifications) support)
    DEFINES += USE_DBUS
    QT += dbus
}

contains(BITCOIN_NEED_QT_PLUGINS, 1) {
    DEFINES += BITCOIN_NEED_QT_PLUGINS
    QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
}

message("Using lmdb as the blockchain database")
!contains(NEBLIO_CONFIG, VL32) {
    contains(compiler_info, .*x86_64.*) | contains(NEBLIO_CONFIG, VL64) {
        message("Compiling LMDB for a 64-bit system")
        LMDB_32_BIT = false
    } else {
        DEFINES += MDB_VL32
        message("Compiling LMDB for a 32-bit system")
        LMDB_32_BIT = true
    }
} else {
    DEFINES += MDB_VL32
    message("Compiling LMDB for a 32-bit system")
    LMDB_32_BIT = true
}
#    LIBS += -llmdb

INCLUDEPATH += $$PWD/liblmdb
macx: INCLUDEPATH += /usr/local/opt/berkeley-db@4/include /usr/local/opt/boost/include /usr/local/opt/openssl@1.1/include
SOURCES += txdb-lmdb.cpp
#    SOURCES += $$PWD/liblmdb/mdb.c $$PWD/liblmdb/midl.c

#NEBLIO_CONFIG += LMDB_TESTS

!win32 {
    LIBS += $$PWD/liblmdb/liblmdb.a
    # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
    #genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" liblmdb.a
    genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC $(MAKE) liblmdb.a
    isEqual(LMDB_32_BIT, true) {
        genlmdb.commands += "CFLAGS=-DMDB_VL32 CXXFLAGS=-DMDB_VL32"
    }

#        contains( NEBLIO_CONFIG, LMDB_TESTS ) {
#            genlmdb.commands += ./arena_test && ./cache_test && ./env_test && ./table_test && ./write_batch_test && ./coding_test && ./db_bench && ./fault_injection_test && ./issue178_test && ./autocompact_test && ./dbformat_test && ./filename_test && ./issue200_test && ./log_test && ./bloom_test && ./corruption_test && ./db_test && ./filter_block_test && ./recovery_test && ./version_edit_test && ./crc32c_test && ./hash_test && ./memenv_test && ./skiplist_test && ./version_set_test && ./c_test && ./env_posix_test
#        }
} else {
#    SOURCES += $$PWD/liblmdb/mdb.c $$PWD/liblmdb/midl.c
    # make an educated guess about what the ranlib command is called
    isEmpty(QMAKE_RANLIB) {
        QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
    }
    LIBS += -lshlwapi
    LIBS += $$PWD/liblmdb/liblmdb.a
    genlmdb.commands = cd $$PWD/liblmdb && CC=$$QMAKE_CC $(MAKE) clean && CC=$$QMAKE_CC $(MAKE) liblmdb.a
    isEqual(LMDB_32_BIT, true) {
        genlmdb.commands += "CFLAGS=-DMDB_VL32 CXXFLAGS=-DMDB_VL32"
    }
    genlmdb.commands += "&& $$QMAKE_RANLIB -t $$PWD/liblmdb/liblmdb.a"
}
genlmdb.target = $$PWD/liblmdb/liblmdb.a
genlmdb.depends = FORCE
PRE_TARGETDEPS += $$PWD/liblmdb/liblmdb.a
QMAKE_EXTRA_TARGETS += genlmdb
# Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
QMAKE_CLEAN += $$PWD/liblmdb/liblmdb.a; cd $$PWD/liblmdb ; $(MAKE) clean

# regenerate build.h
!windows|contains(USE_BUILD_INFO, 1) {
    genbuild.depends = FORCE
    genbuild.commands = cd $$PWD; /bin/sh ../share/genbuild.sh $$OUT_PWD/build/build.h
    genbuild.target = $$OUT_PWD/build/build.h
    PRE_TARGETDEPS += $$OUT_PWD/build/build.h
    QMAKE_EXTRA_TARGETS += genbuild
    DEFINES += HAVE_BUILD_INFO
}

contains(USE_O3, 1) {
    message(Building O3 optimization flag)
    QMAKE_CXXFLAGS_RELEASE -= -O2
    QMAKE_CFLAGS_RELEASE -= -O2
    QMAKE_CXXFLAGS += -O3
    QMAKE_CFLAGS += -O3
}

*-g++-32 {
    message("32 platform, adding -msse2 flag")

    QMAKE_CXXFLAGS += -msse2
    QMAKE_CFLAGS += -msse2
}

QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector

CODECFORTR = UTF-8

# for lrelease/lupdate
# also add new translations to qt/bitcoin.qrc under translations/
TRANSLATIONS = $$files(qt/locale/bitcoin_*.ts)

isEmpty(QMAKE_LRELEASE) {
    QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
}
isEmpty(QM_DIR):QM_DIR = $$PWD/qt/locale
# automatically build translations, so they can be included in resource file
TSQM.name = lrelease ${QMAKE_FILE_IN}
TSQM.input = TRANSLATIONS
TSQM.output = $$QM_DIR/${QMAKE_FILE_BASE}.qm
TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
TSQM.CONFIG = no_link
QMAKE_EXTRA_COMPILERS += TSQM

# "Other files" to show in Qt Creator
OTHER_FILES += \
    doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc

# platform specific defaults, if not overridden on command line
isEmpty(BOOST_LIB_SUFFIX) {
    macx:BOOST_LIB_SUFFIX = -mt
    windows:BOOST_LIB_SUFFIX = -mt
}

isEmpty(BOOST_THREAD_LIB_SUFFIX) {
    win32:BOOST_THREAD_LIB_SUFFIX = _win32$$BOOST_LIB_SUFFIX
    else:BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX
}

windows:DEFINES += WIN32

windows:!contains(MINGW_THREAD_BUGFIX, 0) {
    # At least qmake's win32-g++-cross profile is missing the -lmingwthrd
    # thread-safety flag. GCC has -mthreads to enable this, but it doesn't
    # work with static linking. -lmingwthrd must come BEFORE -lmingw, so
    # it is prepended to QMAKE_LIBS_QT_ENTRY.
    # It can be turned off with MINGW_THREAD_BUGFIX=0, just in case it causes
    # any problems on some untested qmake profile now or in the future.
    DEFINES += _MT BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
    QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY
}

macx:HEADERS += qt/macdockiconhandler.h qt/macnotificationhandler.h
macx:OBJECTIVE_SOURCES += qt/macdockiconhandler.mm qt/macnotificationhandler.mm
macx:LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0
macx:TARGET = "neblio-Qt"
macx:QMAKE_CFLAGS_THREAD += -pthread
macx:QMAKE_LFLAGS_THREAD += -pthread
macx:QMAKE_CXXFLAGS_THREAD += -pthread

# do not include resources while testing
!contains( NEBLIO_TEST, TRUE ) {
    macx:ICON = qt/res/icons/bitcoin.icns
    windows:RC_FILE = qt/res/bitcoin-qt.rc
}

# Set libraries and includes at end, to use platform-defined defaults if not overridden
INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH $$SODIUM_INCLUDE_PATH
LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,) $$join(SODIUM_LIB_PATH,,-L,)
macx: LIBS += $$join(CURL_LIB_PATH,,-L,)
LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
# -lgdi32 has to happen after -lcrypto (see  #681)
windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32
LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_regex$$BOOST_LIB_SUFFIX -lboost_iostreams$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -lboost_chrono$$BOOST_LIB_SUFFIX -lboost_atomic$$BOOST_LIB_SUFFIX -lz
LIBS += -lsodium
windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX
macx: LIBS += -lcurl

# For Fedora
unix:INCLUDEPATH += /usr/include/libdb4/
unix:LIBS        += -L/usr/lib64/libdb4/

!macx {
    PKG_CONFIG_ENV_VAR = $$(PKG_CONFIG_PATH)
    !isEmpty(PKG_CONFIG_ENV_VAR) {
        PKG_CONFIG_PATH = $$(PKG_CONFIG_PATH)
    }
    isEmpty(PKG_CONFIG_PATH_ENV_VAR) {
        message("PKGCONFIG enviroment variable is not set")
        pkgConfPrefix = ""
    } else {
        message("PKGCONFIG enviroment variable is found to be set to: \"$${PKG_CONFIG_ENV_VAR}\"; it will be used for pkg-config")
        pkgConfPrefix = "PKGCONFIG=$${PKG_CONFIG_PATH}"
    }

    !isEmpty(PKG_CONFIG_PATH) {
        message("Setting PKG_CONFIG_PATH to $${PKG_CONFIG_PATH}")
    }

        pkgconf_exec = "$${pkgConfPrefix} $${CROSS_COMPILE}pkg-config"

    QMAKE_CFLAGS += $$system("$${pkgconf_exec} libcurl --cflags")
    QMAKE_CXXFLAGS += $$system("$${pkgconf_exec} libcurl --cflags")

    # static when release
    contains(RELEASE, 1) {
        libcurlPkgconfCmd = "$${pkgconf_exec} libcurl --libs --static"
    } else {
        libcurlPkgconfCmd = "$${pkgconf_exec} libcurl --libs"
    }
    # the testing whether system() has a zero exit code with the third parameter of system() doesn't work on all Qt versions
    libcURL_LIBS = $$system($$libcurlPkgconfCmd)
    # OpenSSL linking is not necessary as it comes with curl
    # openssl_LIBS = $$system($$opensslPkgconfCmd)
    LIBS += $$libcURL_LIBS $$openssl_LIBS
}

contains(RELEASE, 1) {
    !windows:!macx {
        # Linux: turn dynamic linking back on for c/c++ runtime libraries
        LIBS += -Wl,-Bdynamic
    }
}

!windows:!macx {
    DEFINES += LINUX
    LIBS += -lrt -ldl
}