Turned back on warning about deprecated register keyword, as we fixed 3party code which caused it.

# This file is a template commmon for all qmake projects.
#
# To use it, define ROOT_DIR variable and include($$ROOT_DIR/common.pri)

#CONFIG *= drape

drape {
  DEFINES *= USE_DRAPE
}

CONFIG(map_designer) {
  DEFINES *= STANDALONE_APP
  DEFINES *= BUILD_DESIGNER
}

# our own version variables
VERSION_MAJOR = 2
VERSION_MINOR = 4

# qt's variable
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}

# ROOT_DIR is in INCLUDEPATH now according to the new include policy.
INCLUDEPATH *= $$ROOT_DIR
# Do not set DEPENDPATH - it causes rebuild all with minor changes.
#DEPENDPATH  *= $$ROOT_DIR
INCLUDEPATH *= $$ROOT_DIR/3party/boost
INCLUDEPATH *= $$ROOT_DIR/3party/glm

# Hack for Qt5 qmake to make it much faster.
# Turns off any external headers modification check (see DEPENDPATH).
# Do not remove depend_includepath in CONFIG. Need to check modifications within ROOT_DIR.
#CONFIG -= depend_includepath

CONFIG *= c++11

# Automatically enable release config for production
CONFIG(production) {
  CONFIG *= release
}

CONFIG(release, debug|release) {
  DEFINES *= RELEASE _RELEASE NDEBUG
  CONFIG(production) {
    CONFIG_NAME = production
  } else {
    CONFIG_NAME = release
  }
} else {
  DEFINES *= DEBUG _DEBUG
  CONFIG_NAME = debug
}

BINARIES_PATH = $$ROOT_DIR/out/$$CONFIG_NAME
TEMP_PATH = $$ROOT_DIR/out/$$CONFIG_NAME/tmp/$$TARGET

DESTDIR = $$BINARIES_PATH
OBJECTS_DIR = $$TEMP_PATH
RCC_DIR = $$TEMP_PATH
MOC_DIR = $$TEMP_PATH
UI_DIR = $$TEMP_PATH

QMAKE_LIBDIR = $$BINARIES_PATH $$QMAKE_LIBDIR

# By default, do not include base QT classes in any project.
QT -= core gui

# Libraries' dependencies hack.
win32-msvc* {
  LIB_EXT = .lib
  LIB_PREFIX =
}
unix|win32-g++|tizen* {
 LIB_EXT = .a
 LIB_PREFIX = lib
}

# Add libraries' dependencies.
for(project, DEPENDENCIES) {
  PRE_TARGETDEPS += $$BINARIES_PATH/$$LIB_PREFIX$$project$$LIB_EXT
  LIBS += -l$$project
}

#INCLUDEPATH += $$ROOT_DIR/3party/protobuf/src/

# Windows-specific options for all projects
win32 {
  DEFINES += _WIN32_WINNT=0x0501
  DEFINES += WINVER=0x0501
  DEFINES += _WIN32_IE=0x0501
  DEFINES += WIN32_LEAN_AND_MEAN=1
  DEFINES += NTDDI_VERSION=0x05010000
  LIBS *= -lShell32
}

win32-msvc* {
  QMAKE_CLEAN += *.user
  DEFINES += _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS NOMINMAX NO_MIN_MAX BOOST_ALL_NO_LIB
  QMAKE_CXXFLAGS += /Zi /fp:fast
  QMAKE_CFLAGS += /Zi /fp:fast

  QMAKE_CXXFLAGS_RELEASE -= /O2
  # don't set -GL - bug in msvc2008
  QMAKE_CXXFLAGS_RELEASE += /Ox /GF
  # don't set /LTCG - bug in msvc2008
  QMAKE_LFLAGS_RELEASE += /MACHINE:X86

  QMAKE_LFLAGS *= /OPT:REF
  QMAKE_LFLAGS_RELEASE *= /OPT:REF,ICF
  QMAKE_LFLAGS_DEBUG *= /OPT:NOICF

  CONFIG(release, debug|release) {
    DEFINES += _SECURE_SCL=0
  }
}

win32-msvc201* {
  # disable tr1 and c++0x features to avoid build errors
#  DEFINES += _HAS_CPP0X=0
#  DEFINES += BOOST_NO_CXX11_HDR_ARRAY BOOST_NO_CXX11_HDR_TYPEINDEX BOOST_NO_CXX11_SMART_PTR
  QMAKE_CFLAGS *= /wd4100
  QMAKE_CXXFLAGS *= /wd4100
  QMAKE_CFLAGS_RELEASE += /GL
  QMAKE_CXXFLAGS_RELEASE += /GL
  QMAKE_LFLAGS_RELEASE += /LTCG
  QMAKE_LIB += /LTCG
}

# unix also works for Android
unix|win32-g++ {
  LIBS *= -lz
  QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare -Wno-strict-aliasing -Wno-unused-parameter

  # -Wno-unused-local-typedef is not supported on clang 3.5.
  IS_CLANG35 = $$system( echo | $$QMAKE_CXX -dM -E - | grep '__clang_version__.*3\.5.*' )
  if (isEmpty(IS_CLANG35)){
    QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef
  }

  *-clang {
    QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-conversion -Werror=return-type
  }

tizen{
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE += -O1
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE += -O1
  QMAKE_CFLAGS_RELEASE *= -ffast-math
  QMAKE_CXXFLAGS_RELEASE *= -ffast-math
} else {
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE += -O3
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE += -O3
  QMAKE_CFLAGS_RELEASE *= -ffast-math
  QMAKE_CXXFLAGS_RELEASE *= -ffast-math
}

}

linux-* {
  QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_LFLAGS *= -Wl,--gc-sections -Wl,-Bsymbolic-functions
  linux-g++* {
    QMAKE_CFLAGS_RELEASE *= -ffloat-store
    QMAKE_CXXFLAGS_RELEASE *= -ffloat-store
  }
  # debian build requirements
  CONFIG(production) {
    QMAKE_CFLAGS_RELEASE = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
    QMAKE_CXXFLAGS_RELEASE = -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
    QMAKE_LFLAGS *= -Wl,-z,relro
  }

}

android-g++ {
  QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_LFLAGS *= -Wl,--gc-sections
}

win32-g++ {
  QMAKE_CFLAGS *= -Wextra
  QMAKE_CXXFLAGS *= -Wextra
  QMAKE_LFLAGS *= -s
  QMAKE_LFLAGS_RELEASE *= -O
  LIBS *= -lpthread
}

macx-* {
  QMAKE_LFLAGS *= -dead_strip
  LIBS *= "-framework Foundation"

#  macx-clang {
#    QMAKE_CFLAGS_RELEASE -= -O3
#    QMAKE_CFLAGS_RELEASE += -O4 -flto
#    QMAKE_CXXFLAGS_RELEASE -= -O3
#    QMAKE_CXXFLAGS_RELEASE += -O4 -flto
#    QMAKE_LFLAGS_RELEASE += -O4 -flto
#  }
}

CONFIG(production) {
  DEFINES += OMIM_PRODUCTION
} else {
  # enable debugging information for non-production release builds
  unix|win32-g++ {
    QMAKE_CFLAGS_RELEASE += -g
    QMAKE_CXXFLAGS_RELEASE += -g
  } win32-msvc* {
    QMAKE_LFLAGS += /PDB:$${DESTDIR}/$${TARGET}.pdb /DEBUG
  }
}

# Fix boost compilation error
win32* {
    QMAKE_MOC = $$[QT_INSTALL_BINS]/moc.exe -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
} else {
    QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
}

# Include with private variables.
HEADERS += \
  $$ROOT_DIR/private.h

# Standard includes wrappers.
HEADERS += \
  $$ROOT_DIR/std/algorithm.hpp \
  $$ROOT_DIR/std/array.hpp \
  $$ROOT_DIR/std/atomic.hpp \
  $$ROOT_DIR/std/auto_ptr.hpp \
  $$ROOT_DIR/std/bind.hpp \
  $$ROOT_DIR/std/bitset.hpp \
  $$ROOT_DIR/std/cctype.hpp \
  $$ROOT_DIR/std/cerrno.hpp \
  $$ROOT_DIR/std/chrono.hpp \
  $$ROOT_DIR/std/cmath.hpp \
  $$ROOT_DIR/std/complex.hpp \
  $$ROOT_DIR/std/condition_variable.hpp \
  $$ROOT_DIR/std/cstdarg.hpp \
  $$ROOT_DIR/std/cstdint.hpp \
  $$ROOT_DIR/std/cstdio.hpp \
  $$ROOT_DIR/std/cstdlib.hpp \
  $$ROOT_DIR/std/cstring.hpp \
  $$ROOT_DIR/std/ctime.hpp \
  $$ROOT_DIR/std/deque.hpp \
  $$ROOT_DIR/std/errno.hpp \
  $$ROOT_DIR/std/exception.hpp \
  $$ROOT_DIR/std/fstream.hpp \
  $$ROOT_DIR/std/function.hpp \
  $$ROOT_DIR/std/functional.hpp \
  $$ROOT_DIR/std/initializer_list.hpp \
  $$ROOT_DIR/std/iomanip.hpp \
  $$ROOT_DIR/std/ios.hpp \
  $$ROOT_DIR/std/iostream.hpp \
  $$ROOT_DIR/std/iterator.hpp \
  $$ROOT_DIR/std/iterator_facade.hpp \
  $$ROOT_DIR/std/limits.hpp \
  $$ROOT_DIR/std/list.hpp \
  $$ROOT_DIR/std/map.hpp \
  $$ROOT_DIR/std/msvc_cpp11_workarounds.hpp \
  $$ROOT_DIR/std/mutex.hpp \
  $$ROOT_DIR/std/noncopyable.hpp \
  $$ROOT_DIR/std/numeric.hpp \
  $$ROOT_DIR/std/queue.hpp \
  $$ROOT_DIR/std/set.hpp \
  $$ROOT_DIR/std/shared_array.hpp \
  $$ROOT_DIR/std/shared_ptr.hpp \
  $$ROOT_DIR/std/sstream.hpp \
  $$ROOT_DIR/std/stack.hpp \
  $$ROOT_DIR/std/string.hpp \
  $$ROOT_DIR/std/systime.hpp \
  $$ROOT_DIR/std/target_os.hpp \
  $$ROOT_DIR/std/thread.hpp \
  $$ROOT_DIR/std/transform_iterator.hpp \
  $$ROOT_DIR/std/tuple.hpp \
  $$ROOT_DIR/std/type_traits.hpp \
  $$ROOT_DIR/std/typeinfo.hpp \
  $$ROOT_DIR/std/unique_ptr.hpp \
  $$ROOT_DIR/std/unordered_map.hpp \
  $$ROOT_DIR/std/unordered_set.hpp \
  $$ROOT_DIR/std/utility.hpp \
  $$ROOT_DIR/std/vector.hpp \
  $$ROOT_DIR/std/weak_ptr.hpp \
  $$ROOT_DIR/std/windows.hpp \

# This file is a template commmon for all qmake projects.
#
# To use it, define ROOT_DIR variable and include($$ROOT_DIR/common.pri)

#CONFIG *= drape

drape {
  DEFINES *= USE_DRAPE
}

CONFIG(map_designer) {
  DEFINES *= STANDALONE_APP
  DEFINES *= BUILD_DESIGNER
}

# our own version variables
VERSION_MAJOR = 2
VERSION_MINOR = 4

# qt's variable
VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}

# ROOT_DIR is in INCLUDEPATH now according to the new include policy.
INCLUDEPATH *= $$ROOT_DIR
# Do not set DEPENDPATH - it causes rebuild all with minor changes.
#DEPENDPATH  *= $$ROOT_DIR
INCLUDEPATH *= $$ROOT_DIR/3party/boost
INCLUDEPATH *= $$ROOT_DIR/3party/glm

# Hack for Qt5 qmake to make it much faster.
# Turns off any external headers modification check (see DEPENDPATH).
# Do not remove depend_includepath in CONFIG. Need to check modifications within ROOT_DIR.
#CONFIG -= depend_includepath

CONFIG *= c++11

# Automatically enable release config for production
CONFIG(production) {
  CONFIG *= release
}

CONFIG(release, debug|release) {
  DEFINES *= RELEASE _RELEASE NDEBUG
  CONFIG(production) {
    CONFIG_NAME = production
  } else {
    CONFIG_NAME = release
  }
} else {
  DEFINES *= DEBUG _DEBUG
  CONFIG_NAME = debug
}

BINARIES_PATH = $$ROOT_DIR/out/$$CONFIG_NAME
TEMP_PATH = $$ROOT_DIR/out/$$CONFIG_NAME/tmp/$$TARGET

DESTDIR = $$BINARIES_PATH
OBJECTS_DIR = $$TEMP_PATH
RCC_DIR = $$TEMP_PATH
MOC_DIR = $$TEMP_PATH
UI_DIR = $$TEMP_PATH

QMAKE_LIBDIR = $$BINARIES_PATH $$QMAKE_LIBDIR

# By default, do not include base QT classes in any project.
QT -= core gui

# Libraries' dependencies hack.
win32-msvc* {
  LIB_EXT = .lib
  LIB_PREFIX =
}
unix|win32-g++|tizen* {
 LIB_EXT = .a
 LIB_PREFIX = lib
}

# Add libraries' dependencies.
for(project, DEPENDENCIES) {
  PRE_TARGETDEPS += $$BINARIES_PATH/$$LIB_PREFIX$$project$$LIB_EXT
  LIBS += -l$$project
}

#INCLUDEPATH += $$ROOT_DIR/3party/protobuf/src/

# Windows-specific options for all projects
win32 {
  DEFINES += _WIN32_WINNT=0x0501
  DEFINES += WINVER=0x0501
  DEFINES += _WIN32_IE=0x0501
  DEFINES += WIN32_LEAN_AND_MEAN=1
  DEFINES += NTDDI_VERSION=0x05010000
  LIBS *= -lShell32
}

win32-msvc* {
  QMAKE_CLEAN += *.user
  DEFINES += _SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS NOMINMAX NO_MIN_MAX BOOST_ALL_NO_LIB
  QMAKE_CXXFLAGS += /Zi /fp:fast
  QMAKE_CFLAGS += /Zi /fp:fast

  QMAKE_CXXFLAGS_RELEASE -= /O2
  # don't set -GL - bug in msvc2008
  QMAKE_CXXFLAGS_RELEASE += /Ox /GF
  # don't set /LTCG - bug in msvc2008
  QMAKE_LFLAGS_RELEASE += /MACHINE:X86

  QMAKE_LFLAGS *= /OPT:REF
  QMAKE_LFLAGS_RELEASE *= /OPT:REF,ICF
  QMAKE_LFLAGS_DEBUG *= /OPT:NOICF

  CONFIG(release, debug|release) {
    DEFINES += _SECURE_SCL=0
  }
}

win32-msvc201* {
  # disable tr1 and c++0x features to avoid build errors
#  DEFINES += _HAS_CPP0X=0
#  DEFINES += BOOST_NO_CXX11_HDR_ARRAY BOOST_NO_CXX11_HDR_TYPEINDEX BOOST_NO_CXX11_SMART_PTR
  QMAKE_CFLAGS *= /wd4100
  QMAKE_CXXFLAGS *= /wd4100
  QMAKE_CFLAGS_RELEASE += /GL
  QMAKE_CXXFLAGS_RELEASE += /GL
  QMAKE_LFLAGS_RELEASE += /LTCG
  QMAKE_LIB += /LTCG
}

# unix also works for Android
unix|win32-g++ {
  LIBS *= -lz
  QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare -Wno-strict-aliasing -Wno-unused-parameter

  # -Wno-unused-local-typedef is not supported on clang 3.5.
  IS_CLANG35 = $$system( echo | $$QMAKE_CXX -dM -E - | grep '__clang_version__.*3\.5.*' )
  if (isEmpty(IS_CLANG35)){
    QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef
  }

  *-clang {
    QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-conversion -Werror=return-type -Wno-deprecated-register
  }

tizen{
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE += -O1
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE += -O1
  QMAKE_CFLAGS_RELEASE *= -ffast-math
  QMAKE_CXXFLAGS_RELEASE *= -ffast-math
} else {
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE += -O3
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE += -O3
  QMAKE_CFLAGS_RELEASE *= -ffast-math
  QMAKE_CXXFLAGS_RELEASE *= -ffast-math
}

}

linux-* {
  QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_LFLAGS *= -Wl,--gc-sections -Wl,-Bsymbolic-functions
  linux-g++* {
    QMAKE_CFLAGS_RELEASE *= -ffloat-store
    QMAKE_CXXFLAGS_RELEASE *= -ffloat-store
  }
  # debian build requirements
  CONFIG(production) {
    QMAKE_CFLAGS_RELEASE = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
    QMAKE_CXXFLAGS_RELEASE = -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
    QMAKE_LFLAGS *= -Wl,-z,relro
  }

}

android-g++ {
  QMAKE_CFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_CXXFLAGS *= -fdata-sections -ffunction-sections
  QMAKE_LFLAGS *= -Wl,--gc-sections
}

win32-g++ {
  QMAKE_CFLAGS *= -Wextra
  QMAKE_CXXFLAGS *= -Wextra
  QMAKE_LFLAGS *= -s
  QMAKE_LFLAGS_RELEASE *= -O
  LIBS *= -lpthread
}

macx-* {
  QMAKE_LFLAGS *= -dead_strip
  LIBS *= "-framework Foundation"

#  macx-clang {
#    QMAKE_CFLAGS_RELEASE -= -O3
#    QMAKE_CFLAGS_RELEASE += -O4 -flto
#    QMAKE_CXXFLAGS_RELEASE -= -O3
#    QMAKE_CXXFLAGS_RELEASE += -O4 -flto
#    QMAKE_LFLAGS_RELEASE += -O4 -flto
#  }
}

CONFIG(production) {
  DEFINES += OMIM_PRODUCTION
} else {
  # enable debugging information for non-production release builds
  unix|win32-g++ {
    QMAKE_CFLAGS_RELEASE += -g
    QMAKE_CXXFLAGS_RELEASE += -g
  } win32-msvc* {
    QMAKE_LFLAGS += /PDB:$${DESTDIR}/$${TARGET}.pdb /DEBUG
  }
}

# Fix boost compilation error
win32* {
    QMAKE_MOC = $$[QT_INSTALL_BINS]/moc.exe -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
} else {
    QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED
}

# Include with private variables.
HEADERS += \
  $$ROOT_DIR/private.h

# Standard includes wrappers.
HEADERS += \
  $$ROOT_DIR/std/algorithm.hpp \
  $$ROOT_DIR/std/array.hpp \
  $$ROOT_DIR/std/atomic.hpp \
  $$ROOT_DIR/std/auto_ptr.hpp \
  $$ROOT_DIR/std/bind.hpp \
  $$ROOT_DIR/std/bitset.hpp \
  $$ROOT_DIR/std/cctype.hpp \
  $$ROOT_DIR/std/cerrno.hpp \
  $$ROOT_DIR/std/chrono.hpp \
  $$ROOT_DIR/std/cmath.hpp \
  $$ROOT_DIR/std/complex.hpp \
  $$ROOT_DIR/std/condition_variable.hpp \
  $$ROOT_DIR/std/cstdarg.hpp \
  $$ROOT_DIR/std/cstdint.hpp \
  $$ROOT_DIR/std/cstdio.hpp \
  $$ROOT_DIR/std/cstdlib.hpp \
  $$ROOT_DIR/std/cstring.hpp \
  $$ROOT_DIR/std/ctime.hpp \
  $$ROOT_DIR/std/deque.hpp \
  $$ROOT_DIR/std/errno.hpp \
  $$ROOT_DIR/std/exception.hpp \
  $$ROOT_DIR/std/fstream.hpp \
  $$ROOT_DIR/std/function.hpp \
  $$ROOT_DIR/std/functional.hpp \
  $$ROOT_DIR/std/initializer_list.hpp \
  $$ROOT_DIR/std/iomanip.hpp \
  $$ROOT_DIR/std/ios.hpp \
  $$ROOT_DIR/std/iostream.hpp \
  $$ROOT_DIR/std/iterator.hpp \
  $$ROOT_DIR/std/iterator_facade.hpp \
  $$ROOT_DIR/std/limits.hpp \
  $$ROOT_DIR/std/list.hpp \
  $$ROOT_DIR/std/map.hpp \
  $$ROOT_DIR/std/msvc_cpp11_workarounds.hpp \
  $$ROOT_DIR/std/mutex.hpp \
  $$ROOT_DIR/std/noncopyable.hpp \
  $$ROOT_DIR/std/numeric.hpp \
  $$ROOT_DIR/std/queue.hpp \
  $$ROOT_DIR/std/set.hpp \
  $$ROOT_DIR/std/shared_array.hpp \
  $$ROOT_DIR/std/shared_ptr.hpp \
  $$ROOT_DIR/std/sstream.hpp \
  $$ROOT_DIR/std/stack.hpp \
  $$ROOT_DIR/std/string.hpp \
  $$ROOT_DIR/std/systime.hpp \
  $$ROOT_DIR/std/target_os.hpp \
  $$ROOT_DIR/std/thread.hpp \
  $$ROOT_DIR/std/transform_iterator.hpp \
  $$ROOT_DIR/std/tuple.hpp \
  $$ROOT_DIR/std/type_traits.hpp \
  $$ROOT_DIR/std/typeinfo.hpp \
  $$ROOT_DIR/std/unique_ptr.hpp \
  $$ROOT_DIR/std/unordered_map.hpp \
  $$ROOT_DIR/std/unordered_set.hpp \
  $$ROOT_DIR/std/utility.hpp \
  $$ROOT_DIR/std/vector.hpp \
  $$ROOT_DIR/std/weak_ptr.hpp \
  $$ROOT_DIR/std/windows.hpp \


fixing dcp tests

fixing dcp tests

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

INCLUDEPATH +=/usr/include/dui ../doubles

SRCDIR = ./../../src

DEPENDPATH = $$INCLUDEPATH

QMAKE_LIBDIR += ../../../lib/lib/ /usr/lib/
LIBDCPINCLUDE=../../../lib/src/include
CONFIG += debug

QT += testlib

TEMPLATE = app

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

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

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


Added parser files to qmake project file

SOURCES += \
        $$PWD/csobject.cpp \
        $$PWD/Token.cpp \
        $$PWD/Parser.cpp \
        $$PWD/Scope.cpp \
        $$PWD/Variant.cpp

HEADERS += \
        $$PWD/csobject.h \
        $$PWD/csstring.h \
        $$PWD/cstypes.h \
        $$PWD/Token.h \
        $$PWD/Tokenizer.h \
        $$PWD/Parser.h \
        $$PWD/Scope.h \
        $$PWD/Variant.h

SOURCES += \
        $$PWD/csobject.cpp \
        $$PWD/Token.cpp \
        $$PWD/Scope.cpp \
        $$PWD/Variant.cpp

HEADERS += \
        $$PWD/csobject.h \
        $$PWD/csstring.h \
        $$PWD/cstypes.h \
        $$PWD/Token.h \
        $$PWD/Tokenizer.h \
        $$PWD/Scope.h \
        $$PWD/Variant.h


Removing forced Mac OS SDK.

Removing forced Mac OS SDK.

# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2014 QGroundControl Developers
# License terms set in COPYING.md
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains initial CONFIG tag setup and compiler settings.
#

# Setup our supported build types. We do this once here and then use the defined config scopes
# to allow us to easily modify suported build types in one place instead of duplicated throughout
# the project file.

linux {
    linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
        message("Linux build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS
        linux-clang {
            message("Linux clang")
            QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
        }
    } else : linux-rasp-pi2-g++ {
        message("Linux R-Pi2 build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
    } else : android-g++ {
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_BLUETOOTH
        target.path = $$DESTDIR
        equals(ANDROID_TARGET_ARCH, x86)  {
            CONFIG += Androidx86Build
            DEFINES += __androidx86__
            DEFINES += QGC_DISABLE_UVC
            message("Android x86 build")
        } else {
            message("Android Arm build")
        }
    } else {
        error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
    }
} else : win32 {
    win32-msvc2010 | win32-msvc2012 | win32-msvc2013 {
        message("Windows build")
        CONFIG += WindowsBuild
        DEFINES += __STDC_LIMIT_MACROS
    } else {
        error("Unsupported Windows toolchain, only Visual Studio 2010, 2012, and 2013 are supported")
    }
} else : macx {
    macx-clang | macx-llvm {
        message("Mac build")
        CONFIG += MacBuild
        DEFINES += __macos__
        CONFIG += x86_64
        CONFIG -= x86
        equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
        } else {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
        }
        #-- Not forcing anything. Let qmake find the latest, installed SDK.
        #QMAKE_MAC_SDK = macosx10.12
        QMAKE_CXXFLAGS += -fvisibility=hidden
    } else {
        error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
    }
} else : ios {
    !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
        error("Unsupported Qt version, 5.5.x or greater is required for iOS")
    }
    message("iOS build")
    CONFIG += iOSBuild MobileBuild app_bundle
    DEFINES += __ios__
    DEFINES += QGC_NO_GOOGLE_MAPS
    QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
    QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
    QMAKE_LFLAGS += -Wl,-no_pie
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

# Enable ccache where we can
linux|macx|ios {
    system(which ccache) {
        message("Found ccache, enabling")
        !ios {
            QMAKE_CXX = ccache $$QMAKE_CXX
            QMAKE_CC  = ccache $$QMAKE_CC
        } else {
            QMAKE_CXX = $$PWD/tools/iosccachecc.sh
            QMAKE_CC  = $$PWD/tools/iosccachecxx.sh
        }
    }
}

MobileBuild {
    DEFINES += __mobile__
}

# set the QGC version from git

exists ($$PWD/.git) {
    GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
    GIT_BRANCH   = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
    GIT_HASH     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
    GIT_TIME     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)

    # determine if we're on a tag matching vX.Y.Z (stable release)
    contains(GIT_DESCRIBE, v[0-9].[0-9].[0-9]) {
        # release version "vX.Y.Z"
        GIT_VERSION = $${GIT_DESCRIBE}
    } else {
        # development version "Development branch:sha date"
        GIT_VERSION = "Development $${GIT_BRANCH}:$${GIT_HASH} $${GIT_TIME}"
    }

    VERSION      = $$replace(GIT_DESCRIBE, "v", "")
    VERSION      = $$replace(VERSION, "-", ".")
    VERSION      = $$section(VERSION, ".", 0, 3)
    MacBuild {
        MAC_VERSION  = $$section(VERSION, ".", 0, 2)
        MAC_BUILD    = $$section(VERSION, ".", 3, 3)
        message(QGroundControl version $${MAC_VERSION} build $${MAC_BUILD} describe $${GIT_VERSION})
    } else {
        message(QGroundControl $${GIT_VERSION})
    }
} else {
    GIT_VERSION     = None
    VERSION         = 0.0.0   # Marker to indicate out-of-tree build
    MAC_VERSION     = 0.0.0
    MAC_BUILD       = 0
}

DEFINES += GIT_VERSION=\"\\\"$$GIT_VERSION\\\"\"
DEFINES += EIGEN_MPL2_ONLY

# Installer configuration

installer {
    CONFIG -= debug
    CONFIG -= debug_and_release
    CONFIG += release
    message(Build Installer)
}

# Setup our supported build flavors

CONFIG(debug, debug|release) {
    message(Debug flavor)
    CONFIG += DebugBuild
} else:CONFIG(release, debug|release) {
    message(Release flavor)
    CONFIG += ReleaseBuild
} else {
    error(Unsupported build flavor)
}

# Setup our build directories

BASEDIR      = $$IN_PWD

!iOSBuild {
    OBJECTS_DIR  = $${OUT_PWD}/obj
    MOC_DIR      = $${OUT_PWD}/moc
    UI_DIR       = $${OUT_PWD}/ui
    RCC_DIR      = $${OUT_PWD}/rcc
}

LANGUAGE = C++

LOCATION_PLUGIN_DESTDIR = $${OUT_PWD}/src/QtLocationPlugin
LOCATION_PLUGIN_NAME    = QGeoServiceProviderFactoryQGC

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

#
# By default warnings as errors are turned off. Even so, in order for a pull request
# to be accepted you must compile cleanly with warnings as errors turned on the default
# set of OS builds. See http://www.qgroundcontrol.org/dev/contribute for more details.
# You can use the WarningsAsErrorsOn CONFIG switch to turn warnings as errors on for your
# own builds.
#

MacBuild | LinuxBuild {
    QMAKE_CXXFLAGS_WARN_ON += -Wall
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += -Werror
    }
    MacBuild {
        # Latest clang version has a buggy check for this which cause Qt headers to throw warnings on qmap.h
        QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
    }
}

WindowsBuild {
    QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot
        /wd4005 \   # silence warnings about macro redefinition
        /wd4290     # ignore exception specifications

    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG
    CONFIG += force_debug_info  # Enable debugging symbols on release builds
    !iOSBuild {
        CONFIG += ltcg              # Turn on link time code generation
    }

    WindowsBuild {
        # Enable function level linking and enhanced optimized debugging
        QMAKE_CFLAGS_RELEASE   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE += /Gy /Zo
        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo

        # Eliminate duplicate COMDATs
        QMAKE_LFLAGS_RELEASE += /OPT:ICF
        QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /OPT:ICF
    }
}

#
# Unit Test specific configuration goes here
#

DebugBuild {
    DEFINES += UNITTEST_BUILD
}

# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2014 QGroundControl Developers
# License terms set in COPYING.md
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains initial CONFIG tag setup and compiler settings.
#

# Setup our supported build types. We do this once here and then use the defined config scopes
# to allow us to easily modify suported build types in one place instead of duplicated throughout
# the project file.

linux {
    linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
        message("Linux build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS
        linux-clang {
            message("Linux clang")
            QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
        }
    } else : linux-rasp-pi2-g++ {
        message("Linux R-Pi2 build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
    } else : android-g++ {
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_BLUETOOTH
        target.path = $$DESTDIR
        equals(ANDROID_TARGET_ARCH, x86)  {
            CONFIG += Androidx86Build
            DEFINES += __androidx86__
            DEFINES += QGC_DISABLE_UVC
            message("Android x86 build")
        } else {
            message("Android Arm build")
        }
    } else {
        error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
    }
} else : win32 {
    win32-msvc2010 | win32-msvc2012 | win32-msvc2013 {
        message("Windows build")
        CONFIG += WindowsBuild
        DEFINES += __STDC_LIMIT_MACROS
    } else {
        error("Unsupported Windows toolchain, only Visual Studio 2010, 2012, and 2013 are supported")
    }
} else : macx {
    macx-clang | macx-llvm {
        message("Mac build")
        CONFIG += MacBuild
        DEFINES += __macos__
        CONFIG += x86_64
        CONFIG -= x86
        equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
        } else {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
        }
        QMAKE_MAC_SDK = macosx10.12
        QMAKE_CXXFLAGS += -fvisibility=hidden
    } else {
        error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
    }
} else : ios {
    !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
        error("Unsupported Qt version, 5.5.x or greater is required for iOS")
    }
    message("iOS build")
    CONFIG += iOSBuild MobileBuild app_bundle
    DEFINES += __ios__
    DEFINES += QGC_NO_GOOGLE_MAPS
    QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
    QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
    QMAKE_LFLAGS += -Wl,-no_pie
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

# Enable ccache where we can
linux|macx|ios {
    system(which ccache) {
        message("Found ccache, enabling")
        !ios {
            QMAKE_CXX = ccache $$QMAKE_CXX
            QMAKE_CC  = ccache $$QMAKE_CC
        } else {
            QMAKE_CXX = $$PWD/tools/iosccachecc.sh
            QMAKE_CC  = $$PWD/tools/iosccachecxx.sh
        }
    }
}

MobileBuild {
    DEFINES += __mobile__
}

# set the QGC version from git

exists ($$PWD/.git) {
    GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
    GIT_BRANCH   = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
    GIT_HASH     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
    GIT_TIME     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)

    # determine if we're on a tag matching vX.Y.Z (stable release)
    contains(GIT_DESCRIBE, v[0-9].[0-9].[0-9]) {
        # release version "vX.Y.Z"
        GIT_VERSION = $${GIT_DESCRIBE}
    } else {
        # development version "Development branch:sha date"
        GIT_VERSION = "Development $${GIT_BRANCH}:$${GIT_HASH} $${GIT_TIME}"
    }

    VERSION      = $$replace(GIT_DESCRIBE, "v", "")
    VERSION      = $$replace(VERSION, "-", ".")
    VERSION      = $$section(VERSION, ".", 0, 3)
    MacBuild {
        MAC_VERSION  = $$section(VERSION, ".", 0, 2)
        MAC_BUILD    = $$section(VERSION, ".", 3, 3)
        message(QGroundControl version $${MAC_VERSION} build $${MAC_BUILD} describe $${GIT_VERSION})
    } else {
        message(QGroundControl $${GIT_VERSION})
    }
} else {
    GIT_VERSION     = None
    VERSION         = 0.0.0   # Marker to indicate out-of-tree build
    MAC_VERSION     = 0.0.0
    MAC_BUILD       = 0
}

DEFINES += GIT_VERSION=\"\\\"$$GIT_VERSION\\\"\"
DEFINES += EIGEN_MPL2_ONLY

# Installer configuration

installer {
    CONFIG -= debug
    CONFIG -= debug_and_release
    CONFIG += release
    message(Build Installer)
}

# Setup our supported build flavors

CONFIG(debug, debug|release) {
    message(Debug flavor)
    CONFIG += DebugBuild
} else:CONFIG(release, debug|release) {
    message(Release flavor)
    CONFIG += ReleaseBuild
} else {
    error(Unsupported build flavor)
}

# Setup our build directories

BASEDIR      = $$IN_PWD

!iOSBuild {
    OBJECTS_DIR  = $${OUT_PWD}/obj
    MOC_DIR      = $${OUT_PWD}/moc
    UI_DIR       = $${OUT_PWD}/ui
    RCC_DIR      = $${OUT_PWD}/rcc
}

LANGUAGE = C++

LOCATION_PLUGIN_DESTDIR = $${OUT_PWD}/src/QtLocationPlugin
LOCATION_PLUGIN_NAME    = QGeoServiceProviderFactoryQGC

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

#
# By default warnings as errors are turned off. Even so, in order for a pull request
# to be accepted you must compile cleanly with warnings as errors turned on the default
# set of OS builds. See http://www.qgroundcontrol.org/dev/contribute for more details.
# You can use the WarningsAsErrorsOn CONFIG switch to turn warnings as errors on for your
# own builds.
#

MacBuild | LinuxBuild {
    QMAKE_CXXFLAGS_WARN_ON += -Wall
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += -Werror
    }
    MacBuild {
        # Latest clang version has a buggy check for this which cause Qt headers to throw warnings on qmap.h
        QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
    }
}

WindowsBuild {
    QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot
        /wd4005 \   # silence warnings about macro redefinition
        /wd4290     # ignore exception specifications

    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG
    CONFIG += force_debug_info  # Enable debugging symbols on release builds
    !iOSBuild {
        CONFIG += ltcg              # Turn on link time code generation
    }

    WindowsBuild {
        # Enable function level linking and enhanced optimized debugging
        QMAKE_CFLAGS_RELEASE   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE += /Gy /Zo
        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo

        # Eliminate duplicate COMDATs
        QMAKE_LFLAGS_RELEASE += /OPT:ICF
        QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /OPT:ICF
    }
}

#
# Unit Test specific configuration goes here
#

DebugBuild {
    DEFINES += UNITTEST_BUILD
}


QmlDesigner: fixing shadow build of fxPlugin

macx {
  DESTDIR = $$IDE_LIBRARY_PATH/QmlDesigner
} else {
  DESTDIR = $$IDE_BUILD_TREE/lib/qmldesigner
}

macx {
  DESTDIR = $$IDE_LIBRARY_PATH/QmlDesigner
} else {
  DESTDIR = $$PWD/../../../../lib/qmldesigner
}


OS-detect.pri: remove Fedora portion, as Fedora's lumina-desktop.spec build file does set all variables on it's own

# =============================================
#  Subroutine for project files to detect which OS is compiling the project
#  Generic variables it sets for internal use: OS, LINUX_DISTRO (if OS=="Linux")
# =============================================
#  Main Build Variables (generally for finding existing files):
# 	PREFIX: 		Base install directory (${PREFIX}/[bin/share/etc/include] will be used)
#	LIBPREFIX: 	Base install directory for libraries (usually ${PREFIX}/lib)
#  Detailed Build Variables for installing files:
#	L_BINDIR:		Directory to install binaries
#	L_LIBDIR:		Directory to install Libraries
#	L_ETCDIR:		Directory to install/use global configs
#	L_SHAREDIR:	Directory to install the general Lumina files
#	L_INCLUDEDIR:	Directory to install include files
#	L_SESSDIR:	Directory to place *.desktop file for starting the Lumina session
#	LRELEASE:	binary path to the Qt lrelease utility (usually auto-set)
# =============================================
# Note: Make sure the OS variable matches the name of a libLumina/LuminaOS-<OS>.cpp file
# =============================================
!defined(OS){
  message("Build OS Info: $${QMAKE_HOST.os}, $${QMAKE_HOST.arch}, $${QMAKE_HOST.version_string}")

  #Load the initial library/includefile search locations (more can be added in the OS-specific sections below)
  LIBS = -L$${PWD}/libLumina -L$$[QT_INSTALL_LIBS]
  INCLUDEPATH = $${PWD}/libLumina $$[QT_INSTALL_HEADERS] $$[QT_INSTALL_PREFIX]

  #Setup the default values for build settings (if not explicitly set previously)
  isEmpty(PREFIX){ PREFIX=/usr/local }
  isEmpty(LIBPREFIX){ LIBPREFIX=$${PREFIX}/lib }

  #Now go through and setup any known OS build settings
  #  which are different from the defaults
  equals(QMAKE_HOST.os, "DragonFly"){
    #Note: DragonFly BSD gets detected as FreeBSD with compiler flags ?
    OS = DragonFly
    LIBS += -L/usr/local/lib -L/usr/lib

  }else : freebsd-*{
    OS = FreeBSD
    LIBS += -L/usr/local/lib -L/usr/lib
     #Use the defaults for everything else

  }else : openbsd-*{
    OS = OpenBSD
    LIBS += -L/usr/local/lib -L/usr/lib
    #Use the defaults for everything else

  }else : netbsd-*{
    OS = NetBSD
    LIBS += -L/usr/local/lib -L/usr/lib
    LIBPREFIX=/usr/local/lib
    #Use the defaults for everything else

  }else : linux-*{
    L_SESSDIR=/usr/share/xsessions
    OS=Linux
    LIBS += -L/usr/local/lib -L/usr/lib -L/lib

    exists(/bin/lsb_release){
      LINUX_DISTRO = $$system(lsb_release -si)
    } else:exists(/usr/bin/lsb_release){
      LINUX_DISTRO = $$system(lsb_release -si)
    }

  }else{
    OS="Unknown";
  }

  MSG="Build Settings Loaded: $${OS}"
  equals(OS,"Linux"){ MSG+="-$${LINUX_DISTRO}" }
  message( $$MSG )

  # Setup the dirs needed to find/load libraries
  QMAKE_LIBDIR =  $${PWD}/libLumina $$[QT_INSTALL_LIBS] $$LIBPREFIX/qt5 $$LIBPREFIX
  INCLUDEPATH +=$${PREFIX}/include

  # If the detailed install variables are not set - create them from the general vars
  isEmpty(L_BINDIR){ L_BINDIR = $${PREFIX}/bin }
  isEmpty(L_LIBDIR){ L_LIBDIR = $${PREFIX}/lib }
  isEmpty(L_ETCDIR){ L_ETCDIR = $${PREFIX}/etc }
  isEmpty(L_SHAREDIR){ L_SHAREDIR = $${PREFIX}/share }
  isEmpty(L_INCLUDEDIR){ L_INCLUDEDIR = $${PREFIX}/include }
  isEmpty(L_SESSDIR){ L_SESSDIR = $${L_SHAREDIR}/xsessions }
  isEmpty(LRELEASE){ LRELEASE = $$[QT_INSTALL_BINS]/lrelease }

  !exists(LRELEASE){ NO_I18N=true } #translations unavailable
  #Now convert any of these path variables into defines for C++ usage
  DEFINES += PREFIX="QString\\\(\\\"$${PREFIX}\\\"\\\)"
  DEFINES += L_ETCDIR="QString\\\(\\\"$${L_ETCDIR}\\\"\\\)"
  DEFINES += L_SHAREDIR="QString\\\(\\\"$${L_SHAREDIR}\\\"\\\)"
}

# =============================================
#  Subroutine for project files to detect which OS is compiling the project
#  Generic variables it sets for internal use: OS, LINUX_DISTRO (if OS=="Linux")
# =============================================
#  Main Build Variables (generally for finding existing files):
# 	PREFIX: 		Base install directory (${PREFIX}/[bin/share/etc/include] will be used)
#	LIBPREFIX: 	Base install directory for libraries (usually ${PREFIX}/lib)
#  Detailed Build Variables for installing files:
#	L_BINDIR:		Directory to install binaries
#	L_LIBDIR:		Directory to install Libraries
#	L_ETCDIR:		Directory to install/use global configs
#	L_SHAREDIR:	Directory to install the general Lumina files
#	L_INCLUDEDIR:	Directory to install include files
#	L_SESSDIR:	Directory to place *.desktop file for starting the Lumina session
#	LRELEASE:	binary path to the Qt lrelease utility (usually auto-set)
# =============================================
# Note: Make sure the OS variable matches the name of a libLumina/LuminaOS-<OS>.cpp file
# =============================================
!defined(OS){
  message("Build OS Info: $${QMAKE_HOST.os}, $${QMAKE_HOST.arch}, $${QMAKE_HOST.version_string}")

  #Load the initial library/includefile search locations (more can be added in the OS-specific sections below)
  LIBS = -L$${PWD}/libLumina -L$$[QT_INSTALL_LIBS]
  INCLUDEPATH = $${PWD}/libLumina $$[QT_INSTALL_HEADERS] $$[QT_INSTALL_PREFIX]

  #Setup the default values for build settings (if not explicitly set previously)
  isEmpty(PREFIX){ PREFIX=/usr/local }
  isEmpty(LIBPREFIX){ LIBPREFIX=$${PREFIX}/lib }

  #Now go through and setup any known OS build settings
  #  which are different from the defaults
  equals(QMAKE_HOST.os, "DragonFly"){
    #Note: DragonFly BSD gets detected as FreeBSD with compiler flags ?
    OS = DragonFly
    LIBS += -L/usr/local/lib -L/usr/lib

  }else : freebsd-*{
    OS = FreeBSD
    LIBS += -L/usr/local/lib -L/usr/lib
     #Use the defaults for everything else

  }else : openbsd-*{
    OS = OpenBSD
    LIBS += -L/usr/local/lib -L/usr/lib
    #Use the defaults for everything else

  }else : netbsd-*{
    OS = NetBSD
    LIBS += -L/usr/local/lib -L/usr/lib
    LIBPREFIX=/usr/local/lib
    #Use the defaults for everything else

  }else : linux-*{
    L_SESSDIR=/usr/share/xsessions
    OS=Linux
    LIBS += -L/usr/local/lib -L/usr/lib -L/lib

    exists(/bin/lsb_release){
      LINUX_DISTRO = $$system(lsb_release -si)
    } else:exists(/usr/bin/lsb_release){
      LINUX_DISTRO = $$system(lsb_release -si)
    }

    #Now switch through known Linux distro templates
    equals(LINUX_DISTRO, "Fedora"){
      equals($${QMAKE_HOST.arch},"amd64"){ L_LIBDIR=/lib64 }
      else{ L_LIBDIR=/lib }
    }

  }else{
    OS="Unknown";
  }

  MSG="Build Settings Loaded: $${OS}"
  equals(OS,"Linux"){ MSG+="-$${LINUX_DISTRO}" }
  message( $$MSG )

  # Setup the dirs needed to find/load libraries
  QMAKE_LIBDIR =  $${PWD}/libLumina $$[QT_INSTALL_LIBS] $$LIBPREFIX/qt5 $$LIBPREFIX
  INCLUDEPATH +=$${PREFIX}/include

  # If the detailed install variables are not set - create them from the general vars
  isEmpty(L_BINDIR){ L_BINDIR = $${PREFIX}/bin }
  isEmpty(L_LIBDIR){ L_LIBDIR = $${PREFIX}/lib }
  isEmpty(L_ETCDIR){ L_ETCDIR = $${PREFIX}/etc }
  isEmpty(L_SHAREDIR){ L_SHAREDIR = $${PREFIX}/share }
  isEmpty(L_INCLUDEDIR){ L_INCLUDEDIR = $${PREFIX}/include }
  isEmpty(L_SESSDIR){ L_SESSDIR = $${L_SHAREDIR}/xsessions }
  isEmpty(LRELEASE){ LRELEASE = $$[QT_INSTALL_BINS]/lrelease }

  !exists(LRELEASE){ NO_I18N=true } #translations unavailable
  #Now convert any of these path variables into defines for C++ usage
  DEFINES += PREFIX="QString\\\(\\\"$${PREFIX}\\\"\\\)"
  DEFINES += L_ETCDIR="QString\\\(\\\"$${L_ETCDIR}\\\"\\\)"
  DEFINES += L_SHAREDIR="QString\\\(\\\"$${L_SHAREDIR}\\\"\\\)"
}


fixed Factorial example

fixed Factorial example

# This version will overflow stack on larger values.
fac1 = fn (n)
   if n == 0 then 1
   else n * fac1 (n - 1)
end

show(fac1(10))

# This version uses an accumulator.
fac2 = fn (n)
   inner (n, 1)
   where inner = fn (i, acc)
            if i == 0 then acc
            else inner (i - 1, acc * i)
         end
end

show(fac2(10))

# This version will overflow stack on larger values.
factorial = fn (n)
   if n == 0 then 1
   else n * factorial (n - 1)
end

show(factorial(10))

# This version uses an accumulator.
factorial = fn (n)
   inner (n, 1)
   where inner = fn (i, acc)
            if i == 0 then acc
            else inner (i - 1, acc * i)
         end
end

show(factorial(10))


Enable charting on Android 32-bit

Enable charting on Android 32-bit

# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2019 QGroundControl Developers
# License terms set in COPYING.md
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains initial CONFIG tag setup and compiler settings.
#

# Setup our supported build types. We do this once here and then use the defined config scopes
# to allow us to easily modify suported build types in one place instead of duplicated throughout
# the project file.

CONFIG -= debug_and_release
linux {
    linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
        message("Linux build")
        CONFIG  += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_NFC RW_SUPPORT
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
        linux-clang {
            message("Linux clang")
            QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
        }
    } else : linux-rasp-pi2-g++ {
        message("Linux R-Pi2 build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
    } else : android-clang {
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_BLUETOOTH
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        QMAKE_CXXFLAGS += -Wno-address-of-packed-member
        QMAKE_CXXFLAGS += -Wno-unused-command-line-argument
        QMAKE_CFLAGS += -Wno-unused-command-line-argument
        QMAKE_LINK += -nostdlib++ # Hack fix?: https://forum.qt.io/topic/103713/error-cannot-find-lc-qt-5-12-android
        target.path = $$DESTDIR
        equals(ANDROID_TARGET_ARCH, armeabi-v7a)  {
            DEFINES += __androidArm32__
            DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
            message("Android Arm 32 bit build")
        } else:equals(ANDROID_TARGET_ARCH, arm64-v8a)  {
            DEFINES += __androidArm64__
            DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
            message("Android Arm 64 bit build")
        } else:equals(ANDROID_TARGET_ARCH, x86)  {
            CONFIG += Androidx86Build
            DEFINES += __androidx86__
            message("Android Arm build")
        } else {
            error("Unsupported Android architecture: $${ANDROID_TARGET_ARCH}")
        }
    } else {
        error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
    }
} else : win32 {
    contains(QMAKE_TARGET.arch, x86_64) {
        message("Windows build")
        CONFIG += WindowsBuild
        CONFIG += WarningsAsErrorsOn
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
    } else {
        error("Unsupported Windows toolchain, only Visual Studio 2017 64 bit is supported")
    }
} else : macx {
    macx-clang | macx-llvm {
        message("Mac build")
        CONFIG  += MacBuild
        CONFIG  += x86_64
        CONFIG  -= x86
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
        equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
        } else {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
        }
        #-- Not forcing anything. Let qmake find the latest, installed SDK.
        #QMAKE_MAC_SDK = macosx10.12
        QMAKE_CXXFLAGS += -fvisibility=hidden
        #-- Disable annoying warnings comming from mavlink.h
        QMAKE_CXXFLAGS += -Wno-address-of-packed-member
    } else {
        error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
    }
} else : ios {
    !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
        error("Unsupported Qt version, 5.5.x or greater is required for iOS")
    }
    message("iOS build")
    CONFIG  += iOSBuild MobileBuild app_bundle NoSerialBuild
    CONFIG  -= bitcode
    DEFINES += __ios__
    DEFINES += QGC_NO_GOOGLE_MAPS
    DEFINES += NO_SERIAL_LINK
    DEFINES += QGC_DISABLE_UVC
    DEFINES += QGC_GST_TAISYNC_ENABLED
    QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
    QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 # Universal
    QMAKE_LFLAGS += -Wl,-no_pie
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

# Enable ccache where we can
linux|macx|ios {
    system(which ccache) {
        message("Found ccache, enabling")
        !ios {
            QMAKE_CXX = ccache $$QMAKE_CXX
            QMAKE_CC  = ccache $$QMAKE_CC
        } else {
            QMAKE_CXX = $$PWD/tools/iosccachecc.sh
            QMAKE_CC  = $$PWD/tools/iosccachecxx.sh
        }
    }
}

MobileBuild {
    DEFINES += __mobile__
}

# set the QGC version from git

exists ($$PWD/.git) {
    GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
    GIT_BRANCH   = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
    GIT_HASH     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
    GIT_TIME     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)

    # determine if we're on a tag matching vX.Y.Z (stable release)
    contains(GIT_DESCRIBE, v[0-9]+.[0-9]+.[0-9]+) {
        # release version "vX.Y.Z"
        GIT_VERSION = $${GIT_DESCRIBE}
        VERSION      = $$replace(GIT_DESCRIBE, "v", "")
        VERSION      = $$replace(VERSION, "-", ".")
        VERSION      = $$section(VERSION, ".", 0, 3)
    } else {
        # development version "Development branch:sha date"
        GIT_VERSION = "Development $${GIT_BRANCH}:$${GIT_HASH} $${GIT_TIME}"
        VERSION         = 0.0.0
    }

    MacBuild {
        MAC_VERSION  = $$section(VERSION, ".", 0, 2)
        MAC_BUILD    = $$section(VERSION, ".", 3, 3)
        message(QGroundControl version $${MAC_VERSION} build $${MAC_BUILD} describe $${GIT_VERSION})
    } else {
        message(QGroundControl $${GIT_VERSION})
    }
} else {
    GIT_VERSION     = None
    VERSION         = 0.0.0   # Marker to indicate out-of-tree build
    MAC_VERSION     = 0.0.0
    MAC_BUILD       = 0
}

DEFINES += GIT_VERSION=\"\\\"$$GIT_VERSION\\\"\"
DEFINES += EIGEN_MPL2_ONLY

# Installer configuration

installer {
    CONFIG -= debug
    CONFIG -= debug_and_release
    CONFIG += release
    message(Build Installer)
}

# Setup our supported build flavors

CONFIG(debug, debug|release) {
    message(Debug flavor)
    CONFIG += DebugBuild
} else:CONFIG(release, debug|release) {
    message(Release flavor)
    CONFIG += ReleaseBuild
} else {
    error(Unsupported build flavor)
}

# Setup our build directories

BASEDIR      = $$IN_PWD

!iOSBuild {
    OBJECTS_DIR  = $${OUT_PWD}/obj
    MOC_DIR      = $${OUT_PWD}/moc
    UI_DIR       = $${OUT_PWD}/ui
    RCC_DIR      = $${OUT_PWD}/rcc
}

LANGUAGE = C++

LOCATION_PLUGIN_DESTDIR = $${OUT_PWD}/src/QtLocationPlugin
LOCATION_PLUGIN_NAME    = QGeoServiceProviderFactoryQGC

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

MacBuild | LinuxBuild {
    QMAKE_CXXFLAGS_WARN_ON += -Wall
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += -Werror
    }
    MacBuild {
        # Latest clang version has a buggy check for this which cause Qt headers to throw warnings on qmap.h
        QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
        # Xcode 8.3 has issues on how MAVLink accesses (packed) message structure members.
        # Note that this will fail when Xcode version reaches 10.x.x
        XCODE_VERSION = $$system($$PWD/tools/get_xcode_version.sh)
        greaterThan(XCODE_VERSION, 8.2.0): QMAKE_CXXFLAGS_WARN_ON += -Wno-address-of-packed-member
    }
}

WindowsBuild {
    QMAKE_CFLAGS -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot, these come from the shapefile code with is external
        /wd4005 \   # silence warnings about macro redefinition, these come from the shapefile code with is external
        /wd4290 \   # ignore exception specifications
        /wd4267     # silence conversion from 'size_t' to 'int', possible loss of data, these come from gps drivers shared with px4
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG QT_MESSAGELOGCONTEXT
    CONFIG += force_debug_info  # Enable debugging symbols on release builds
    !iOSBuild {
        !AndroidBuild {
            CONFIG += ltcg              # Turn on link time code generation
        }
    }

    WindowsBuild {
        # Run compilation using VS compiler using multiple threads
        QMAKE_CXXFLAGS += -MP

        # Enable function level linking and enhanced optimized debugging
        QMAKE_CFLAGS_RELEASE   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE += /Gy /Zo
        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo

        # Eliminate duplicate COMDATs
        QMAKE_LFLAGS_RELEASE += /OPT:ICF
        QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /OPT:ICF
    }
}

# -------------------------------------------------
# QGroundControl - Micro Air Vehicle Groundstation
# Please see our website at <http://qgroundcontrol.org>
# Maintainer:
# Lorenz Meier <lm@inf.ethz.ch>
# (c) 2009-2019 QGroundControl Developers
# License terms set in COPYING.md
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains initial CONFIG tag setup and compiler settings.
#

# Setup our supported build types. We do this once here and then use the defined config scopes
# to allow us to easily modify suported build types in one place instead of duplicated throughout
# the project file.

CONFIG -= debug_and_release
linux {
    linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
        message("Linux build")
        CONFIG  += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_NFC RW_SUPPORT
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
        linux-clang {
            message("Linux clang")
            QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
        }
    } else : linux-rasp-pi2-g++ {
        message("Linux R-Pi2 build")
        CONFIG += LinuxBuild
        DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
    } else : android-clang {
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_ENABLE_BLUETOOTH
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        QMAKE_CXXFLAGS += -Wno-address-of-packed-member
        QMAKE_CXXFLAGS += -Wno-unused-command-line-argument
        QMAKE_CFLAGS += -Wno-unused-command-line-argument
        QMAKE_LINK += -nostdlib++ # Hack fix?: https://forum.qt.io/topic/103713/error-cannot-find-lc-qt-5-12-android
        target.path = $$DESTDIR
        equals(ANDROID_TARGET_ARCH, armeabi-v7a)  {
            DEFINES += __androidArm32__
            message("Android Arm 32 bit build")
        } else:equals(ANDROID_TARGET_ARCH, arm64-v8a)  {
            DEFINES += __androidArm64__
            DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
            message("Android Arm 64 bit build")
        } else:equals(ANDROID_TARGET_ARCH, x86)  {
            CONFIG += Androidx86Build
            DEFINES += __androidx86__
            message("Android Arm build")
        } else {
            error("Unsupported Android architecture: $${ANDROID_TARGET_ARCH}")
        }
    } else {
        error("Unsuported Linux toolchain, only GCC 32- or 64-bit is supported")
    }
} else : win32 {
    contains(QMAKE_TARGET.arch, x86_64) {
        message("Windows build")
        CONFIG += WindowsBuild
        CONFIG += WarningsAsErrorsOn
        DEFINES += __STDC_LIMIT_MACROS
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
    } else {
        error("Unsupported Windows toolchain, only Visual Studio 2017 64 bit is supported")
    }
} else : macx {
    macx-clang | macx-llvm {
        message("Mac build")
        CONFIG  += MacBuild
        CONFIG  += x86_64
        CONFIG  -= x86
        DEFINES += QGC_GST_TAISYNC_ENABLED
        DEFINES += QGC_GST_MICROHARD_ENABLED
        DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
        equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
        } else {
                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
        }
        #-- Not forcing anything. Let qmake find the latest, installed SDK.
        #QMAKE_MAC_SDK = macosx10.12
        QMAKE_CXXFLAGS += -fvisibility=hidden
        #-- Disable annoying warnings comming from mavlink.h
        QMAKE_CXXFLAGS += -Wno-address-of-packed-member
    } else {
        error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
    }
} else : ios {
    !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
        error("Unsupported Qt version, 5.5.x or greater is required for iOS")
    }
    message("iOS build")
    CONFIG  += iOSBuild MobileBuild app_bundle NoSerialBuild
    CONFIG  -= bitcode
    DEFINES += __ios__
    DEFINES += QGC_NO_GOOGLE_MAPS
    DEFINES += NO_SERIAL_LINK
    DEFINES += QGC_DISABLE_UVC
    DEFINES += QGC_GST_TAISYNC_ENABLED
    QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
    QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 # Universal
    QMAKE_LFLAGS += -Wl,-no_pie
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

# Enable ccache where we can
linux|macx|ios {
    system(which ccache) {
        message("Found ccache, enabling")
        !ios {
            QMAKE_CXX = ccache $$QMAKE_CXX
            QMAKE_CC  = ccache $$QMAKE_CC
        } else {
            QMAKE_CXX = $$PWD/tools/iosccachecc.sh
            QMAKE_CC  = $$PWD/tools/iosccachecxx.sh
        }
    }
}

MobileBuild {
    DEFINES += __mobile__
}

# set the QGC version from git

exists ($$PWD/.git) {
    GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
    GIT_BRANCH   = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --abbrev-ref HEAD)
    GIT_HASH     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD rev-parse --short HEAD)
    GIT_TIME     = $$system(git --git-dir $$PWD/.git --work-tree $$PWD show --oneline --format=\"%ci\" -s HEAD)

    # determine if we're on a tag matching vX.Y.Z (stable release)
    contains(GIT_DESCRIBE, v[0-9]+.[0-9]+.[0-9]+) {
        # release version "vX.Y.Z"
        GIT_VERSION = $${GIT_DESCRIBE}
        VERSION      = $$replace(GIT_DESCRIBE, "v", "")
        VERSION      = $$replace(VERSION, "-", ".")
        VERSION      = $$section(VERSION, ".", 0, 3)
    } else {
        # development version "Development branch:sha date"
        GIT_VERSION = "Development $${GIT_BRANCH}:$${GIT_HASH} $${GIT_TIME}"
        VERSION         = 0.0.0
    }

    MacBuild {
        MAC_VERSION  = $$section(VERSION, ".", 0, 2)
        MAC_BUILD    = $$section(VERSION, ".", 3, 3)
        message(QGroundControl version $${MAC_VERSION} build $${MAC_BUILD} describe $${GIT_VERSION})
    } else {
        message(QGroundControl $${GIT_VERSION})
    }
} else {
    GIT_VERSION     = None
    VERSION         = 0.0.0   # Marker to indicate out-of-tree build
    MAC_VERSION     = 0.0.0
    MAC_BUILD       = 0
}

DEFINES += GIT_VERSION=\"\\\"$$GIT_VERSION\\\"\"
DEFINES += EIGEN_MPL2_ONLY

# Installer configuration

installer {
    CONFIG -= debug
    CONFIG -= debug_and_release
    CONFIG += release
    message(Build Installer)
}

# Setup our supported build flavors

CONFIG(debug, debug|release) {
    message(Debug flavor)
    CONFIG += DebugBuild
} else:CONFIG(release, debug|release) {
    message(Release flavor)
    CONFIG += ReleaseBuild
} else {
    error(Unsupported build flavor)
}

# Setup our build directories

BASEDIR      = $$IN_PWD

!iOSBuild {
    OBJECTS_DIR  = $${OUT_PWD}/obj
    MOC_DIR      = $${OUT_PWD}/moc
    UI_DIR       = $${OUT_PWD}/ui
    RCC_DIR      = $${OUT_PWD}/rcc
}

LANGUAGE = C++

LOCATION_PLUGIN_DESTDIR = $${OUT_PWD}/src/QtLocationPlugin
LOCATION_PLUGIN_NAME    = QGeoServiceProviderFactoryQGC

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

MacBuild | LinuxBuild {
    QMAKE_CXXFLAGS_WARN_ON += -Wall
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += -Werror
    }
    MacBuild {
        # Latest clang version has a buggy check for this which cause Qt headers to throw warnings on qmap.h
        QMAKE_CXXFLAGS_WARN_ON += -Wno-return-stack-address
        # Xcode 8.3 has issues on how MAVLink accesses (packed) message structure members.
        # Note that this will fail when Xcode version reaches 10.x.x
        XCODE_VERSION = $$system($$PWD/tools/get_xcode_version.sh)
        greaterThan(XCODE_VERSION, 8.2.0): QMAKE_CXXFLAGS_WARN_ON += -Wno-address-of-packed-member
    }
}

WindowsBuild {
    QMAKE_CFLAGS -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
    QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
    QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot, these come from the shapefile code with is external
        /wd4005 \   # silence warnings about macro redefinition, these come from the shapefile code with is external
        /wd4290 \   # ignore exception specifications
        /wd4267     # silence conversion from 'size_t' to 'int', possible loss of data, these come from gps drivers shared with px4
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG QT_MESSAGELOGCONTEXT
    CONFIG += force_debug_info  # Enable debugging symbols on release builds
    !iOSBuild {
        !AndroidBuild {
            CONFIG += ltcg              # Turn on link time code generation
        }
    }

    WindowsBuild {
        # Run compilation using VS compiler using multiple threads
        QMAKE_CXXFLAGS += -MP

        # Enable function level linking and enhanced optimized debugging
        QMAKE_CFLAGS_RELEASE   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE += /Gy /Zo
        QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO   += /Gy /Zo
        QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += /Gy /Zo

        # Eliminate duplicate COMDATs
        QMAKE_LFLAGS_RELEASE += /OPT:ICF
        QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /OPT:ICF
    }
}


restore variables.pri

restore variables.pri

#############################################################################
# Application name & version
#############################################################################

APPNAME    = Q Light Controller Plus
FXEDNAME   = Fixture Definition Editor
APPVERSION = 4.8.5 GIT

#############################################################################
# Compiler & linker configuration
#############################################################################

# Treat all compiler warnings as errors
QMAKE_CXXFLAGS += -Werror
!macx:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs # Fix to build with GCC 4.8
CONFIG         += warn_on

# Build everything in the order specified in .pro files
CONFIG         += ordered

# Enable the following 2 lines when making a release
CONFIG         -= release
#DEFINES        += QT_NO_DEBUG_OUTPUT

# Disable this when making a release
CONFIG         += debug

# Disable these if you don't want to see SVN revision in the About Box
#unix:REVISION = $$system(svn info | grep "Revision" | sed 's/Revision://')
#unix:APPVERSION = $$APPVERSION-r$$REVISION

unix:OLA_GIT    = /usr/src/ola    # OLA directories

#macx:CONFIG   += x86 ppc  # Build universal binaries (Leopard only)
macx:CONFIG    -= app_bundle # Let QLC+ construct the .app bundle

# Produce build targets to the source directory
win32:DESTDIR  = ./

# Don't whine about some imports
win32:QMAKE_LFLAGS += -Wl,--enable-auto-import

# Enable unit test coverage measurement ('qmake CONFIG+=coverage' works, too)
#CONFIG        += coverage

#############################################################################
# Installation paths
#############################################################################

# Install root
win32:INSTALLROOT       = $$(SystemDrive)/qlcplus
macx:INSTALLROOT        = ~/QLC+.app/Contents
unix:!macx:INSTALLROOT += /usr

# Binaries
win32:BINDIR      =
unix:!macx:BINDIR = bin
macx:BINDIR       = MacOS

# Libraries
win32:LIBSDIR      =
unix:!macx:LIBSDIR = lib
macx:LIBSDIR       = Frameworks

# Data
win32:DATADIR      =
unix:!macx:DATADIR = share/qlcplus
macx:DATADIR       = Resources

# User Data
win32:USERDATADIR      = QLC+
unix:!macx:USERDATADIR = .qlcplus
macx:USERDATADIR       = "Library/Application Support/QLC+"

# Documentation
win32:DOCSDIR      = Documents
unix:!macx:DOCSDIR = $$DATADIR/documents
macx:DOCSDIR       = $$DATADIR/Documents

# Input profiles
win32:INPUTPROFILEDIR      = InputProfiles
unix:!macx:INPUTPROFILEDIR = $$DATADIR/inputprofiles
macx:INPUTPROFILEDIR       = $$DATADIR/InputProfiles

# User input profiles
win32:USERINPUTPROFILEDIR      = $$USERDATADIR/InputProfiles
unix:!macx:USERINPUTPROFILEDIR = $$USERDATADIR/inputprofiles
macx:USERINPUTPROFILEDIR       = $$USERDATADIR/InputProfiles

# Midi templates
win32:MIDITEMPLATEDIR      = MidiTemplates
unix:!macx:MIDITEMPLATEDIR = $$DATADIR/miditemplates
macx:MIDITEMPLATEDIR       = $$DATADIR/MidiTemplates

# User midi templates
win32:USERMIDITEMPLATEDIR      = $$USERDATADIR/MidiTemplates
unix:!macx:USERMIDITEMPLATEDIR = $$USERDATADIR/miditemplates
macx:USERMIDITEMPLATEDIR       = $$USERDATADIR/MidiTemplates

# Channel modifiers templates
win32:MODIFIERSTEMPLATEDIR      = ModifiersTemplates
unix:!macx:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates
macx:MODIFIERSTEMPLATEDIR       = $$DATADIR/ModifiersTemplates

# User midi templates
win32:USERMODIFIERSTEMPLATEDIR      = $$USERDATADIR/ModifiersTemplates
unix:!macx:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates
macx:USERMODIFIERSTEMPLATEDIR       = $$USERDATADIR/ModifiersTemplates

# Fixtures
win32:FIXTUREDIR      = Fixtures
unix:!macx:FIXTUREDIR = $$DATADIR/fixtures
macx:FIXTUREDIR       = $$DATADIR/Fixtures

# Gobos
win32:GOBODIR      = Gobos
unix:!macx:GOBODIR = $$DATADIR/gobos
macx:GOBODIR       = $$DATADIR/Gobos

# User fixtures
win32:USERFIXTUREDIR      = $$USERDATADIR/Fixtures
unix:!macx:USERFIXTUREDIR = $$USERDATADIR/fixtures
macx:USERFIXTUREDIR       = $$USERDATADIR/Fixtures

# Plugins
win32:PLUGINDIR      = Plugins
unix:!macx:PLUGINDIR = $$LIBSDIR/qt4/plugins/qlcplus
macx:PLUGINDIR       = PlugIns

# Translations
win32:TRANSLATIONDIR      =
unix:!macx:TRANSLATIONDIR = $$DATADIR/translations
macx:TRANSLATIONDIR       = $$DATADIR/Translations

# RGB Scripts
win32:RGBSCRIPTDIR      = RGBScripts
unix:!macx:RGBSCRIPTDIR = $$DATADIR/rgbscripts
macx:RGBSCRIPTDIR       = $$DATADIR/RGBScripts

# User RGB Scripts
win32:USERRGBSCRIPTDIR      = $$USERDATADIR/RGBScripts
unix:!macx:USERRGBSCRIPTDIR = $$USERDATADIR/rgbscripts
macx:USERRGBSCRIPTDIR       = $$USERDATADIR/RGBScripts

# RGB Scripts
win32:WEBFILESDIR      = Web
unix:!macx:WEBFILESDIR = $$DATADIR/web
macx:WEBFILESDIR       = $$DATADIR/Web

#############################################################################
# Application name & version
#############################################################################

APPNAME    = Q Light Controller Plus
FXEDNAME   = Fixture Definition Editor
APPVERSION = 4.8.5 GIT

#############################################################################
# Compiler & linker configuration
#############################################################################

# Treat all compiler warnings as errors
QMAKE_CXXFLAGS += -Werror
CONFIG         += warn_on

# Build everything in the order specified in .pro files
CONFIG         += ordered

# Enable the following 2 lines when making a release
CONFIG         -= release
#DEFINES        += QT_NO_DEBUG_OUTPUT

# Disable this when making a release
CONFIG         += debug

# Disable these if you don't want to see SVN revision in the About Box
#unix:REVISION = $$system(svn info | grep "Revision" | sed 's/Revision://')
#unix:APPVERSION = $$APPVERSION-r$$REVISION

unix:OLA_GIT    = /usr/src/ola    # OLA directories

#macx:CONFIG   += x86 ppc  # Build universal binaries (Leopard only)
macx:CONFIG    -= app_bundle # Let QLC+ construct the .app bundle

# Produce build targets to the source directory
win32:DESTDIR  = ./

# Don't whine about some imports
win32:QMAKE_LFLAGS += -Wl,--enable-auto-import

# Enable unit test coverage measurement ('qmake CONFIG+=coverage' works, too)
#CONFIG        += coverage

#############################################################################
# Installation paths
#############################################################################

# Install root
win32:INSTALLROOT       = $$(SystemDrive)/qlcplus
macx:INSTALLROOT        = ~/QLC+.app/Contents
unix:!macx:INSTALLROOT += /usr

# Binaries
win32:BINDIR      =
unix:!macx:BINDIR = bin
macx:BINDIR       = MacOS

# Libraries
win32:LIBSDIR      =
unix:!macx:LIBSDIR = lib
macx:LIBSDIR       = Frameworks

# Data
win32:DATADIR      =
unix:!macx:DATADIR = share/qlcplus
macx:DATADIR       = Resources

# User Data
win32:USERDATADIR      = QLC+
unix:!macx:USERDATADIR = .qlcplus
macx:USERDATADIR       = "Library/Application Support/QLC+"

# Documentation
win32:DOCSDIR      = Documents
unix:!macx:DOCSDIR = $$DATADIR/documents
macx:DOCSDIR       = $$DATADIR/Documents

# Input profiles
win32:INPUTPROFILEDIR      = InputProfiles
unix:!macx:INPUTPROFILEDIR = $$DATADIR/inputprofiles
macx:INPUTPROFILEDIR       = $$DATADIR/InputProfiles

# User input profiles
win32:USERINPUTPROFILEDIR      = $$USERDATADIR/InputProfiles
unix:!macx:USERINPUTPROFILEDIR = $$USERDATADIR/inputprofiles
macx:USERINPUTPROFILEDIR       = $$USERDATADIR/InputProfiles

# Midi templates
win32:MIDITEMPLATEDIR      = MidiTemplates
unix:!macx:MIDITEMPLATEDIR = $$DATADIR/miditemplates
macx:MIDITEMPLATEDIR       = $$DATADIR/MidiTemplates

# User midi templates
win32:USERMIDITEMPLATEDIR      = $$USERDATADIR/MidiTemplates
unix:!macx:USERMIDITEMPLATEDIR = $$USERDATADIR/miditemplates
macx:USERMIDITEMPLATEDIR       = $$USERDATADIR/MidiTemplates

# Channel modifiers templates
win32:MODIFIERSTEMPLATEDIR      = ModifiersTemplates
unix:!macx:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates
macx:MODIFIERSTEMPLATEDIR       = $$DATADIR/ModifiersTemplates

# User midi templates
win32:USERMODIFIERSTEMPLATEDIR      = $$USERDATADIR/ModifiersTemplates
unix:!macx:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates
macx:USERMODIFIERSTEMPLATEDIR       = $$USERDATADIR/ModifiersTemplates

# Fixtures
win32:FIXTUREDIR      = Fixtures
unix:!macx:FIXTUREDIR = $$DATADIR/fixtures
macx:FIXTUREDIR       = $$DATADIR/Fixtures

# Gobos
win32:GOBODIR      = Gobos
unix:!macx:GOBODIR = $$DATADIR/gobos
macx:GOBODIR       = $$DATADIR/Gobos

# User fixtures
win32:USERFIXTUREDIR      = $$USERDATADIR/Fixtures
unix:!macx:USERFIXTUREDIR = $$USERDATADIR/fixtures
macx:USERFIXTUREDIR       = $$USERDATADIR/Fixtures

# Plugins
win32:PLUGINDIR      = Plugins
unix:!macx:PLUGINDIR = $$LIBSDIR/qt4/plugins/qlcplus
macx:PLUGINDIR       = PlugIns

# Translations
win32:TRANSLATIONDIR      =
unix:!macx:TRANSLATIONDIR = $$DATADIR/translations
macx:TRANSLATIONDIR       = $$DATADIR/Translations

# RGB Scripts
win32:RGBSCRIPTDIR      = RGBScripts
unix:!macx:RGBSCRIPTDIR = $$DATADIR/rgbscripts
macx:RGBSCRIPTDIR       = $$DATADIR/RGBScripts

# User RGB Scripts
win32:USERRGBSCRIPTDIR      = $$USERDATADIR/RGBScripts
unix:!macx:USERRGBSCRIPTDIR = $$USERDATADIR/rgbscripts
macx:USERRGBSCRIPTDIR       = $$USERDATADIR/RGBScripts

# RGB Scripts
win32:WEBFILESDIR      = Web
unix:!macx:WEBFILESDIR = $$DATADIR/web
macx:WEBFILESDIR       = $$DATADIR/Web


Let's also try to workaround OBS GCC 4.6 strict-overflow issue

#############################################################################
# Application name & version
#############################################################################

APPNAME    = Q Light Controller Plus
FXEDNAME   = Fixture Definition Editor
APPVERSION = 4.9.2 GIT

#############################################################################
# Compiler & linker configuration
#############################################################################

# Treat all compiler warnings as errors
QMAKE_CXXFLAGS += -Werror

CONFIG         += warn_on

# Build everything in the order specified in .pro files
CONFIG         += ordered

# Enable the following 2 lines when making a release
CONFIG         -= release
#DEFINES        += QT_NO_DEBUG_OUTPUT

# Disable this when making a release
CONFIG         += debug

!macx {
 system( g++ --version | grep -e "4.6.[0-9]" ) {
   message("g++ version 4.6 found")
   QMAKE_CXXFLAGS += -Wno-error=strict-overflow
 }
 else {
   QMAKE_CXXFLAGS += -Wno-unused-local-typedefs # Fix to build with GCC 4.8
 }
}

# Disable these if you don't want to see SVN revision in the About Box
#unix:REVISION = $$system(svn info | grep "Revision" | sed 's/Revision://')
#unix:APPVERSION = $$APPVERSION-r$$REVISION

unix:OLA_GIT    = /usr/src/ola    # OLA directories

#macx:CONFIG   += x86 ppc  # Build universal binaries (Leopard only)
macx:CONFIG    -= app_bundle # Let QLC+ construct the .app bundle

# Produce build targets to the source directory
win32:DESTDIR  = ./

# Don't whine about some imports
win32:QMAKE_LFLAGS += -Wl,--enable-auto-import

# Enable unit test coverage measurement ('qmake CONFIG+=coverage' works, too)
#CONFIG        += coverage

#############################################################################
# Installation paths
#############################################################################

# Install root
win32:INSTALLROOT       = $$(SystemDrive)/qlcplus
macx:INSTALLROOT        = ~/QLC+.app/Contents
unix:!macx:INSTALLROOT += /usr
android:INSTALLROOT     = /

# Binaries
win32:BINDIR      =
unix:!macx:BINDIR = bin
macx:BINDIR       = MacOS
android:BINDIR    = bin

# Libraries
win32:LIBSDIR      =
unix:!macx:LIBSDIR = lib
macx:LIBSDIR       = Frameworks
android:LIBSDIR    = /libs/armeabi-v7a

# Data
win32:DATADIR      =
unix:!macx:DATADIR = share/qlcplus
macx:DATADIR       = Resources
android:DATADIR    = /assets

# User Data
win32:USERDATADIR      = QLC+
unix:!macx:USERDATADIR = .qlcplus
macx:USERDATADIR       = "Library/Application Support/QLC+"
android:USERDATADIR    = .qlcplus

# Documentation
win32:DOCSDIR      = Documents
unix:!macx:DOCSDIR = $$DATADIR/documents
macx:DOCSDIR       = $$DATADIR/Documents
android:DOCSDIR    = $$DATADIR/documents

# Input profiles
win32:INPUTPROFILEDIR      = InputProfiles
unix:!macx:INPUTPROFILEDIR = $$DATADIR/inputprofiles
macx:INPUTPROFILEDIR       = $$DATADIR/InputProfiles
android:INPUTPROFILEDIR    = $$DATADIR/inputprofiles

# User input profiles
win32:USERINPUTPROFILEDIR      = $$USERDATADIR/InputProfiles
unix:!macx:USERINPUTPROFILEDIR = $$USERDATADIR/inputprofiles
macx:USERINPUTPROFILEDIR       = $$USERDATADIR/InputProfiles
android:USERINPUTPROFILEDIR    = $$USERDATADIR/inputprofiles

# Midi templates
win32:MIDITEMPLATEDIR      = MidiTemplates
unix:!macx:MIDITEMPLATEDIR = $$DATADIR/miditemplates
macx:MIDITEMPLATEDIR       = $$DATADIR/MidiTemplates
android:MIDITEMPLATEDIR    = $$DATADIR/miditemplates

# User midi templates
win32:USERMIDITEMPLATEDIR      = $$USERDATADIR/MidiTemplates
unix:!macx:USERMIDITEMPLATEDIR = $$USERDATADIR/miditemplates
macx:USERMIDITEMPLATEDIR       = $$USERDATADIR/MidiTemplates
android:USERMIDITEMPLATEDIR    = $$USERDATADIR/miditemplates

# Channel modifiers templates
win32:MODIFIERSTEMPLATEDIR      = ModifiersTemplates
unix:!macx:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates
macx:MODIFIERSTEMPLATEDIR       = $$DATADIR/ModifiersTemplates
android:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates

# User midi templates
win32:USERMODIFIERSTEMPLATEDIR      = $$USERDATADIR/ModifiersTemplates
unix:!macx:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates
macx:USERMODIFIERSTEMPLATEDIR       = $$USERDATADIR/ModifiersTemplates
android:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates

# Fixtures
win32:FIXTUREDIR      = Fixtures
unix:!macx:FIXTUREDIR = $$DATADIR/fixtures
macx:FIXTUREDIR       = $$DATADIR/Fixtures
android:FIXTUREDIR    = $$DATADIR/fixtures

# Gobos
win32:GOBODIR      = Gobos
unix:!macx:GOBODIR = $$DATADIR/gobos
macx:GOBODIR       = $$DATADIR/Gobos
android:GOBODIR    = $$DATADIR/gobos

# User fixtures
win32:USERFIXTUREDIR      = $$USERDATADIR/Fixtures
unix:!macx:USERFIXTUREDIR = $$USERDATADIR/fixtures
macx:USERFIXTUREDIR       = $$USERDATADIR/Fixtures
android:USERFIXTUREDIR    = $$USERDATADIR/fixtures

# Plugins
win32:PLUGINDIR      = Plugins
unix:!macx:PLUGINDIR = $$LIBSDIR/qt4/plugins/qlcplus
macx:PLUGINDIR       = PlugIns
android:PLUGINDIR    = Plugins

# Translations
win32:TRANSLATIONDIR      =
unix:!macx:TRANSLATIONDIR = $$DATADIR/translations
macx:TRANSLATIONDIR       = $$DATADIR/Translations
android:TRANSLATIONDIR    = $$DATADIR/translations

# RGB Scripts
win32:RGBSCRIPTDIR      = RGBScripts
unix:!macx:RGBSCRIPTDIR = $$DATADIR/rgbscripts
macx:RGBSCRIPTDIR       = $$DATADIR/RGBScripts
android:RGBSCRIPTDIR    = $$DATADIR/rgbscripts

# User RGB Scripts
win32:USERRGBSCRIPTDIR      = $$USERDATADIR/RGBScripts
unix:!macx:USERRGBSCRIPTDIR = $$USERDATADIR/rgbscripts
macx:USERRGBSCRIPTDIR       = $$USERDATADIR/RGBScripts

# RGB Scripts
win32:WEBFILESDIR      = Web
unix:!macx:WEBFILESDIR = $$DATADIR/web
macx:WEBFILESDIR       = $$DATADIR/Web

#############################################################################
# Application name & version
#############################################################################

APPNAME    = Q Light Controller Plus
FXEDNAME   = Fixture Definition Editor
APPVERSION = 4.9.2 GIT

#############################################################################
# Compiler & linker configuration
#############################################################################

# Treat all compiler warnings as errors
QMAKE_CXXFLAGS += -Werror

!macx {
 system( g++ --version | grep -e "4.6.[0-9]" ) {
   message("g++ version 4.6 found")
 }
 else {
   QMAKE_CXXFLAGS += -Wno-unused-local-typedefs # Fix to build with GCC 4.8
 }
}
CONFIG         += warn_on

# Build everything in the order specified in .pro files
CONFIG         += ordered

# Enable the following 2 lines when making a release
CONFIG         -= release
#DEFINES        += QT_NO_DEBUG_OUTPUT

# Disable this when making a release
CONFIG         += debug

# Disable these if you don't want to see SVN revision in the About Box
#unix:REVISION = $$system(svn info | grep "Revision" | sed 's/Revision://')
#unix:APPVERSION = $$APPVERSION-r$$REVISION

unix:OLA_GIT    = /usr/src/ola    # OLA directories

#macx:CONFIG   += x86 ppc  # Build universal binaries (Leopard only)
macx:CONFIG    -= app_bundle # Let QLC+ construct the .app bundle

# Produce build targets to the source directory
win32:DESTDIR  = ./

# Don't whine about some imports
win32:QMAKE_LFLAGS += -Wl,--enable-auto-import

# Enable unit test coverage measurement ('qmake CONFIG+=coverage' works, too)
#CONFIG        += coverage

#############################################################################
# Installation paths
#############################################################################

# Install root
win32:INSTALLROOT       = $$(SystemDrive)/qlcplus
macx:INSTALLROOT        = ~/QLC+.app/Contents
unix:!macx:INSTALLROOT += /usr
android:INSTALLROOT     = /

# Binaries
win32:BINDIR      =
unix:!macx:BINDIR = bin
macx:BINDIR       = MacOS
android:BINDIR    = bin

# Libraries
win32:LIBSDIR      =
unix:!macx:LIBSDIR = lib
macx:LIBSDIR       = Frameworks
android:LIBSDIR    = /libs/armeabi-v7a

# Data
win32:DATADIR      =
unix:!macx:DATADIR = share/qlcplus
macx:DATADIR       = Resources
android:DATADIR    = /assets

# User Data
win32:USERDATADIR      = QLC+
unix:!macx:USERDATADIR = .qlcplus
macx:USERDATADIR       = "Library/Application Support/QLC+"
android:USERDATADIR    = .qlcplus

# Documentation
win32:DOCSDIR      = Documents
unix:!macx:DOCSDIR = $$DATADIR/documents
macx:DOCSDIR       = $$DATADIR/Documents
android:DOCSDIR    = $$DATADIR/documents

# Input profiles
win32:INPUTPROFILEDIR      = InputProfiles
unix:!macx:INPUTPROFILEDIR = $$DATADIR/inputprofiles
macx:INPUTPROFILEDIR       = $$DATADIR/InputProfiles
android:INPUTPROFILEDIR    = $$DATADIR/inputprofiles

# User input profiles
win32:USERINPUTPROFILEDIR      = $$USERDATADIR/InputProfiles
unix:!macx:USERINPUTPROFILEDIR = $$USERDATADIR/inputprofiles
macx:USERINPUTPROFILEDIR       = $$USERDATADIR/InputProfiles
android:USERINPUTPROFILEDIR    = $$USERDATADIR/inputprofiles

# Midi templates
win32:MIDITEMPLATEDIR      = MidiTemplates
unix:!macx:MIDITEMPLATEDIR = $$DATADIR/miditemplates
macx:MIDITEMPLATEDIR       = $$DATADIR/MidiTemplates
android:MIDITEMPLATEDIR    = $$DATADIR/miditemplates

# User midi templates
win32:USERMIDITEMPLATEDIR      = $$USERDATADIR/MidiTemplates
unix:!macx:USERMIDITEMPLATEDIR = $$USERDATADIR/miditemplates
macx:USERMIDITEMPLATEDIR       = $$USERDATADIR/MidiTemplates
android:USERMIDITEMPLATEDIR    = $$USERDATADIR/miditemplates

# Channel modifiers templates
win32:MODIFIERSTEMPLATEDIR      = ModifiersTemplates
unix:!macx:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates
macx:MODIFIERSTEMPLATEDIR       = $$DATADIR/ModifiersTemplates
android:MODIFIERSTEMPLATEDIR = $$DATADIR/modifierstemplates

# User midi templates
win32:USERMODIFIERSTEMPLATEDIR      = $$USERDATADIR/ModifiersTemplates
unix:!macx:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates
macx:USERMODIFIERSTEMPLATEDIR       = $$USERDATADIR/ModifiersTemplates
android:USERMODIFIERSTEMPLATEDIR = $$USERDATADIR/modifierstemplates

# Fixtures
win32:FIXTUREDIR      = Fixtures
unix:!macx:FIXTUREDIR = $$DATADIR/fixtures
macx:FIXTUREDIR       = $$DATADIR/Fixtures
android:FIXTUREDIR    = $$DATADIR/fixtures

# Gobos
win32:GOBODIR      = Gobos
unix:!macx:GOBODIR = $$DATADIR/gobos
macx:GOBODIR       = $$DATADIR/Gobos
android:GOBODIR    = $$DATADIR/gobos

# User fixtures
win32:USERFIXTUREDIR      = $$USERDATADIR/Fixtures
unix:!macx:USERFIXTUREDIR = $$USERDATADIR/fixtures
macx:USERFIXTUREDIR       = $$USERDATADIR/Fixtures
android:USERFIXTUREDIR    = $$USERDATADIR/fixtures

# Plugins
win32:PLUGINDIR      = Plugins
unix:!macx:PLUGINDIR = $$LIBSDIR/qt4/plugins/qlcplus
macx:PLUGINDIR       = PlugIns
android:PLUGINDIR    = Plugins

# Translations
win32:TRANSLATIONDIR      =
unix:!macx:TRANSLATIONDIR = $$DATADIR/translations
macx:TRANSLATIONDIR       = $$DATADIR/Translations
android:TRANSLATIONDIR    = $$DATADIR/translations

# RGB Scripts
win32:RGBSCRIPTDIR      = RGBScripts
unix:!macx:RGBSCRIPTDIR = $$DATADIR/rgbscripts
macx:RGBSCRIPTDIR       = $$DATADIR/RGBScripts
android:RGBSCRIPTDIR    = $$DATADIR/rgbscripts

# User RGB Scripts
win32:USERRGBSCRIPTDIR      = $$USERDATADIR/RGBScripts
unix:!macx:USERRGBSCRIPTDIR = $$USERDATADIR/rgbscripts
macx:USERRGBSCRIPTDIR       = $$USERDATADIR/RGBScripts

# RGB Scripts
win32:WEBFILESDIR      = Web
unix:!macx:WEBFILESDIR = $$DATADIR/web
macx:WEBFILESDIR       = $$DATADIR/Web