New: use ccache by default if installed

New: use ccache by default if installed

Signed-off-by: Miroslav Safr <9a7f4c1b028d2e5cbe928831dd7462b3c12b87c2@gmail.com>

#this is small fix for releasing
#win32:CONFIG += release
#win32:CONFIG -= debug
CONFIG(debug, debug|release):message("DEBUG")
CONFIG(release, debug|release):message("RELEASE")

#appver, win/lin version system
APP_FULL_VERSION_TAG=NA
APP_SHORT_VERSION_TAG=NA
unix {
  exists( /usr/bin/appver ) {
    #APP_BUILD_DATE=$$system(/usr/bin/appver | grep APP_BUILD_DATE | awk -F= '{print $2}')
    #APP_FULL_VERSION_TAG=$$system(/usr/bin/appver | grep APP_FULL_VERSION_TAG | awk -F= '{print $2}')
    #APP_SHORT_VERSION_TAG=$$system(/usr/bin/appver | grep APP_SHORT_VERSION_TAG | awk -F= '{print $2}')
    system(/usr/bin/appver > ./appver.pri)
    include(./appver.pri)
  } else {
    APP_BUILD_DATE=$$system(date +'\"%Y%m%d_%H%M\"')
    APP_FULL_VERSION_TAG=$$system(git describe --tags  --dirty=* 2> /dev/null)
    APP_SHORT_VERSION_TAG=$$system(git describe --tags --abbrev=0 2> /dev/null)
  }
}
win32 {
  APP_BUILD_DATE=$$system(echo \"%date:~9,4%%date:~6,2%%date:~3,2%_%time:~0,2%%time:~3,2%\")
  exists("C:\\progs\\Git\\bin\\sh.exe") {
      APP_FULL_VERSION_TAG=$$system("C:\\progs\\Git\\bin\\sh.exe" -c \"/bin/git describe --tags  --dirty=* 2> /dev/null  \")
      APP_SHORT_VERSION_TAG=$$system("C:\\progs\\Git\\bin\\sh.exe" -c \"/bin/git describe --tags --abbrev=0 2> /dev/null  \")
   }
}
message("APP_BUILD_DATE = " $$APP_BUILD_DATE)
DEFINES += APP_DATE=\\\"$$APP_BUILD_DATE\\\"
message("APP_FULL_VERSION_TAG = " $$APP_FULL_VERSION_TAG)
DEFINES += APP_FULL_VERSION_TAG=\\\"$$APP_FULL_VERSION_TAG\\\"
DEFINES += APP_SHORT_VERSION_TAG=\\\"$$APP_SHORT_VERSION_TAG\\\"
message("APP_SHORT_VERSION_TAG = " $$APP_SHORT_VERSION_TAG)

#QT info
message("QT_VERSION = " $${QT_VERSION})
DEFINES += QMAKE_QMAKE=\\\"$${QMAKE_QMAKE}\\\"
message("QMAKE_QMAKE = " $${QMAKE_QMAKE})
DEFINES += QMAKE_QT_DLL=\\\"$${QMAKE_QT_DLL}\\\"
message("QMAKE_QT_DLL = " $${QMAKE_QT_DLL})

DEFINES += APPLICATION_NAME=\\\"${QMAKE_TARGET}\\\"

QT          = core gui xml svg

# All generated files goes to the same directory
win32:INSTALL_ROOT= /progs/semaphored
#to enable c++11 features
#CONFIG += c++11
#QMAKE_CXXFLAGS += -std=c++0x

# To use compiler cache by default if installed
exists( /usr/bin/ccache ) {
    message("Using compiler cache")
    QMAKE_CC = ccache gcc
    QMAKE_CXX = ccache g++
}


Fix zlib setup on Windows

Fix zlib setup on Windows

################################################################################
#
# (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 += -lz

#
# [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 {
    AIRMAPD_PATH    = $$PWD/libs/airmapd
    AIRMAP_QT_PATH  = Qt.$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}
    message('Looking for Airmap in folder "$${AIRMAPD_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($${AIRMAPD_PATH}/linux/$$AIRMAP_QT_PATH) {
            message("Including support for AirMap for Linux")
            LIBS += -L$${AIRMAPD_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        }
    } else {
        message("Skipping support for Airmap (unsupported platform)")
    }
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        INCLUDEPATH += \
            $${AIRMAPD_PATH}/include
    }
}

################################################################################
#
# (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
Windows {
    INCLUDEPATH +=  $$SOURCE_DIR/libs/zlib/windows/include
    LIBS += -L$$SOURCE_DIR/libs/zlib/windows/lib
}
LIBS += -lz

#
# [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 {
    AIRMAPD_PATH    = $$PWD/libs/airmapd
    AIRMAP_QT_PATH  = Qt.$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}
    message('Looking for Airmap in folder "$${AIRMAPD_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($${AIRMAPD_PATH}/linux/$$AIRMAP_QT_PATH) {
            message("Including support for AirMap for Linux")
            LIBS += -L$${AIRMAPD_PATH}/linux/$$AIRMAP_QT_PATH -lairmap-qt
            DEFINES += QGC_AIRMAP_ENABLED
        }
    } else {
        message("Skipping support for Airmap (unsupported platform)")
    }
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        INCLUDEPATH += \
            $${AIRMAPD_PATH}/include
    }
}


Try to fix maemo6 builds

Try to fix maemo6 builds

######################################################################
#
# Mobility API project - common QMake settings
#
######################################################################

CONFIG(debug, debug|release) {
    WAS_IN_DEBUG=debug
} else {
    WAS_IN_DEBUG=release
}

include(staticconfig.pri)

symbian:contains(symbian_symbols_unfrozen,1) {
    #see configure.bat for details
    MMP_RULES+="EXPORTUNFROZEN"
}

mac {
    contains(QT_CONFIG, qt_framework):contains(TEMPLATE, lib) {
        #MacOSX always builds debug and release libs when using mac framework
        CONFIG+=$$WAS_IN_DEBUG
        CONFIG += debug_and_release build_all
    } else {
        !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) {
            CONFIG -= debug_and_release debug release
            contains(QT_CONFIG,debug): CONFIG+=debug
            contains(QT_CONFIG,release): CONFIG+=release
        }
    }
}

#In Windows we want to build libraries in debug and release mode if the user
#didn't select a version - if Qt is build in debug_and_release
#this avoids problems for third party as qmake build debug by default
#If mobility selected debug_and_release but Qt only supports
#one version but not the other we silently disable the impossible combination
win32:contains(CONFIG_WIN32,build_all) {
    contains(QT_CONFIG,debug):contains(QT_CONFIG,release) {
        contains(TEMPLATE,.*lib) {
            CONFIG += $$WAS_IN_DEBUG
            CONFIG += debug_and_release build_all
        }
    } else {
        CONFIG -= debug_and_release debug release
        contains(QT_CONFIG,debug): CONFIG+=debug
        contains(QT_CONFIG,release): CONFIG+=release
    }
}

# Helper function.  This should move to a .prf file
defineReplace(mobilityDeployFilename) {
   unset(MOBILITY_DEPLOY_NAME)
   MOBILITY_DEPLOY_NAME = $$1
   CONFIG(debug, debug|release): {
      mac:RET = $$member(MOBILITY_DEPLOY_NAME, 0)_debug
      else:win32:RET = $$member(MOBILITY_DEPLOY_NAME, 0)d
   }
   isEmpty(RET):RET = $$MOBILITY_DEPLOY_NAME
   return($$RET)
}

# Make sure this goes everywhere we need it
symbian: load(data_caging_paths)

# Figure out the root of where stuff should go (this could be done via configure)
OUTPUT_DIR = $$QT_MOBILITY_BUILD_TREE
SOURCE_DIR = $$PWD

CONFIG(debug, debug|release) {
    SUBDIRPART=Debug
} else {
    SUBDIRPART=Release
}

contains(QT_CONFIG, reduce_exports):CONFIG+=hide_symbols

#export more symbols if we build the unit tests
contains(build_unit_tests, yes) {
    DEFINES+=QTM_BUILD_UNITTESTS
} else {
    contains(build_public_unit_tests,yes):DEFINES+=QTM_BUILD_PUBLIC_UNITTESTS
}

#test whether we have a unit test
!testcase:!testhelper {
    OBJECTS_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET
    !plugin {
        contains(TEMPLATE,.*lib) {
            DESTDIR = $$OUTPUT_DIR/lib
            symbian:defFilePath=../s60installs
            symbian:DEF_FILE=../s60installs
            VERSION = 1.2.0
        } else {
            DESTDIR = $$OUTPUT_DIR/bin
        }
    } else {
        testplugin {
            DESTDIR = $$OUTPUT_DIR/build/tests/bin/plugins/$$PLUGIN_TYPE
        } else {
            #check that plugin_type is set or warn otherwise
            isEmpty(PLUGIN_TYPE) {
                message(PLUGIN_TYPE not specified - install rule may not work)
            } else {
                target.path=$${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE}
                INSTALLS += target
            }
        }
    }

    MOC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/moc
    RCC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/rcc
    UI_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/ui
    QMAKE_RPATHDIR += $$QT_MOBILITY_LIB
} else {
    # Unit test code (no plugins! test plugins are just normal plugins installed elsewhere)
    testcase:QT *= testlib
    CONFIG += console
    CONFIG -= app_bundle
    OBJECTS_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET
    DESTDIR = $$OUTPUT_DIR/build/tests/bin
    MOC_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/moc
    RCC_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/rcc
    UI_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/ui
    QMAKE_RPATHDIR += $$OUTPUT_DIR/lib
}

contains(TEMPLATE,.*lib):DEFINES += QT_SHARED

maemo6|meego {
    maemo6:DEFINES+= Q_WS_MAEMO_6
    meego:DEFINES+= Q_WS_MEEGO
    contains(TEMPLATE,.*app.*): QMAKE_LIB_FLAGS+= -Wl,-rpath-link $$[QT_INSTALL_LIBS]
    QMAKE_LIB_FLAGS+= -Wl,-rpath-link $$[QT_INSTALL_LIBS]
    QMAKE_RPATHDIR += $$[QT_INSTALL_LIBS]
}
maemo5 {
    DEFINES+= Q_WS_MAEMO_5
}
meego {
    DEFINES+= Q_WS_MEEGO
}

wince* {
    ### Bearer Management
    BEARERLIB.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtBearer).dll
    BEARERLIB.path = .
    DEPLOYMENT += BEARERLIB

    ### Contacts
    # Main library
    CONTACTS_DEPLOYMENT.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtContacts).dll
    CONTACTS_DEPLOYMENT.path = /Windows

    # Plugins
    CONTACTS_PLUGINS_DEPLOYMENT.sources = $$OUTPUT_DIR/plugins/contacts/*.dll
    CONTACTS_PLUGINS_DEPLOYMENT.path = plugins/contacts
    DEPLOYMENT += CONTACTS_DEPLOYMENT CONTACTS_PLUGINS_DEPLOYMENT

    ### Service Framework
    SFW_DEPLOYMENT.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtServiceFramework).dll
    SFW_DEPLOYMENT.path = .
    DEPLOYMENT += SFW_DEPLOYMENT

    ### Location
    LOCATION.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtLocation).dll
    LOCATION.path = .
    DEPLOYMENT += LOCATION

    ### Landmarks
    LANDMARKS.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtLandmarks).dll
    LANDMARKS.path = .
    DEPLOYMENT += LANDMARKS
}

symbian {
    #For some reason the default include path doesn't include MOC_DIR on symbian
    INCLUDEPATH += $$MOC_DIR

    #This is supposed to be defined in symbian_os.hrh
    #DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
}

# Add the output dirs to the front of the link path.
# They must be at the front in case some previous Mobility version is already
# installed on the system.
mac:contains(QT_CONFIG,qt_framework) {
    #add framework option
    ##contains(TEMPLATE, app)|contains(CONFIG,plugin):LIBS+=-F$$OUTPUT_DIR/lib
    LIBS = -F$$OUTPUT_DIR/lib $$LIBS
}
else:maemo6 {
    # We must avoid the usage of Qt's prl files, because it forces -L/usr/lib
    # to the front of the link line, which may break if there is already some
    # mobility installed under /usr/lib.
    #
    # In theory, this problem may occur on any platform, but we only turn off
    # the usage of prl files for Harmattan to reduce the risk of unanticipated
    # side effects for other platforms.
    CONFIG -= link_prl

    # Furthermore, /usr/lib is _also_ forced to the front of the link line in
    # qt.prf (which sets QMAKE_LIBDIR), so we fix that by loading it early and
    # undoing it.
    load(qt)
    LIBS = -L$$OUTPUT_DIR -L$$QMAKE_LIBDIR $$LIBS
    QMAKE_LIBDIR =
}
else {
    LIBS = -L$$OUTPUT_DIR/lib $$LIBS
}

linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

DEPENDPATH += . $$SOURCE_DIR
INCLUDEPATH += $$SOURCE_DIR/src/global

!symbian:!wince*:DEFINES += QTM_PLUGIN_PATH=\\\"$$replace(QT_MOBILITY_PLUGINS, \\\\, /)\\\"

######################################################################
#
# Mobility API project - common QMake settings
#
######################################################################

CONFIG(debug, debug|release) {
    WAS_IN_DEBUG=debug
} else {
    WAS_IN_DEBUG=release
}

include(staticconfig.pri)

symbian:contains(symbian_symbols_unfrozen,1) {
    #see configure.bat for details
    MMP_RULES+="EXPORTUNFROZEN"
}

mac {
    contains(QT_CONFIG, qt_framework):contains(TEMPLATE, lib) {
        #MacOSX always builds debug and release libs when using mac framework
        CONFIG+=$$WAS_IN_DEBUG
        CONFIG += debug_and_release build_all
    } else {
        !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) {
            CONFIG -= debug_and_release debug release
            contains(QT_CONFIG,debug): CONFIG+=debug
            contains(QT_CONFIG,release): CONFIG+=release
        }
    }
}

#In Windows we want to build libraries in debug and release mode if the user
#didn't select a version - if Qt is build in debug_and_release
#this avoids problems for third party as qmake build debug by default
#If mobility selected debug_and_release but Qt only supports
#one version but not the other we silently disable the impossible combination
win32:contains(CONFIG_WIN32,build_all) {
    contains(QT_CONFIG,debug):contains(QT_CONFIG,release) {
        contains(TEMPLATE,.*lib) {
            CONFIG += $$WAS_IN_DEBUG
            CONFIG += debug_and_release build_all
        }
    } else {
        CONFIG -= debug_and_release debug release
        contains(QT_CONFIG,debug): CONFIG+=debug
        contains(QT_CONFIG,release): CONFIG+=release
    }
}

# Helper function.  This should move to a .prf file
defineReplace(mobilityDeployFilename) {
   unset(MOBILITY_DEPLOY_NAME)
   MOBILITY_DEPLOY_NAME = $$1
   CONFIG(debug, debug|release): {
      mac:RET = $$member(MOBILITY_DEPLOY_NAME, 0)_debug
      else:win32:RET = $$member(MOBILITY_DEPLOY_NAME, 0)d
   }
   isEmpty(RET):RET = $$MOBILITY_DEPLOY_NAME
   return($$RET)
}

# Make sure this goes everywhere we need it
symbian: load(data_caging_paths)

# Figure out the root of where stuff should go (this could be done via configure)
OUTPUT_DIR = $$QT_MOBILITY_BUILD_TREE
SOURCE_DIR = $$PWD

CONFIG(debug, debug|release) {
    SUBDIRPART=Debug
} else {
    SUBDIRPART=Release
}

contains(QT_CONFIG, reduce_exports):CONFIG+=hide_symbols

#export more symbols if we build the unit tests
contains(build_unit_tests, yes) {
    DEFINES+=QTM_BUILD_UNITTESTS
} else {
    contains(build_public_unit_tests,yes):DEFINES+=QTM_BUILD_PUBLIC_UNITTESTS
}

#test whether we have a unit test
!testcase:!testhelper {
    OBJECTS_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET
    !plugin {
        contains(TEMPLATE,.*lib) {
            DESTDIR = $$OUTPUT_DIR/lib
            symbian:defFilePath=../s60installs
            symbian:DEF_FILE=../s60installs
            VERSION = 1.2.0
        } else {
            DESTDIR = $$OUTPUT_DIR/bin
        }
    } else {
        testplugin {
            DESTDIR = $$OUTPUT_DIR/build/tests/bin/plugins/$$PLUGIN_TYPE
        } else {
            #check that plugin_type is set or warn otherwise
            isEmpty(PLUGIN_TYPE) {
                message(PLUGIN_TYPE not specified - install rule may not work)
            } else {
                target.path=$${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE}
                INSTALLS += target
            }
        }
    }

    MOC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/moc
    RCC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/rcc
    UI_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/ui
    QMAKE_RPATHDIR += $$QT_MOBILITY_LIB
} else {
    # Unit test code (no plugins! test plugins are just normal plugins installed elsewhere)
    testcase:QT *= testlib
    CONFIG += console
    CONFIG -= app_bundle
    OBJECTS_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET
    DESTDIR = $$OUTPUT_DIR/build/tests/bin
    MOC_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/moc
    RCC_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/rcc
    UI_DIR = $$OUTPUT_DIR/build/tests/$$SUBDIRPART/$$TARGET/ui
    QMAKE_RPATHDIR += $$OUTPUT_DIR/lib
}

contains(TEMPLATE,.*lib):DEFINES += QT_SHARED

maemo6|meego {
    maemo6:DEFINES+= Q_WS_MAEMO_6
    meego:DEFINES+= Q_WS_MEEGO
    contains(TEMPLATE,.*app.*): QMAKE_LIB_FLAGS+= -Wl,-rpath-link $$[QT_INSTALL_LIBS]
    QMAKE_LIB_FLAGS+= -Wl,-rpath-link $$[QT_INSTALL_LIBS]
    QMAKE_RPATHDIR += $$[QT_INSTALL_LIBS]
}
maemo5 {
    DEFINES+= Q_WS_MAEMO_5
}
meego {
    DEFINES+= Q_WS_MEEGO
}

wince* {
    ### Bearer Management
    BEARERLIB.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtBearer).dll
    BEARERLIB.path = .
    DEPLOYMENT += BEARERLIB

    ### Contacts
    # Main library
    CONTACTS_DEPLOYMENT.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtContacts).dll
    CONTACTS_DEPLOYMENT.path = /Windows

    # Plugins
    CONTACTS_PLUGINS_DEPLOYMENT.sources = $$OUTPUT_DIR/plugins/contacts/*.dll
    CONTACTS_PLUGINS_DEPLOYMENT.path = plugins/contacts
    DEPLOYMENT += CONTACTS_DEPLOYMENT CONTACTS_PLUGINS_DEPLOYMENT

    ### Service Framework
    SFW_DEPLOYMENT.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtServiceFramework).dll
    SFW_DEPLOYMENT.path = .
    DEPLOYMENT += SFW_DEPLOYMENT

    ### Location
    LOCATION.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtLocation).dll
    LOCATION.path = .
    DEPLOYMENT += LOCATION

    ### Landmarks
    LANDMARKS.sources = $$OUTPUT_DIR/lib/$$mobilityDeployFilename(QtLandmarks).dll
    LANDMARKS.path = .
    DEPLOYMENT += LANDMARKS
}

symbian {
    #For some reason the default include path doesn't include MOC_DIR on symbian
    INCLUDEPATH += $$MOC_DIR

    #This is supposed to be defined in symbian_os.hrh
    #DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
}

# Add the output dirs to the link path too
mac:contains(QT_CONFIG,qt_framework) {
    #add framework option
    ##contains(TEMPLATE, app)|contains(CONFIG,plugin):LIBS+=-F$$OUTPUT_DIR/lib
    LIBS+=-F$$OUTPUT_DIR/lib
}
LIBS += -L$$OUTPUT_DIR/lib

linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

DEPENDPATH += . $$SOURCE_DIR
INCLUDEPATH += $$SOURCE_DIR/src/global

!symbian:!wince*:DEFINES += QTM_PLUGIN_PATH=\\\"$$replace(QT_MOBILITY_PLUGINS, \\\\, /)\\\"


Stop cluttering by build artifacts

Stop cluttering by build artifacts

PDIR = $${_PRO_FILE_PWD_}/..

# Options
CONFIG += use_ssl
Release {
	CONFIG += use_breakpad
}

# Share build artifacts between projects without cluttering
CONFIG(debug, debug|release) {
	DESTDIR = build/debug
}
CONFIG(release, debug|release) {
	DESTDIR = build/release
}
OBJECTS_DIR = $$DESTDIR/obj
MOC_DIR     = $$DESTDIR/moc
RCC_DIR     = $$DESTDIR/qrc
UI_DIR      = $$DESTDIR/ui

# TODO: move to gui
QT += multimedia widgets multimediawidgets

# Travis settings
@
T = $$(TRAVIS)
!isEmpty(T) {
	CONFIG -= use_breakpad use_qscintilla
}
@

# Global
APP_VERSION = \\\"4.6.0\\\"

# General
TEMPLATE = app
DEPENDPATH += . .. $${PDIR}/languages $${PDIR}/src $${PDIR}/vendor
INCLUDEPATH += . .. $${PDIR}/src $${PDIR}/vendor
DEFINES += VERSION=$$APP_VERSION
QT += core network xml sql script

# Windows specials
win32 {
	QT += winextras
}

# Additionnal
CONFIG += plugin c++11
RESOURCES += $${PDIR}/resources.qrc
RC_FILE = ../icon.rc
CODECFORTR = UTF-8
TRANSLATIONS += $${PDIR}/languages/English.ts $${PDIR}/languages/Français.ts $${PDIR}/languages/Russian.ts

# Target WinXP
Release:win32 {
	QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
	QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
	DEFINES += _ATL_XP_TARGETING
	QMAKE_CFLAGS += /D _USING_V110_SDK71
	QMAKE_CXXFLAGS += /D _USING_V110_SDK71
	LIBS *= -L"%ProgramFiles(x86)%/Microsoft SDKs/Windows/7.1A/Lib"
	INCLUDEPATH += "%ProgramFiles(x86)%/Microsoft SDKs/Windows/7.1A/Include"
}

# SSL
use_ssl {
	win32 {
		LIBS += -L"C:/bin/OpenSSL-Win32/lib" -llibeay32
		INCLUDEPATH += C:/bin/OpenSSL-Win32/include
	}
	unix {
		PKGCONFIG += openssl
	}
}

# Google-Breakpad
use_breakpad {
	DEFINES += USE_BREAKPAD=1
	win32 {
		QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG
		QMAKE_CFLAGS_RELEASE = -O2 -MD -zi
		BREAKPAD = D:/bin/google-breakpad
		Debug:LIBS   += $${BREAKPAD}/src/client/windows/Debug/lib/common.lib \
						$${BREAKPAD}/src/client/windows/Debug/lib/crash_generation_client.lib \
						$${BREAKPAD}/src/client/windows/Debug/lib/exception_handler.lib
		Release:LIBS += $${BREAKPAD}/src/client/windows/Release/lib/common.lib \
						$${BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib \
						$${BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib
	}
	unix {
		QMAKE_CXXFLAGS += -fpermissive
		BREAKPAD = ~/Programmation/google-breakpad
		LIBS += $${BREAKPAD}/src/client/linux/libbreakpad_client.a
	}
	INCLUDEPATH += $${BREAKPAD}/src
}

OTHER_FILES += \
	$${PDIR}/Grabber.pri \
	$${PDIR}/icon.rc \
	$${PDIR}/.gitignore

DISTFILES += \
	$${PDIR}/README.md \
	$${PDIR}/LICENSE \
	$${PDIR}/NOTICE

PDIR = $${_PRO_FILE_PWD_}/..

# Options
CONFIG += use_ssl
Release {
	CONFIG += use_breakpad
}

# TODO: move to gui
QT += multimedia widgets multimediawidgets

# Travis settings
@
T = $$(TRAVIS)
!isEmpty(T) {
	CONFIG -= use_breakpad use_qscintilla
}
@

# Global
APP_VERSION = \\\"4.6.0\\\"

# General
TEMPLATE = app
DEPENDPATH += . .. $${PDIR}/languages $${PDIR}/src $${PDIR}/vendor
INCLUDEPATH += . .. $${PDIR}/src $${PDIR}/vendor
DEFINES += VERSION=$$APP_VERSION
QT += core network xml sql script

# Windows specials
win32 {
	QT += winextras
}

# Additionnal
CONFIG += plugin c++11
RESOURCES += $${PDIR}/resources.qrc
RC_FILE = ../icon.rc
CODECFORTR = UTF-8
TRANSLATIONS += $${PDIR}/languages/English.ts $${PDIR}/languages/Français.ts $${PDIR}/languages/Russian.ts

# Target WinXP
Release:win32 {
	QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
	QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
	DEFINES += _ATL_XP_TARGETING
	QMAKE_CFLAGS += /D _USING_V110_SDK71
	QMAKE_CXXFLAGS += /D _USING_V110_SDK71
	LIBS *= -L"%ProgramFiles(x86)%/Microsoft SDKs/Windows/7.1A/Lib"
	INCLUDEPATH += "%ProgramFiles(x86)%/Microsoft SDKs/Windows/7.1A/Include"
}

# SSL
use_ssl {
	win32 {
		LIBS += -L"C:/bin/OpenSSL-Win32/lib" -llibeay32
		INCLUDEPATH += C:/bin/OpenSSL-Win32/include
	}
	unix {
		PKGCONFIG += openssl
	}
}

# Google-Breakpad
use_breakpad {
	DEFINES += USE_BREAKPAD=1
	win32 {
		QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG
		QMAKE_CFLAGS_RELEASE = -O2 -MD -zi
		BREAKPAD = D:/bin/google-breakpad
		Debug:LIBS   += $${BREAKPAD}/src/client/windows/Debug/lib/common.lib \
						$${BREAKPAD}/src/client/windows/Debug/lib/crash_generation_client.lib \
						$${BREAKPAD}/src/client/windows/Debug/lib/exception_handler.lib
		Release:LIBS += $${BREAKPAD}/src/client/windows/Release/lib/common.lib \
						$${BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib \
						$${BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib
	}
	unix {
		QMAKE_CXXFLAGS += -fpermissive
		BREAKPAD = ~/Programmation/google-breakpad
		LIBS += $${BREAKPAD}/src/client/linux/libbreakpad_client.a
	}
	INCLUDEPATH += $${BREAKPAD}/src
}

OTHER_FILES += \
	$${PDIR}/Grabber.pri \
	$${PDIR}/icon.rc \
	$${PDIR}/.gitignore

DISTFILES += \
	$${PDIR}/README.md \
	$${PDIR}/LICENSE \
	$${PDIR}/NOTICE


Don't rebuild .dia files unless needed.

Don't rebuild .dia files unless needed.

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

LINE_SEP=$$escape_expand(\n\t)
GENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator
QDOC = $$[QT_INSTALL_BINS]/qdoc3
MOBILITY_DOCUMENTATION = $$QDOC $${QT_MOBILITY_SOURCE_TREE}/doc/src/qtmobility.qdocconf $$LINE_SEP \
                         cd $${QT_MOBILITY_SOURCE_TREE} && \
                          $$GENERATOR doc/html/qtmobility.qhp -o doc/qch/qtmobility.qch

# Sensors uses .dia files which must be compiled into .png for the docs
unix {
    LOGNAME=$$(LOGNAME)
    equals(LOGNAME,lramsay) {
        # Only do this on Unix when logged in as me
        MOBILITY_DOCUMENTATION=\
            @( cd "$$PWD/src";\
            for file in *.dia; do\
                destfile="images/\$$(echo "\$$file" | sed 's/dia\$$/png/')";\
                if [ "\$$file" -nt "\$$destfile" ]; then\
                    dia -e "\$$destfile" "\$$file";\
                fi;\
            done ) || true\
            $$LINE_SEP $$MOBILITY_DOCUMENTATION
    }
}

contains(unixstyle, false):MOBILITY_DOCUMENTATION = $$replace(MOBILITY_DOCUMENTATION, "/", "\\")

# Build rules
qch_docs.commands = $$MOBILITY_DOCUMENTATION

docs.depends = qch_docs

QMAKE_EXTRA_TARGETS += qch_docs docs

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

LINE_SEP=$$escape_expand(\n\t)
GENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator
QDOC = $$[QT_INSTALL_BINS]/qdoc3
MOBILITY_DOCUMENTATION = $$QDOC $${QT_MOBILITY_SOURCE_TREE}/doc/src/qtmobility.qdocconf $$LINE_SEP \
                         cd $${QT_MOBILITY_SOURCE_TREE} && \
                          $$GENERATOR doc/html/qtmobility.qhp -o doc/qch/qtmobility.qch

# Sensors uses .dia files which must be compiled into .png for the docs
unix {
    LOGNAME=$$(LOGNAME)
    equals(LOGNAME,lramsay) {
        # Only do this on Unix when logged in as me
        MOBILITY_DOCUMENTATION=\
            @( cd "$$PWD/src";\
            for file in *.dia; do\
                dia -e "images/\$$(echo "\$$file" | sed 's/dia\$$/png/')" "\$$file";\
            done ) || true\
            $$LINE_SEP $$MOBILITY_DOCUMENTATION
    }
}

contains(unixstyle, false):MOBILITY_DOCUMENTATION = $$replace(MOBILITY_DOCUMENTATION, "/", "\\")

# Build rules
qch_docs.commands = $$MOBILITY_DOCUMENTATION

docs.depends = qch_docs

QMAKE_EXTRA_TARGETS += qch_docs docs


bump version to 0.2.1

bump version to 0.2.1

# Common definitions
QDJANGO_VERSION=0.2.1

# Determine library type (shared or staticlib)
isEmpty(QDJANGO_LIBRARY_TYPE) {
    QDJANGO_LIBRARY_TYPE = shared
}

# Libraries for apps which use QDjango
QDJANGO_INCLUDEPATH = $$PWD/src/db $$PWD/src/http $$PWD/src/script
QDJANGO_DB_LIBS = -lqdjango-db
QDJANGO_HTTP_LIBS = -lqdjango-http
QDJANGO_SCRIPT_LIBS = -lqdjango-script
contains(QDJANGO_LIBRARY_TYPE,staticlib) {
    DEFINES += QDJANGO_STATIC
} else {
    # Windows needs the major library version
    win32 {
        QDJANGO_DB_LIBS = -lqdjango-db0
        QDJANGO_HTTP_LIBS = -lqdjango-http0
        QDJANGO_SCRIPT_LIBS = -lqdjango-script0
    }
    DEFINES += QDJANGO_SHARED
}

# Installation prefix and library directory
isEmpty(PREFIX) {
    unix:PREFIX=/usr/local
}
isEmpty(LIBDIR) {
    LIBDIR=lib
}

# Common definitions
QDJANGO_VERSION=0.2.0

# Determine library type (shared or staticlib)
isEmpty(QDJANGO_LIBRARY_TYPE) {
    QDJANGO_LIBRARY_TYPE = shared
}

# Libraries for apps which use QDjango
QDJANGO_INCLUDEPATH = $$PWD/src/db $$PWD/src/http $$PWD/src/script
QDJANGO_DB_LIBS = -lqdjango-db
QDJANGO_HTTP_LIBS = -lqdjango-http
QDJANGO_SCRIPT_LIBS = -lqdjango-script
contains(QDJANGO_LIBRARY_TYPE,staticlib) {
    DEFINES += QDJANGO_STATIC
} else {
    # Windows needs the major library version
    win32 {
        QDJANGO_DB_LIBS = -lqdjango-db0
        QDJANGO_HTTP_LIBS = -lqdjango-http0
        QDJANGO_SCRIPT_LIBS = -lqdjango-script0
    }
    DEFINES += QDJANGO_SHARED
}

# Installation prefix and library directory
isEmpty(PREFIX) {
    unix:PREFIX=/usr/local
}
isEmpty(LIBDIR) {
    LIBDIR=lib
}


Disabled qmake targets for TPAC1007 because of missing paths.

##
# @file
# @author Emiliano Bergamaschini <ebergamaschini@mect.it>
#
# @section LICENSE
# Copyright Mect s.r.l. 2013
#
# @brief Project file for qmake
#
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3
QMAKE_CXXFLAGS_RELEASE += -Wno-psabi
QMAKE_CXXFLAGS_DEBUG   += -Wno-psabi

TARGET = hmi
TEMPLATE = app

target.path = /local/root
INSTALLS += target

config.files = config/Crosstable.csv config/system.ini
config.files += config/Alarms.csv
config.files += config/lang_table.csv
config.path = /local/etc/sysconfig

splash.files = config/splash.png config/systool.png
splash.path = /local/etc/sysconfig/img

customstore.files = config/store1.csv
customstore.path = /local/data/customstore

customtrend.files = config/trend1.csv
customtrend.path = /local/data/customtrend

INSTALLS += config splash

INSTALLS += customstore
INSTALLS += customtrend

DEFINES+=ENABLE_STORE
DEFINES+=ENABLE_ALARMS
DEFINES+=ENABLE_TREND
DEFINES+=ENABLE_RECIPE

DEFINES += TRANSLATION

INCLUDEPATH += .\
	./config

LIBS += \
-lts \
-lqwt \
-lATCMcommon \
-lATCMutility \
-lATCMcommunication \
-lATCMplugin \
-lATCMinputdialog \
-lATCMlogger \
-lATCMstore \
-lATCMalarms \
-lATCMrecipe \
-lATCMtrend \
-lATCMsystem

# Input
HEADERS += \
        config/crosstable.h \
        style.h \
        pages.h

SOURCES += \
        config/crosstable.cpp \
        pages.cpp

RESOURCES += \
	systemicons.qrc

# pre-elabortation
check_missing_file.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/cleanmissingpage.pl $$_PRO_FILE_ $$_PRO_FILE_PWD_
check_undeclared_variable.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/check_cross_var.pl $$_PRO_FILE_PWD_
check_gotopage_bind.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/connectbutton.pl $$_PRO_FILE_PWD_

#QMAKE_EXTRA_TARGETS += check_missing_file check_undeclared_variable check_gotopage_bind
#PRE_TARGETDEPS += check_missing_file check_undeclared_variable check_gotopage_bind

# language
        update.commands = $${QT_LUPDATE_PATH}/lupdate $$_PRO_FILE_
        updates.depends = $$SOURCES $$HEADERS $$FORMS $$TRANSLATIONS
        release.commands = $${QT_LRELEASE_PATH}/lrelease $$_PRO_FILE_
        release.depends = update

        #QMAKE_EXTRA_TARGETS += update release
        #PRE_TARGETDEPS += update release

        RESOURCES += \
            languages.qrc

        OTHER_FILES += \
            languages_it.ts \
            languages_en.ts

        include(./languages.pri)

# display size
MODEL = "<width>480</width><height>272</height>"

equals(MODEL, "<width>320</width><height>240</height>") {
    DEFINES+=WIDTH=320
    DEFINES+=HEIGHT=240
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>240</width><height>320</height>") {
    DEFINES+=WIDTH=240
    DEFINES+=HEIGHT=320
    DEFINES+=ROTATION=90
}
equals(MODEL, "<width>480</width><height>272</height>") {
    DEFINES+=WIDTH=480
    DEFINES+=HEIGHT=272
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>272</width><height>480</height>") {
    DEFINES+=WIDTH=272
    DEFINES+=HEIGHT=480
    DEFINES+=ROTATION=90
}
equals(MODEL, "<width>800</width><height>480</height>") {
    DEFINES+=WIDTH=800
    DEFINES+=HEIGHT=480
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>480</width><height>800</height>") {
    DEFINES+=WIDTH=240
    DEFINES+=HEIGHT=240
    DEFINES+=ROTATION=90
}

##
# @file
# @author Emiliano Bergamaschini <ebergamaschini@mect.it>
#
# @section LICENSE
# Copyright Mect s.r.l. 2013
#
# @brief Project file for qmake
#
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O3
QMAKE_CXXFLAGS_RELEASE += -Wno-psabi
QMAKE_CXXFLAGS_DEBUG   += -Wno-psabi

TARGET = hmi
TEMPLATE = app

target.path = /local/root
INSTALLS += target

config.files = config/Crosstable.csv config/system.ini
config.files += config/Alarms.csv
config.files += config/lang_table.csv
config.path = /local/etc/sysconfig

splash.files = config/splash.png config/systool.png
splash.path = /local/etc/sysconfig/img

customstore.files = config/store1.csv
customstore.path = /local/data/customstore

customtrend.files = config/trend1.csv
customtrend.path = /local/data/customtrend

INSTALLS += config splash

INSTALLS += customstore
INSTALLS += customtrend

DEFINES+=ENABLE_STORE
DEFINES+=ENABLE_ALARMS
DEFINES+=ENABLE_TREND
DEFINES+=ENABLE_RECIPE

DEFINES += TRANSLATION

INCLUDEPATH += .\
	./config

LIBS += \
-lts \
-lqwt \
-lATCMcommon \
-lATCMutility \
-lATCMcommunication \
-lATCMplugin \
-lATCMinputdialog \
-lATCMlogger \
-lATCMstore \
-lATCMalarms \
-lATCMrecipe \
-lATCMtrend \
-lATCMsystem

# Input
HEADERS += \
        config/crosstable.h \
        style.h \
        pages.h

SOURCES += \
        config/crosstable.cpp \
        pages.cpp

RESOURCES += \
	systemicons.qrc

# pre-elabortation
check_missing_file.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/cleanmissingpage.pl $$_PRO_FILE_ $$_PRO_FILE_PWD_
check_undeclared_variable.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/check_cross_var.pl $$_PRO_FILE_PWD_
check_gotopage_bind.commands = @perl $${ATCM_TEMPLATE_BASE_DIR}/ATCM-template-project/connectbutton.pl $$_PRO_FILE_PWD_

#QMAKE_EXTRA_TARGETS += check_missing_file check_undeclared_variable check_gotopage_bind
#PRE_TARGETDEPS += check_missing_file check_undeclared_variable check_gotopage_bind

# language
        update.commands = $${QT_LUPDATE_PATH}/lupdate $$_PRO_FILE_
        updates.depends = $$SOURCES $$HEADERS $$FORMS $$TRANSLATIONS
        release.commands = $${QT_LRELEASE_PATH}/lrelease $$_PRO_FILE_
        release.depends = update

        QMAKE_EXTRA_TARGETS += update release
        PRE_TARGETDEPS += update release

        RESOURCES += \
            languages.qrc

        OTHER_FILES += \
            languages_it.ts \
            languages_en.ts

        include(./languages.pri)

# display size
MODEL = "<width>480</width><height>272</height>"

equals(MODEL, "<width>320</width><height>240</height>") {
    DEFINES+=WIDTH=320
    DEFINES+=HEIGHT=240
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>240</width><height>320</height>") {
    DEFINES+=WIDTH=240
    DEFINES+=HEIGHT=320
    DEFINES+=ROTATION=90
}
equals(MODEL, "<width>480</width><height>272</height>") {
    DEFINES+=WIDTH=480
    DEFINES+=HEIGHT=272
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>272</width><height>480</height>") {
    DEFINES+=WIDTH=272
    DEFINES+=HEIGHT=480
    DEFINES+=ROTATION=90
}
equals(MODEL, "<width>800</width><height>480</height>") {
    DEFINES+=WIDTH=800
    DEFINES+=HEIGHT=480
    DEFINES+=ROTATION=0
}
equals(MODEL, "<width>480</width><height>800</height>") {
    DEFINES+=WIDTH=240
    DEFINES+=HEIGHT=240
    DEFINES+=ROTATION=90
}


No LTCG on win

No LTCG on win

# Copyright 2014 - 2016 CyberTech Co. Ltd., Yurii Litvinov, Iakov Kirilenko
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#	  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Build settings common to all projects in TrikRuntime.
# Provides:
# CONFIGURATION_SUFFIX variable that shall be consistently used in TARGET and LIBS variables in all projects.
# copyToDestdir function to copy arbitrary files and directories to DESTDIR
# uses function to automatically add a library to INCLUDEPATH and LIBS.
#
# Uses environment variable INSTALL_ROOT as a root of a file structure for install rules.
#
# Uses CONFIG variable to control support for Google Sanitizers:
# - CONFIG+=sanitize-address will enable address sanitizer
# - CONFIG+=sanitize-undefined will enable undefined behavior sanitizer
# - CONFIG+=sanitize-thread will enable thread sanitizer

COMPILER = $$(CXX)

COMPILER_IS_ARM = $$find(COMPILER, arm-.*)

count(COMPILER_IS_ARM, 1) {
	ARCHITECTURE = arm
} else {
	ARCHITECTURE = x86
}

win32 {
	PLATFORM = windows
}

unix:!macx {
	PLATFORM = linux
}

macx {
	PLATFORM = mac
}

!CONFIG(qt): CONFIG+=qt

unix:CONFIG += ltcg
#CONFIG += fat-lto

#deal with mixed configurations
CONFIG -= debug_and_release debug_and_release_target
CONFIG(release, release | debug): CONFIG -= debug
CONFIG(debug, debug | release): CONFIG -= release
CONFIG(no-sanitizers):!CONFIG(nosanitizers): CONFIG += nosanitizers

CONFIG(debug) {
	isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-debug
	unix {
		QMAKE_CXXFLAGS += -coverage
		QMAKE_LFLAGS += -coverage
	}
	CONFIGURATION_SUFFIX=-d
} else {
	isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-release
	CONFIGURATION_SUFFIX=
}

#	CHECK_GCC_VERSION_5="test \"x$$CHECK_GCC_VERSION\" != x && echo \"$$CHECK_GCC_VERSION\" | grep -qe \'\\<5\\.[0-9]\\+\\.\'"
#	!clang:gcc:*-g++*:system($$CHECK_GCC_VERSION_5){

#CHECK_GCC_VERSION=$$system("$$QMAKE_CXX --version")
#!CONFIG(nosanitizers):!clang:gcc:*-g++*:system(test \"x$${CHECK_GCC_VERSION}\" = x  || echo \"$$CHECK_GCC_VERSION\" | grep -qe \'\\<4\\.[0-9]\\+\\.\')
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<[5-9]\\.[0-9]+\\."' ){ CONFIG += gcc5 }
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<4\\.[0-9]+\\."' ){ CONFIG += gcc4 }

CONFIG += link_pkgconfig
!win32:PKGCONFIG += python-2.7
macx:QT_CONFIG -= no-pkg-config

isEmpty(DESTDIR) {
	DESTDIR = $$PWD/bin/$$CONFIGURATION
}

PROJECT_BASENAME = $$basename(_PRO_FILE_)
PROJECT_NAME = $$section(PROJECT_BASENAME, ".", 0, 0)

isEmpty(TARGET) {
	TARGET = $$PROJECT_NAME$$CONFIGURATION_SUFFIX
} else {
	TARGET = $$TARGET$$CONFIGURATION_SUFFIX
}

equals(TEMPLATE, app) {
	unix:!macx {
		QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
		!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath,\'\$$ORIGIN\'
	}
	macx:!CONFIG(no_rpath) {
		QMAKE_LFLAGS += -rpath . -rpath @executable_path/../Lib -rpath @executable_path/../Frameworks -rpath @executable_path/../../../
	}
}

macx-clang {
	QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9
	QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
}

CONFIG(no-sanitizers):CONFIG+=nosanitizers

!CONFIG(nosanitizers):!clang:gcc:*-g++*:gcc4{
	warning("Disabled sanitizers, failed to detect compiler version or too old compiler: $$QMAKE_CXX")
	CONFIG += nosanitizers
}

!CONFIG(nosanitizers) {
	CONFIG += sanitizer
}

unix:!CONFIG(nosanitizers) {

	# seems like we want USan always, but are afraid of ....
	!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!CONFIG(sanitize_memory):!CONFIG(sanitize_kernel_address) {
		# Ubsan is turned on by default
		CONFIG += sanitizer sanitize_undefined
	}

	#LSan can be used without performance degrade even in release build
	#But at the moment we can not, because of Qt  problems
	CONFIG(debug):!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!macx-clang { CONFIG += sanitize_leak }

	CONFIG(sanitize_leak) {
		QMAKE_CFLAGS += -fsanitize=leak
		QMAKE_CXXFLAGS += -fsanitize=leak
		QMAKE_LFLAGS += -fsanitize=leak
	}

	CONFIG(sanitize_undefined):macx-clang {
		# sometimes runtime is missing in clang. this hack allows to avoid runtime dependency.
		QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fsanitize-trap=undefined
	}

	!clang:gcc:*-g++*:gcc5{
		CONFIG(sanitize_undefined){
		# Ubsan has (had at least) known issues with false errors about calls of methods of the base class.
		# That must be disabled. Variables for confguring ubsan are taken from here:
		# https://codereview.qt-project.org/#/c/43420/17/mkspecs/common/sanitize.conf
		# They can change in some version of Qt, keep track of it.
		# By the way, simply setting QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS instead of those used below
		# will not work due to arguments order ("-fsanitize=undefined" must be declared before "-fno-sanitize=vptr").
			QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fno-sanitize=vptr
		}
	}

	CONFIG(release){
			QMAKE_CFLAGS += -fsanitize-recover=all
			QMAKE_CXXFLAGS += -fsanitize-recover=all
	}

}

#Workaround for a known gcc/ld (before 7.3/bionic) issue
CONFIG(sanitizer):!clang: QMAKE_LFLAGS += -fuse-ld=gold -Wl,--disable-new-dtags

OBJECTS_DIR = .build/$$CONFIGURATION/obj
MOC_DIR = .build/$$CONFIGURATION/moc
RCC_DIR = .build/$$CONFIGURATION/rcc
UI_DIR = .build/$$CONFIGURATION/ui

PRECOMPILED_HEADER = $$PWD/pch.h
CONFIG += precompile_header

INCLUDEPATH += $$_PRO_FILE_PWD_ \
	$$_PRO_FILE_PWD_/include/$$PROJECT_NAME \

INCLUDEPATH += \
	$$PWD/qslog \

LIBS += -L$$DESTDIR

IS_QSLOG = $$find(PROJECT_NAME, [qQ]s[lL]og)

isEmpty(IS_QSLOG) {
	LIBS += -lqslog$$CONFIGURATION_SUFFIX
}

CONFIG += c++11

QMAKE_CXXFLAGS += -pedantic-errors -ansi -Wextra

CONFIG(gcc5) | clang {
	QMAKE_CXXFLAGS +=-Werror=pedantic -Werror=delete-incomplete
}

clang {
# Problem from Qt system headers
	QMAKE_CXXFLAGS += -Wno-error=expansion-to-defined
}

# -Werror=cast-qual
QMAKE_CXXFLAGS += -Werror=write-strings -Werror=redundant-decls -Werror=unreachable-code \
			-Werror=non-virtual-dtor -Wno-error=overloaded-virtual \
			-Werror=uninitialized -Werror=init-self

GLOBAL_PWD = $$PWD

# Useful function to copy additional files to destination,
# from http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
defineTest(isDir) {
	exists($$system_path($$1/*)):return(true)
	return(false)
}

defineTest(copyToDestdir) {
	FILES = $$1
	NOW = $$2

	for(FILE, FILES) {
		DESTDIR_SUFFIX =
		AFTER_SLASH = $$section(FILE, "/", -1, -1)
		isDir($$FILE) {
			ABSOLUTE_PATH = $$absolute_path($$FILE, $$GLOBAL_PWD)
			BASE_NAME = $$section(ABSOLUTE_PATH, "/", -1, -1)
			DESTDIR_SUFFIX = /$$BASE_NAME
			FILE = $$FILE/*
		}

		DDIR = $$system_path($$DESTDIR/$$3$$DESTDIR_SUFFIX)
		FILE = $$system_path($$FILE)

		mkpath($$DDIR)

		win32 {
			# probably, xcopy needs /s and /e for directories
			COPY_DIR = "cmd.exe /C xcopy /f /y /i "
		} else {
		 	COPY_DIR = "rsync -avz "
		}
		COPY_COMMAND = $$COPY_DIR $$quote($$FILE) $$quote($$DDIR/)
		isEmpty(NOW) {
			QMAKE_POST_LINK += $$COPY_COMMAND $$escape_expand(\\n\\t)
		} else {
			system($$COPY_COMMAND)
		}
	}

	export(QMAKE_POST_LINK)
}

defineTest(interfaceIncludes) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		INCLUDEPATH += $$GLOBAL_PWD/$$PROJECT/include
	}

	export(INCLUDEPATH)
}

defineTest(implementationIncludes) {
	interfaceIncludes($$1)
}

defineTest(transitiveIncludes) {
	interfaceIncludes($$1)
}

defineTest(PythonQtIncludes) {
	INCLUDEPATH += $$GLOBAL_PWD/PythonQt/PythonQt/src
	export(INCLUDEPATH)
}

defineTest(links) {
	LIBS += -L$$DESTDIR
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		LIBS += -l$$PROJECT$$CONFIGURATION_SUFFIX
	}

	export(LIBS)
}

defineTest(installs) {
	unix {
		equals(TEMPLATE, lib) {
			target.path = $$INSTALL_ROOT/usr/lib/
			isEmpty(PUBLIC_HEADERS) {
				headers.files = $$HEADERS
				headers.path = $$INSTALL_ROOT/usr/include/$$PROJECT_NAME/
			} else {
				headers.files = $$PUBLIC_HEADERS
				headers.path = $$INSTALL_ROOT/usr/include/$$PROJECT_NAME/
			}
		}

		equals(TEMPLATE, app) {
			target.path = $$INSTALL_ROOT/usr/bin/
		}

		INSTALLS += target
		export(target.path)

		equals(TEMPLATE, lib) {
			INSTALLS += headers
			export(headers.files)
			export(headers.path)
		}

		export(INSTALLS)
	}

	HEADERS += $$PUBLIC_HEADERS
	export(HEADERS)
}

defineTest(installAdditionalConfigs) {
	FILES = $$1

	unix {
		additionalConfigs.files += $$FILES
		additionalConfigs.path = $$INSTALL_ROOT/etc/trik/trikRuntime/

		INSTALLS += additionalConfigs

		export(additionalConfigs.path)
		export(additionalConfigs.files)
		export(INSTALLS)
	}
}

defineTest(installAdditionalSharedFiles) {
	FILES = $$1

	unix {
		additionalSharedFiles.files += $$FILES
		additionalSharedFiles.path = $$INSTALL_ROOT/usr/share/trikRuntime/

		INSTALLS += additionalSharedFiles

		export(additionalSharedFiles.path)
		export(additionalSharedFiles.files)
		export(INSTALLS)
	}
}

defineTest(noPch) {
	CONFIG -= precompiled_header
	PRECOMPILED_HEADER =
	export(CONFIG)
	export(PRECOMPILED_HEADER)
}

#seems obsolete, atleast for qmake-qt5
unix:equals(ARCHITECTURE, "x86"):!CONFIG(nosanitizers) {
	CONFIG(debug) {
		QMAKE_CXXFLAGS += -fno-omit-frame-pointer
		CONFIG(sanitize_address) {
			QMAKE_CXXFLAGS += -fsanitize=address
			QMAKE_LFLAGS += -fsanitize=address
		}
		CONFIG(sanitize_undefined) {
			# UBSan does not play well with precompiled headers for some reason.
			noPch()
			QMAKE_CXXFLAGS += -fsanitize=undefined
			QMAKE_LFLAGS += -fsanitize=undefined
		}
		CONFIG(sanitize_thread) {
			QMAKE_CXXFLAGS += -fsanitize=thread
			QMAKE_LFLAGS += -fsanitize=thread
			LIBS += -ltsan
		}
	}
}

CONFIG(noPch) {
	noPch()
}

# Copyright 2014 - 2016 CyberTech Co. Ltd., Yurii Litvinov, Iakov Kirilenko
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#	  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Build settings common to all projects in TrikRuntime.
# Provides:
# CONFIGURATION_SUFFIX variable that shall be consistently used in TARGET and LIBS variables in all projects.
# copyToDestdir function to copy arbitrary files and directories to DESTDIR
# uses function to automatically add a library to INCLUDEPATH and LIBS.
#
# Uses environment variable INSTALL_ROOT as a root of a file structure for install rules.
#
# Uses CONFIG variable to control support for Google Sanitizers:
# - CONFIG+=sanitize-address will enable address sanitizer
# - CONFIG+=sanitize-undefined will enable undefined behavior sanitizer
# - CONFIG+=sanitize-thread will enable thread sanitizer

COMPILER = $$(CXX)

COMPILER_IS_ARM = $$find(COMPILER, arm-.*)

count(COMPILER_IS_ARM, 1) {
	ARCHITECTURE = arm
} else {
	ARCHITECTURE = x86
}

win32 {
	PLATFORM = windows
}

unix:!macx {
	PLATFORM = linux
}

macx {
	PLATFORM = mac
}

!CONFIG(qt): CONFIG+=qt

CONFIG += ltcg
#CONFIG += fat-lto

#deal with mixed configurations
CONFIG -= debug_and_release debug_and_release_target
CONFIG(release, release | debug): CONFIG -= debug
CONFIG(debug, debug | release): CONFIG -= release
CONFIG(no-sanitizers):!CONFIG(nosanitizers): CONFIG += nosanitizers

CONFIG(debug) {
	isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-debug
	unix {
		QMAKE_CXXFLAGS += -coverage
		QMAKE_LFLAGS += -coverage
	}
	CONFIGURATION_SUFFIX=-d
} else {
	isEmpty(CONFIGURATION): CONFIGURATION = $$ARCHITECTURE-release
	CONFIGURATION_SUFFIX=
}

#	CHECK_GCC_VERSION_5="test \"x$$CHECK_GCC_VERSION\" != x && echo \"$$CHECK_GCC_VERSION\" | grep -qe \'\\<5\\.[0-9]\\+\\.\'"
#	!clang:gcc:*-g++*:system($$CHECK_GCC_VERSION_5){

#CHECK_GCC_VERSION=$$system("$$QMAKE_CXX --version")
#!CONFIG(nosanitizers):!clang:gcc:*-g++*:system(test \"x$${CHECK_GCC_VERSION}\" = x  || echo \"$$CHECK_GCC_VERSION\" | grep -qe \'\\<4\\.[0-9]\\+\\.\')
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<[5-9]\\.[0-9]+\\."' ){ CONFIG += gcc5 }
!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -qEe '"\\<4\\.[0-9]+\\."' ){ CONFIG += gcc4 }

CONFIG += link_pkgconfig
!win32:PKGCONFIG += python-2.7
macx:QT_CONFIG -= no-pkg-config

isEmpty(DESTDIR) {
	DESTDIR = $$PWD/bin/$$CONFIGURATION
}

PROJECT_BASENAME = $$basename(_PRO_FILE_)
PROJECT_NAME = $$section(PROJECT_BASENAME, ".", 0, 0)

isEmpty(TARGET) {
	TARGET = $$PROJECT_NAME$$CONFIGURATION_SUFFIX
} else {
	TARGET = $$TARGET$$CONFIGURATION_SUFFIX
}

equals(TEMPLATE, app) {
	unix:!macx {
		QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
		!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath,\'\$$ORIGIN\'
	}
	macx:!CONFIG(no_rpath) {
		QMAKE_LFLAGS += -rpath . -rpath @executable_path/../Lib -rpath @executable_path/../Frameworks -rpath @executable_path/../../../
	}
}

macx-clang {
	QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9
	QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
}

CONFIG(no-sanitizers):CONFIG+=nosanitizers

!CONFIG(nosanitizers):!clang:gcc:*-g++*:gcc4{
	warning("Disabled sanitizers, failed to detect compiler version or too old compiler: $$QMAKE_CXX")
	CONFIG += nosanitizers
}

!CONFIG(nosanitizers) {
	CONFIG += sanitizer
}

unix:!CONFIG(nosanitizers) {

	# seems like we want USan always, but are afraid of ....
	!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!CONFIG(sanitize_memory):!CONFIG(sanitize_kernel_address) {
		# Ubsan is turned on by default
		CONFIG += sanitizer sanitize_undefined
	}

	#LSan can be used without performance degrade even in release build
	#But at the moment we can not, because of Qt  problems
	CONFIG(debug):!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!macx-clang { CONFIG += sanitize_leak }

	CONFIG(sanitize_leak) {
		QMAKE_CFLAGS += -fsanitize=leak
		QMAKE_CXXFLAGS += -fsanitize=leak
		QMAKE_LFLAGS += -fsanitize=leak
	}

	CONFIG(sanitize_undefined):macx-clang {
		# sometimes runtime is missing in clang. this hack allows to avoid runtime dependency.
		QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fsanitize-trap=undefined
	}

	!clang:gcc:*-g++*:gcc5{
		CONFIG(sanitize_undefined){
		# Ubsan has (had at least) known issues with false errors about calls of methods of the base class.
		# That must be disabled. Variables for confguring ubsan are taken from here:
		# https://codereview.qt-project.org/#/c/43420/17/mkspecs/common/sanitize.conf
		# They can change in some version of Qt, keep track of it.
		# By the way, simply setting QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS instead of those used below
		# will not work due to arguments order ("-fsanitize=undefined" must be declared before "-fno-sanitize=vptr").
			QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fno-sanitize=vptr
		}
	}

	CONFIG(release){
			QMAKE_CFLAGS += -fsanitize-recover=all
			QMAKE_CXXFLAGS += -fsanitize-recover=all
	}

}

#Workaround for a known gcc/ld (before 7.3/bionic) issue
CONFIG(sanitizer):!clang: QMAKE_LFLAGS += -fuse-ld=gold -Wl,--disable-new-dtags

OBJECTS_DIR = .build/$$CONFIGURATION/obj
MOC_DIR = .build/$$CONFIGURATION/moc
RCC_DIR = .build/$$CONFIGURATION/rcc
UI_DIR = .build/$$CONFIGURATION/ui

PRECOMPILED_HEADER = $$PWD/pch.h
CONFIG += precompile_header

INCLUDEPATH += $$_PRO_FILE_PWD_ \
	$$_PRO_FILE_PWD_/include/$$PROJECT_NAME \

INCLUDEPATH += \
	$$PWD/qslog \

LIBS += -L$$DESTDIR

IS_QSLOG = $$find(PROJECT_NAME, [qQ]s[lL]og)

isEmpty(IS_QSLOG) {
	LIBS += -lqslog$$CONFIGURATION_SUFFIX
}

CONFIG += c++11

QMAKE_CXXFLAGS += -pedantic-errors -ansi -Wextra

CONFIG(gcc5) | clang {
	QMAKE_CXXFLAGS +=-Werror=pedantic -Werror=delete-incomplete
}

clang {
# Problem from Qt system headers
	QMAKE_CXXFLAGS += -Wno-error=expansion-to-defined
}

# -Werror=cast-qual
QMAKE_CXXFLAGS += -Werror=write-strings -Werror=redundant-decls -Werror=unreachable-code \
			-Werror=non-virtual-dtor -Wno-error=overloaded-virtual \
			-Werror=uninitialized -Werror=init-self

GLOBAL_PWD = $$PWD

# Useful function to copy additional files to destination,
# from http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
defineTest(isDir) {
	exists($$system_path($$1/*)):return(true)
	return(false)
}

defineTest(copyToDestdir) {
	FILES = $$1
	NOW = $$2

	for(FILE, FILES) {
		DESTDIR_SUFFIX =
		AFTER_SLASH = $$section(FILE, "/", -1, -1)
		isDir($$FILE) {
			ABSOLUTE_PATH = $$absolute_path($$FILE, $$GLOBAL_PWD)
			BASE_NAME = $$section(ABSOLUTE_PATH, "/", -1, -1)
			DESTDIR_SUFFIX = /$$BASE_NAME
			FILE = $$FILE/*
		}

		DDIR = $$system_path($$DESTDIR/$$3$$DESTDIR_SUFFIX)
		FILE = $$system_path($$FILE)

		mkpath($$DDIR)

		win32 {
			# probably, xcopy needs /s and /e for directories
			COPY_DIR = "cmd.exe /C xcopy /f /y /i "
		} else {
		 	COPY_DIR = "rsync -avz "
		}
		COPY_COMMAND = $$COPY_DIR $$quote($$FILE) $$quote($$DDIR/)
		isEmpty(NOW) {
			QMAKE_POST_LINK += $$COPY_COMMAND $$escape_expand(\\n\\t)
		} else {
			system($$COPY_COMMAND)
		}
	}

	export(QMAKE_POST_LINK)
}

defineTest(interfaceIncludes) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		INCLUDEPATH += $$GLOBAL_PWD/$$PROJECT/include
	}

	export(INCLUDEPATH)
}

defineTest(implementationIncludes) {
	interfaceIncludes($$1)
}

defineTest(transitiveIncludes) {
	interfaceIncludes($$1)
}

defineTest(PythonQtIncludes) {
	INCLUDEPATH += $$GLOBAL_PWD/PythonQt/PythonQt/src
	export(INCLUDEPATH)
}

defineTest(links) {
	LIBS += -L$$DESTDIR
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		LIBS += -l$$PROJECT$$CONFIGURATION_SUFFIX
	}

	export(LIBS)
}

defineTest(installs) {
	unix {
		equals(TEMPLATE, lib) {
			target.path = $$INSTALL_ROOT/usr/lib/
			isEmpty(PUBLIC_HEADERS) {
				headers.files = $$HEADERS
				headers.path = $$INSTALL_ROOT/usr/include/$$PROJECT_NAME/
			} else {
				headers.files = $$PUBLIC_HEADERS
				headers.path = $$INSTALL_ROOT/usr/include/$$PROJECT_NAME/
			}
		}

		equals(TEMPLATE, app) {
			target.path = $$INSTALL_ROOT/usr/bin/
		}

		INSTALLS += target
		export(target.path)

		equals(TEMPLATE, lib) {
			INSTALLS += headers
			export(headers.files)
			export(headers.path)
		}

		export(INSTALLS)
	}

	HEADERS += $$PUBLIC_HEADERS
	export(HEADERS)
}

defineTest(installAdditionalConfigs) {
	FILES = $$1

	unix {
		additionalConfigs.files += $$FILES
		additionalConfigs.path = $$INSTALL_ROOT/etc/trik/trikRuntime/

		INSTALLS += additionalConfigs

		export(additionalConfigs.path)
		export(additionalConfigs.files)
		export(INSTALLS)
	}
}

defineTest(installAdditionalSharedFiles) {
	FILES = $$1

	unix {
		additionalSharedFiles.files += $$FILES
		additionalSharedFiles.path = $$INSTALL_ROOT/usr/share/trikRuntime/

		INSTALLS += additionalSharedFiles

		export(additionalSharedFiles.path)
		export(additionalSharedFiles.files)
		export(INSTALLS)
	}
}

defineTest(noPch) {
	CONFIG -= precompiled_header
	PRECOMPILED_HEADER =
	export(CONFIG)
	export(PRECOMPILED_HEADER)
}

#seems obsolete, atleast for qmake-qt5
unix:equals(ARCHITECTURE, "x86"):!CONFIG(nosanitizers) {
	CONFIG(debug) {
		QMAKE_CXXFLAGS += -fno-omit-frame-pointer
		CONFIG(sanitize_address) {
			QMAKE_CXXFLAGS += -fsanitize=address
			QMAKE_LFLAGS += -fsanitize=address
		}
		CONFIG(sanitize_undefined) {
			# UBSan does not play well with precompiled headers for some reason.
			noPch()
			QMAKE_CXXFLAGS += -fsanitize=undefined
			QMAKE_LFLAGS += -fsanitize=undefined
		}
		CONFIG(sanitize_thread) {
			QMAKE_CXXFLAGS += -fsanitize=thread
			QMAKE_LFLAGS += -fsanitize=thread
			LIBS += -ltsan
		}
	}
}

CONFIG(noPch) {
	noPch()
}


Turn LSan off in release build

Turn LSan off in release build

# Copyright 2007-2015 QReal Research Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

win32 {
	PLATFORM = windows
}

unix:!macx {
	PLATFORM = linux
}

macx {
	PLATFORM = mac
}

CONFIG(debug, debug | release) {
	CONFIGURATION = debug
	CONFIGURATION_SUFFIX = -d
	unix {
		QMAKE_CXXFLAGS += -coverage
		QMAKE_LFLAGS += -coverage
	}
} else {
	CONFIGURATION = release
	CONFIGURATION_SUFFIX =
}

DESTDIR = $$PWD/bin/$$CONFIGURATION

PROJECT_BASENAME = $$basename(_PRO_FILE_)
PROJECT_NAME = $$section(PROJECT_BASENAME, ".", 0, 0)

isEmpty(TARGET) {
	TARGET = $$PROJECT_NAME$$CONFIGURATION_SUFFIX
} else {
	TARGET = $$TARGET$$CONFIGURATION_SUFFIX
}

equals(TEMPLATE, app) {
	unix:!macx {
		QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
		!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath,.
	}
}

macx-clang {
	QMAKE_CXXFLAGS += -stdlib=libc++
	QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../../../
}

unix {

	# seems like we want USan always, but are afraid of ....
	!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!CONFIG(sanitize_memory):!CONFIG(sanitize_kernel_address) {
		# Ubsan is turned on by default
		CONFIG += sanitizer sanitize_undefined
	}

	CONFIG(debug, debug | release):!CONFIG(sanitize_address):!macx-clang { CONFIG += sanitize_leak }

	CONFIG(sanitize_leak) {
		#LSan can be used without performance degrade even in release build
		QMAKE_CFLAGS += -fsanitize=leak
		QMAKE_CXXFLAGS += -fsanitize=leak
		QMAKE_LFLAGS += -fsanitize=leak
	}

	CONFIG(sanitize_undefined):macx-clang {
		# sometimes runtime is missing in clang. this hack allows to avoid runtime dependency.
		QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fsanitize-trap=undefined
	}

	!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -oe \'\\<5\\.[0-9]\\+\\.\' ){
		CONFIG(sanitize_undefined){
		# Ubsan has (had at least) known issues with false errors about calls of methods of the base class.
		# That must be disabled. Variables for confguring ubsan are taken from here:
		# https://codereview.qt-project.org/#/c/43420/17/mkspecs/common/sanitize.conf
		# They can change in some version of Qt, keep track of it.
		# By the way, simply setting QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS instead of those used below
		# will not work due to arguments order ("-fsanitize=undefined" must be declared before "-fno-sanitize=vptr").
			QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fno-sanitize=vptr
		}
	}

	CONFIG(release, debug | release){
		!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -oe \'\\<4\\.[0-9]\\+\\.\' ){
			message("Too old compiler: $$QMAKE_CXX")
		} else {
			QMAKE_CFLAGS += -fsanitize-recover=all
			QMAKE_CXXFLAGS += -fsanitize-recover=all
		}
	}

}

OBJECTS_DIR = .build/$$CONFIGURATION/obj
MOC_DIR = .build/$$CONFIGURATION/moc
RCC_DIR = .build/$$CONFIGURATION/rcc
UI_DIR = .build/$$CONFIGURATION/ui

INCLUDEPATH += $$_PRO_FILE_PWD_ \
	$$_PRO_FILE_PWD_/include \
	$$PWD \

LIBS += -L$$DESTDIR

CONFIG += c++11
QMAKE_CXXFLAGS += -Wextra -Wcast-qual -Wwrite-strings -Wredundant-decls -Wunreachable-code -Wnon-virtual-dtor

GLOBAL_PWD = $$PWD

# Useful function to copy additional files to destination,
# from http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
defineTest(copyToDestdir) {
	FILES = $$1
	NOW = $$2

	for(FILE, FILES) {
		DESTDIR_SUFFIX =
		isEmpty(QMAKE_SH) {
		# This ugly code is needed because xcopy requires to add source directory name to target directory name when copying directories
			win32 {
				AFTER_SLASH = $$section(FILE, "/", -1, -1)
				BASE_NAME = $$section(FILE, "/", -2, -2)
				equals(AFTER_SLASH, ""):DESTDIR_SUFFIX = /$$BASE_NAME

				FILE ~= s,/$,,g

				FILE ~= s,/,\\,g
			}
			DDIR = $$DESTDIR$$DESTDIR_SUFFIX/$$3
			win32:DDIR ~= s,/,\\,g
		} else {
			DDIR = $$DESTDIR$$DESTDIR_SUFFIX/$$3
		}

		isEmpty(NOW) {
			# In case this is directory add "*" to copy contents of a directory instead of directory itself under linux.
			!win32:equals(AFTER_SLASH, ""):FILE = $$FILE*
			QMAKE_POST_LINK += $(COPY_DIR) $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
		} else {
			win32 {
				system("cmd /C "xcopy $$quote($$FILE) $$quote($$DDIR) /s /e /q /y /i"")
			}

			unix:!macx {
				system("cp -r -f $$FILE $$DDIR")
			}

			macx {
				system("cp -af $$FILE $$DDIR/")
			}
		}
	}

	export(QMAKE_POST_LINK)
}

defineTest(includes) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		INCLUDEPATH += $$GLOBAL_PWD/$$PROJECT $$GLOBAL_PWD/$$PROJECT/include
	}

	export(INCLUDEPATH)
}

defineTest(links) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		LIBS += -l$$PROJECT$$CONFIGURATION_SUFFIX
	}

	export(LIBS)
}

# Copyright 2007-2015 QReal Research Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

win32 {
	PLATFORM = windows
}

unix:!macx {
	PLATFORM = linux
}

macx {
	PLATFORM = mac
}

CONFIG(debug, debug | release) {
	CONFIGURATION = debug
	CONFIGURATION_SUFFIX = -d
	unix {
		QMAKE_CXXFLAGS += -coverage
		QMAKE_LFLAGS += -coverage
	}
} else {
	CONFIGURATION = release
	CONFIGURATION_SUFFIX =
}

DESTDIR = $$PWD/bin/$$CONFIGURATION

PROJECT_BASENAME = $$basename(_PRO_FILE_)
PROJECT_NAME = $$section(PROJECT_BASENAME, ".", 0, 0)

isEmpty(TARGET) {
	TARGET = $$PROJECT_NAME$$CONFIGURATION_SUFFIX
} else {
	TARGET = $$TARGET$$CONFIGURATION_SUFFIX
}

equals(TEMPLATE, app) {
	unix:!macx {
		QMAKE_LFLAGS += -Wl,-rpath-link,$$DESTDIR
		!CONFIG(no_rpath) QMAKE_LFLAGS += -Wl,-O1,-rpath,.
	}
}

macx-clang {
	QMAKE_CXXFLAGS += -stdlib=libc++
	QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../../../
}

unix:!CONFIG(nosanitizers){

	# seems like we want USan always, but are afraid of ....
	!CONFIG(sanitize_address):!CONFIG(sanitize_thread):!CONFIG(sanitize_memory):!CONFIG(sanitize_kernel_address) {
		# Ubsan is turned on by default into debug build
		CONFIG += sanitizer sanitize_undefined
	}

	!CONFIG(sanitize_address):!macx-clang { CONFIG += sanitize_leak }

	CONFIG(sanitize_leak) {
		#LSan can be used without performance degrade even in release build
		QMAKE_CFLAGS += -fsanitize=leak
		QMAKE_CXXFLAGS += -fsanitize=leak
		QMAKE_LFLAGS += -fsanitize=leak
	}

	CONFIG(sanitize_undefined):macx-clang {
		# sometimes runtime is missing in clang. this hack allows to avoid runtime dependency.
		QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fsanitize-trap=undefined
		QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fsanitize-trap=undefined
	}

	!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -oe \'\\<5\\.[0-9]\\+\\.\' ){
		CONFIG(sanitize_undefined){
		# Ubsan has (had at least) known issues with false errors about calls of methods of the base class.
		# That must be disabled. Variables for confguring ubsan are taken from here:
		# https://codereview.qt-project.org/#/c/43420/17/mkspecs/common/sanitize.conf
		# They can change in some version of Qt, keep track of it.
		# By the way, simply setting QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS instead of those used below
		# will not work due to arguments order ("-fsanitize=undefined" must be declared before "-fno-sanitize=vptr").
			QMAKE_SANITIZE_UNDEFINED_CFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_CXXFLAGS += -fno-sanitize=vptr
			QMAKE_SANITIZE_UNDEFINED_LFLAGS += -fno-sanitize=vptr
		}
	}

	CONFIG(release, debug | release){
		!clang:gcc:*-g++*:system($$QMAKE_CXX --version | grep -oe \'\\<4\\.[0-9]\\+\\.\' ){
			message("Too old compiler: $$QMAKE_CXX")
		} else {
			QMAKE_CFLAGS += -fsanitize-recover=all
			QMAKE_CXXFLAGS += -fsanitize-recover=all
		}
	}

}

OBJECTS_DIR = .build/$$CONFIGURATION/obj
MOC_DIR = .build/$$CONFIGURATION/moc
RCC_DIR = .build/$$CONFIGURATION/rcc
UI_DIR = .build/$$CONFIGURATION/ui

INCLUDEPATH += $$_PRO_FILE_PWD_ \
	$$_PRO_FILE_PWD_/include \
	$$PWD \

LIBS += -L$$DESTDIR

CONFIG += c++11
QMAKE_CXXFLAGS += -Wextra -Wcast-qual -Wwrite-strings -Wredundant-decls -Wunreachable-code -Wnon-virtual-dtor

GLOBAL_PWD = $$PWD

# Useful function to copy additional files to destination,
# from http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
defineTest(copyToDestdir) {
	FILES = $$1
	NOW = $$2

	for(FILE, FILES) {
		DESTDIR_SUFFIX =
		isEmpty(QMAKE_SH) {
		# This ugly code is needed because xcopy requires to add source directory name to target directory name when copying directories
			win32 {
				AFTER_SLASH = $$section(FILE, "/", -1, -1)
				BASE_NAME = $$section(FILE, "/", -2, -2)
				equals(AFTER_SLASH, ""):DESTDIR_SUFFIX = /$$BASE_NAME

				FILE ~= s,/$,,g

				FILE ~= s,/,\\,g
			}
			DDIR = $$DESTDIR$$DESTDIR_SUFFIX/$$3
			win32:DDIR ~= s,/,\\,g
		} else {
			DDIR = $$DESTDIR$$DESTDIR_SUFFIX/$$3
		}

		isEmpty(NOW) {
			# In case this is directory add "*" to copy contents of a directory instead of directory itself under linux.
			!win32:equals(AFTER_SLASH, ""):FILE = $$FILE*
			QMAKE_POST_LINK += $(COPY_DIR) $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
		} else {
			win32 {
				system("cmd /C "xcopy $$quote($$FILE) $$quote($$DDIR) /s /e /q /y /i"")
			}

			unix:!macx {
				system("cp -r -f $$FILE $$DDIR")
			}

			macx {
				system("cp -af $$FILE $$DDIR/")
			}
		}
	}

	export(QMAKE_POST_LINK)
}

defineTest(includes) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		INCLUDEPATH += $$GLOBAL_PWD/$$PROJECT $$GLOBAL_PWD/$$PROJECT/include
	}

	export(INCLUDEPATH)
}

defineTest(links) {
	PROJECTS = $$1

	for(PROJECT, PROJECTS) {
		LIBS += -l$$PROJECT$$CONFIGURATION_SUFFIX
	}

	export(LIBS)
}


Fixed for Solaris

Fixed for Solaris

######################################################################
# $Revision: 1.31 $ $Author: shoops $ $Date: 2004/11/17 16:33:51 $
######################################################################

# In the case the BUILD_OS is not specified we make a guess.
isEmpty(BUILD_OS) {
  win32 {
    BUILD_OS = WIN32
  } else {
    BUILD_OS = $$system(uname)
  }
}
DEFINES += $$BUILD_OS
message("Configuring for $${BUILD_OS}.")

TARGETDEPS += Makefile
DEFINES+=XML_STATIC
DEFINES+=LIBSBML_STATIC

# Common configuration settings
CONFIG += exceptions
CONFIG += rtti

debug {
  DEFINES += COPASI_DEBUG
}

!contains(BUILD_OS, WIN32) {
  QMAKE_QMAKE = $(QTDIR)/bin/qmake

  # The character # (hex 23) can not be escaped we therefore create
  # a variable containing it
  HASH = $$system(echo "\\043")
  contains(HASH, \\043){
    HASH = $$system(echo -e "\\043")
  }

  myLex = \
          $(LEX) -t $< | \
          sed -e 's/class istream;/$${HASH}include "copasi.h"/' \
              -e 's/<FlexLexer.h>/"FlexLexer.h"/' \
              -e 's/$${HASH}include <unistd.h>/using namespace std;/' > $@
}

contains(BUILD_OS, Darwin) {
  INCLUDEPATH += /System/Library/Frameworks/vecLib.framework/Headers
  LIBS += -framework vecLib
  LIBS += -framework Carbon
  LIBS += -framework QuickTime
  LIBS += -lz
}

contains(BUILD_OS, WIN32) {
  QMAKE_QMAKE = $(QTDIR)\bin\qmake.exe
  DEFINES -= UNICODE
  debug {
    QMAKE_LFLAGS_WINDOWS += /NODEFAULTLIB:"msvcrt.lib"
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    QMAKE_CXXFLAGS_DEBUG   += -I"$${MKL_PATH}\include"
    QMAKE_CXXFLAGS_RELEASE += -I"$${MKL_PATH}\include"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${MKL_PATH}\ia32\lib"
    LIBS += mkl_lapack.lib mkl_p3.lib mkl_c.lib
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      QMAKE_CXXFLAGS_DEBUG   += -I"$${CLAPACK_PATH}\include"
      QMAKE_CXXFLAGS_RELEASE += -I"$${CLAPACK_PATH}\include"
      QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${CLAPACK_PATH}\lib"
      LIBS += clapack.lib
    } else {
      error( "Either MKL_PATH or CLAPACK_PATH must be specified" )
    }
  }

  !isEmpty(EXPAT_PATH) {
    QMAKE_CXXFLAGS_DEBUG   += -I"$${EXPAT_PATH}\Source\lib"
    QMAKE_CXXFLAGS_RELEASE += -I"$${EXPAT_PATH}\Source\lib"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${EXPAT_PATH}\StaticLibs"
    LIBS += libexpatMT.lib
  } else {
    error( "EXPAT_PATH must be specified" )
  }

  !isEmpty(SBML_PATH) {
    QMAKE_CXXFLAGS_DEBUG   += -I"$${SBML_PATH}\include"
    QMAKE_CXXFLAGS_RELEASE += -I"$${SBML_PATH}\include"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${SBML_PATH}\lib"
    LIBS += libsbml.lib
  } else {
    error( "SBML_PATH must be specified" )
  }
}

contains(BUILD_OS, SunOS) {
  !isEmpty(CLAPACK_PATH) {
    DEFINES += USE_CLAPACK
    INCLUDEPATH += $${CLAPACK_PATH}/include
    LIBS += -llapack -lblas -lF77 -lfl
    LIBS += -L$${CLAPACK_PATH}/lib
  } else {
    !isEmpty(LAPACK_PATH) {
      message("Using lapack.")
      DEFINES += USE_CLAPACK
      INCLUDEPATH += $${LAPACK_PATH}/include
      LIBS += -llapack -lblas  -lg2c
      LIBS += -L$${LAPACK_PATH}/lib
    } else {
      error( "Either CLAPACK_PATH or LAPACK_PATH must be specified" )
    }
  }
  !isEmpty(EXPAT_PATH){
      LIBS+=  -L$${EXPAT_PATH}/lib
      INCLUDEPATH += $${EXPAT_PATH}/include
  }
  !isEmpty(SBML_PATH){
      LIBS+=  -L$${SBML_PATH}/lib
      INCLUDEPATH += $${SBML_PATH}/include
  }
  LIBS += -lSM
  LIBS += -lsbml -lexpat
}

contains(BUILD_OS, Linux) {
  QMAKE_LFLAGS += -static

  LIBS += -lsbml -lexpat

  !isEmpty(QWT_PATH){
      LIBS+=  -L$${QWT_PATH}/lib
      INCLUDEPATH += $${QWT_PATH}/include
  }
#  else {
#      error( "QWT_PATH must be specified" )
#  }
  !isEmpty(EXPAT_PATH){
      LIBS+=  -L$${EXPAT_PATH}/lib
      INCLUDEPATH += $${EXPAT_PATH}/include
  }
  !isEmpty(SBML_PATH){
      LIBS+=  -L$${SBML_PATH}/lib
      INCLUDEPATH += $${SBML_PATH}/include
  }  !isEmpty(EXPAT_PATH){
      LIBS+=  -L$${EXPAT_PATH}/lib
      INCLUDEPATH += $${EXPAT_PATH}/include
  }
  !isEmpty(SBML_PATH){
      LIBS+=  -L$${SBML_PATH}/lib
      INCLUDEPATH += $${SBML_PATH}/include
  }
  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    INCLUDEPATH += $${MKL_PATH}/include
    LIBS += -lmkl_lapack -lmkl_p3 -lg2c -lpthread
    LIBS +=  -L$${MKL_PATH}/lib/32
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      INCLUDEPATH += $${CLAPACK_PATH}/include
      INCLUDEPATH += /usr/include/qt3
      LIBS += -llapack -lblas -lF77 -lfl
      LIBS += -L$${CLAPACK_PATH}/lib
    } else {
      !isEmpty(LAPACK_PATH) {
        message("Using lapack.")
        DEFINES += USE_CLAPACK
        INCLUDEPATH += $${LAPACK_PATH}/include
        LIBS += -llapack -lblas  -lg2c
        LIBS += -L$${LAPACK_PATH}/lib
      } else {
        error( "Either MKL_PATH, CLAPACK_PATH, or LAPACK_PATH must be specified" )
      }
    }
  }
}

DEP1.target   = depend
DEP1.depends  = qmake

QMAKE_EXTRA_UNIX_TARGETS += DEP1

######################################################################
# $Revision: 1.30 $ $Author: shoops $ $Date: 2004/10/28 18:40:04 $
######################################################################

# In the case the BUILD_OS is not specified we make a guess.
isEmpty(BUILD_OS) {
  win32 {
    BUILD_OS = WIN32
  } else {
    BUILD_OS = $$system(uname)
  }
}
DEFINES += $$BUILD_OS
message("Configuring for $${BUILD_OS}.")

TARGETDEPS += Makefile
DEFINES+=XML_STATIC
DEFINES+=LIBSBML_STATIC

# Common configuration settings
CONFIG += exceptions
CONFIG += rtti

debug {
  DEFINES += COPASI_DEBUG
}

!contains(BUILD_OS, WIN32) {
  QMAKE_QMAKE = $(QTDIR)/bin/qmake

  # The character # (hex 23) can not be escaped we therefore create
  # a variable containing it
  HASH = $$system(echo "\\043")
  contains(HASH, \\043){
    HASH = $$system(echo -e "\\043")
  }

  myLex = \
          $(LEX) -t $< | \
          sed -e 's/class istream;/$${HASH}include "copasi.h"/' \
              -e 's/<FlexLexer.h>/"FlexLexer.h"/' \
              -e 's/$${HASH}include <unistd.h>/using namespace std;/' > $@
}

contains(BUILD_OS, Darwin) {
  INCLUDEPATH += /System/Library/Frameworks/vecLib.framework/Headers
  LIBS += -framework vecLib
  LIBS += -framework Carbon
  LIBS += -framework QuickTime
  LIBS += -lz
}

contains(BUILD_OS, WIN32) {
  QMAKE_QMAKE = $(QTDIR)\bin\qmake.exe
  DEFINES -= UNICODE
  debug {
    QMAKE_LFLAGS_WINDOWS += /NODEFAULTLIB:"msvcrt.lib"
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    QMAKE_CXXFLAGS_DEBUG   += -I"$${MKL_PATH}\include"
    QMAKE_CXXFLAGS_RELEASE += -I"$${MKL_PATH}\include"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${MKL_PATH}\ia32\lib"
    LIBS += mkl_lapack.lib mkl_p3.lib mkl_c.lib
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      QMAKE_CXXFLAGS_DEBUG   += -I"$${CLAPACK_PATH}\include"
      QMAKE_CXXFLAGS_RELEASE += -I"$${CLAPACK_PATH}\include"
      QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${CLAPACK_PATH}\lib"
      LIBS += clapack.lib
    } else {
      error( "Either MKL_PATH or CLAPACK_PATH must be specified" )
    }
  }

  !isEmpty(EXPAT_PATH) {
    QMAKE_CXXFLAGS_DEBUG   += -I"$${EXPAT_PATH}\Source\lib"
    QMAKE_CXXFLAGS_RELEASE += -I"$${EXPAT_PATH}\Source\lib"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${EXPAT_PATH}\StaticLibs"
    LIBS += libexpatMT.lib
  } else {
    error( "EXPAT_PATH must be specified" )
  }

  !isEmpty(SBML_PATH) {
    QMAKE_CXXFLAGS_DEBUG   += -I"$${SBML_PATH}\include"
    QMAKE_CXXFLAGS_RELEASE += -I"$${SBML_PATH}\include"
    QMAKE_LFLAGS_WINDOWS += /LIBPATH:"$${SBML_PATH}\lib"
    LIBS += libsbml.lib
  } else {
    error( "SBML_PATH must be specified" )
  }
}

contains(BUILD_OS, SunOS) {
  !isEmpty(CLAPACK_PATH) {
    DEFINES += USE_CLAPACK
    INCLUDEPATH += $${CLAPACK_PATH}/include
    LIBS += -llapack -lblas -lF77 -lfl
    LIBS += -L$${CLAPACK_PATH}/lib
  } else {
    error( "CLAPACK_PATH must be specified" )
  }
  LIBS += -lSM
}

contains(BUILD_OS, Linux) {
  QMAKE_LFLAGS_RELEASE += -static

  LIBS += -lsbml -lexpat

  !isEmpty(QWT_PATH){
      LIBS+=  -L$${QWT_PATH}/lib
      INCLUDEPATH += $${QWT_PATH}/include
  }
#  else {
#      error( "QWT_PATH must be specified" )
#  }
  !isEmpty(EXPAT_PATH){
      LIBS+=  -L$${EXPAT_PATH}/lib
      INCLUDEPATH += $${EXPAT_PATH}/include
  }
  !isEmpty(SBML_PATH){
      LIBS+=  -L$${SBML_PATH}/lib
      INCLUDEPATH += $${SBML_PATH}/include
  }
  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    INCLUDEPATH += $${MKL_PATH}/include
    LIBS += -lmkl_lapack -lmkl_p3 -lg2c -lpthread
    LIBS +=  -L$${MKL_PATH}/lib/32
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      INCLUDEPATH += $${CLAPACK_PATH}/include
      INCLUDEPATH += /usr/include/qt3
      LIBS += -llapack -lblas -lF77 -lfl
      LIBS += -L$${CLAPACK_PATH}/lib
    } else {
      !isEmpty(LAPACK_PATH) {
        message("Using lapack.")
        DEFINES += USE_CLAPACK
        INCLUDEPATH += $${LAPACK_PATH}/include
        LIBS += -llapack -lblas  -lg2c
        LIBS += -L$${LAPACK_PATH}/lib
      } else {
        error( "Either MKL_PATH, CLAPACK_PATH, or LAPACK_PATH must be specified" )
      }
    }
  }
}

DEP1.target   = depend
DEP1.depends  = qmake

QMAKE_EXTRA_UNIX_TARGETS += DEP1


fixes for compiling

fixes for compiling

# Copyright 2013-2016 CyberTech Labs Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

QT += svg xml widgets

includes(plugins/robots/interpreters/interpreterCore \
		plugins/robots/common/kitBase \
		plugins/robots/common/twoDModel \
		plugins/robots/utils \
		qrtext \
		plugins/robots/thirdparty/trikRuntime/trikControl \
		plugins/robots/thirdparty/trikRuntime/trikNetwork \
)

LIBS += -L$$GLOBAL_PWD/plugins/robots/thirdparty/trikRuntime/bin/x86-$$CONFIGURATION
# TODO:

links(qrkernel qrrepo qrutils qrtext qrgui-models qrgui-controller qrgui-preferences-dialog qrgui-plugin-manager \
		qrgui-tool-plugin-interface robots-kit-base robots-utils robots-2d-model qslog \
		trikControl-x86 trikScriptRunner-x86\
)

HEADERS += \
	$$PWD/include/interpreterCore/robotsPluginFacade.h \
	$$PWD/include/interpreterCore/managers/actionsManager.h \
	$$PWD/include/interpreterCore/managers/saveConvertionManager.h \
	$$PWD/include/interpreterCore/managers/blocksFactoryManager.h \
	$$PWD/include/interpreterCore/managers/blocksFactoryManagerInterface.h \
	$$PWD/include/interpreterCore/managers/graphicsWatcherManager.h \
	$$PWD/include/interpreterCore/managers/kitPluginManager.h \
	$$PWD/include/interpreterCore/managers/robotModelManager.h \
	$$PWD/include/interpreterCore/managers/devicesConfigurationManager.h \
	$$PWD/include/interpreterCore/managers/paletteUpdateManager.h \
	$$PWD/include/interpreterCore/managers/kitAutoSwitcher.h \
	$$PWD/include/interpreterCore/customizer.h \
	$$PWD/include/interpreterCore/defaultRobotModel.h \
	$$PWD/include/interpreterCore/interpreter/blockInterpreter.h \
	$$PWD/include/interpreterCore/interpreter/proxyInterpreter.h \
	$$PWD/include/interpreterCore/interpreter/details/autoconfigurer.h \
	$$PWD/include/interpreterCore/interpreter/details/blocksTable.h \
	$$PWD/include/interpreterCore/interpreter/details/sensorVariablesUpdater.h \
	$$PWD/include/interpreterCore/textLanguage/robotsBlockParser.h \
	$$PWD/src/coreBlocks/coreBlocksFactory.h \
	$$PWD/src/coreBlocks/details/timerBlock.h \
	$$PWD/src/coreBlocks/details/printTextBlock.h \
	$$PWD/src/coreBlocks/details/clearScreenBlock.h \
	$$PWD/src/managers/uiManager.h \
	$$PWD/src/managers/exerciseExportManager.h \
	$$PWD/src/ui/exerciseExportDialog.h \
	$$PWD/src/ui/robotsSettingsPage.h \
	$$PWD/src/ui/modeStripe.h \
	$$PWD/include/interpreterCore/interpreter/qtsinterpreter.h \
	$$PWD/include/interpreterCore/interpreter/trikbrick.h

SOURCES += \
	$$PWD/src/customizer.cpp \
	$$PWD/src/defaultRobotModel.cpp \
	$$PWD/src/robotsPluginFacade.cpp \
	$$PWD/src/coreBlocks/coreBlocksFactory.cpp \
	$$PWD/src/coreBlocks/details/timerBlock.cpp \
	$$PWD/src/coreBlocks/details/printTextBlock.cpp \
	$$PWD/src/coreBlocks/details/clearScreenBlock.cpp \
<<<<<<< 5424777f1508a8645e3e3a26c5b4ae3a05da46da
	$$PWD/src/interpreter/interpreter.cpp \
	$$PWD/src/interpreter/proxyInterpreter.cpp \
=======
	$$PWD/src/interpreter/blockInterpreter.cpp \
>>>>>>> Some ugly stuff (groundwork)
	$$PWD/src/interpreter/details/autoconfigurer.cpp \
	$$PWD/src/interpreter/details/blocksTable.cpp \
	$$PWD/src/interpreter/details/sensorVariablesUpdater.cpp \
	$$PWD/src/managers/actionsManager.cpp \
	$$PWD/src/managers/blocksFactoryManager.cpp \
	$$PWD/src/managers/devicesConfigurationManager.cpp \
	$$PWD/src/managers/uiManager.cpp \
	$$PWD/src/managers/exerciseExportManager.cpp \
	$$PWD/src/managers/graphicsWatcherManager.cpp \
	$$PWD/src/managers/kitAutoSwitcher.cpp \
	$$PWD/src/managers/kitPluginManager.cpp \
	$$PWD/src/managers/paletteUpdateManager.cpp \
	$$PWD/src/managers/robotModelManager.cpp \
	$$PWD/src/managers/saveConvertionManager.cpp \
	$$PWD/src/textLanguage/robotsBlockParser.cpp \
	$$PWD/src/ui/exerciseExportDialog.cpp \
	$$PWD/src/ui/robotsSettingsPage.cpp \
	$$PWD/src/ui/modeStripe.cpp \
	$$PWD/src/interpreter/qtsinterpreter.cpp

FORMS += \
	$$PWD/src/ui/robotsSettingsPage.ui \

TRANSLATIONS += \
	$$PWD/../../../../qrtranslations/ru/plugins/robots/interpreterCore_ru.ts \
	$$PWD/../../../../qrtranslations/fr/plugins/robots/interpreterCore_fr.ts \

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

# Copyright 2013-2016 CyberTech Labs Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

QT += svg xml widgets

includes(plugins/robots/interpreters/interpreterCore \
		plugins/robots/common/kitBase \
		plugins/robots/common/twoDModel \
		plugins/robots/utils \
		qrtext \
		plugins/robots/thirdparty/trikRuntime/trikControl \
		plugins/robots/thirdparty/trikRuntime/trikNetwork \
)

#LIBS += ../../thirdparty/trikRuntime/trikControl/

links(qrkernel qrrepo qrutils qrtext qrgui-models qrgui-controller qrgui-preferences-dialog qrgui-plugin-manager \
		qrgui-tool-plugin-interface robots-kit-base robots-utils robots-2d-model qslog \
		trikControl trikScriptRunner\
)

HEADERS += \
	$$PWD/include/interpreterCore/robotsPluginFacade.h \
	$$PWD/include/interpreterCore/managers/actionsManager.h \
	$$PWD/include/interpreterCore/managers/saveConvertionManager.h \
	$$PWD/include/interpreterCore/managers/blocksFactoryManager.h \
	$$PWD/include/interpreterCore/managers/blocksFactoryManagerInterface.h \
	$$PWD/include/interpreterCore/managers/graphicsWatcherManager.h \
	$$PWD/include/interpreterCore/managers/kitPluginManager.h \
	$$PWD/include/interpreterCore/managers/robotModelManager.h \
	$$PWD/include/interpreterCore/managers/devicesConfigurationManager.h \
	$$PWD/include/interpreterCore/managers/paletteUpdateManager.h \
	$$PWD/include/interpreterCore/managers/kitAutoSwitcher.h \
	$$PWD/include/interpreterCore/customizer.h \
	$$PWD/include/interpreterCore/defaultRobotModel.h \
	$$PWD/include/interpreterCore/interpreter/blockInterpreter.h \
	$$PWD/include/interpreterCore/interpreter/proxyInterpreter.h \
	$$PWD/include/interpreterCore/interpreter/details/autoconfigurer.h \
	$$PWD/include/interpreterCore/interpreter/details/blocksTable.h \
	$$PWD/include/interpreterCore/interpreter/details/sensorVariablesUpdater.h \
	$$PWD/include/interpreterCore/textLanguage/robotsBlockParser.h \
	$$PWD/src/coreBlocks/coreBlocksFactory.h \
	$$PWD/src/coreBlocks/details/timerBlock.h \
	$$PWD/src/coreBlocks/details/printTextBlock.h \
	$$PWD/src/coreBlocks/details/clearScreenBlock.h \
	$$PWD/src/managers/uiManager.h \
	$$PWD/src/managers/exerciseExportManager.h \
	$$PWD/src/ui/exerciseExportDialog.h \
	$$PWD/src/ui/robotsSettingsPage.h \
	$$PWD/src/ui/modeStripe.h \
    $$PWD/include/interpreterCore/interpreter/qtsinterpreter.h \
    $$PWD/include/interpreterCore/interpreter/trikbrick.h

SOURCES += \
	$$PWD/src/customizer.cpp \
	$$PWD/src/defaultRobotModel.cpp \
	$$PWD/src/robotsPluginFacade.cpp \
	$$PWD/src/coreBlocks/coreBlocksFactory.cpp \
	$$PWD/src/coreBlocks/details/timerBlock.cpp \
	$$PWD/src/coreBlocks/details/printTextBlock.cpp \
	$$PWD/src/coreBlocks/details/clearScreenBlock.cpp \
<<<<<<< 5424777f1508a8645e3e3a26c5b4ae3a05da46da
	$$PWD/src/interpreter/interpreter.cpp \
	$$PWD/src/interpreter/proxyInterpreter.cpp \
=======
	$$PWD/src/interpreter/blockInterpreter.cpp \
>>>>>>> Some ugly stuff (groundwork)
	$$PWD/src/interpreter/details/autoconfigurer.cpp \
	$$PWD/src/interpreter/details/blocksTable.cpp \
	$$PWD/src/interpreter/details/sensorVariablesUpdater.cpp \
	$$PWD/src/managers/actionsManager.cpp \
	$$PWD/src/managers/blocksFactoryManager.cpp \
	$$PWD/src/managers/devicesConfigurationManager.cpp \
	$$PWD/src/managers/uiManager.cpp \
	$$PWD/src/managers/exerciseExportManager.cpp \
	$$PWD/src/managers/graphicsWatcherManager.cpp \
	$$PWD/src/managers/kitAutoSwitcher.cpp \
	$$PWD/src/managers/kitPluginManager.cpp \
	$$PWD/src/managers/paletteUpdateManager.cpp \
	$$PWD/src/managers/robotModelManager.cpp \
	$$PWD/src/managers/saveConvertionManager.cpp \
	$$PWD/src/textLanguage/robotsBlockParser.cpp \
	$$PWD/src/ui/exerciseExportDialog.cpp \
	$$PWD/src/ui/robotsSettingsPage.cpp \
	$$PWD/src/ui/modeStripe.cpp \
	$$PWD/src/interpreter/qtsinterpreter.cpp

FORMS += \
	$$PWD/src/ui/robotsSettingsPage.ui \

TRANSLATIONS += \
	$$PWD/../../../../qrtranslations/ru/plugins/robots/interpreterCore_ru.ts \
	$$PWD/../../../../qrtranslations/fr/plugins/robots/interpreterCore_fr.ts \

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