PRI cleanup

PRI cleanup

#  Apache 2.0 License
#  copyright 2015 Speedovation

INCLUDEPATH += $$PWD $$PWD/breakpad $$PWD/breakpad/src $$PWD/CrashHandler

 HEADERS +=  \
    $$PWD/CrashHandler/CrashHandler.h

SOURCES += \
    $$PWD/CrashHandler/CrashHandler.cpp

# Windows
win32{
   HEADERS +=    $$PWD/breakpad/src/common/windows/string_utils-inl.h \
                 $$PWD/breakpad/src/common/windows/guid_string.h \
                 $$PWD/breakpad/src/client/windows/handler/exception_handler.h \
                 $$PWD/breakpad/src/client/windows/common/ipc_protocol.h \
                 $$PWD/breakpad/src/google_breakpad/common/minidump_format.h \
                 $$PWD/breakpad/src/google_breakpad/common/breakpad_types.h \
                 $$PWD/breakpad/src/client/windows/crash_generation/crash_generation_client.h \
                 $$PWD/breakpad/src/common/scoped_ptr.h

    SOURCES +=  $$PWD/breakpad/src/client/windows/handler/exception_handler.cc \
                $$PWD/breakpad/src/common/windows/string_utils.cc \
                $$PWD/breakpad/src/common/windows/guid_string.cc \
                $$PWD/breakpad/src/client/windows/crash_generation/crash_generation_client.cc

}
# Unix
unix{
     HEADERS += \
            $$PWD/breakpad/src/client/minidump_file_writer-inl.h \
            $$PWD/breakpad/src/client/minidump_file_writer.h \
            $$PWD/breakpad/src/common/using_std_string.h \
            $$PWD/breakpad/src/common/memory.h \
            $$PWD/breakpad/src/common/basictypes.h \
            $$PWD/breakpad/src/common/memory_range.h \
            $$PWD/breakpad/src/common/string_conversion.h \
            $$PWD/breakpad/src/common/convert_UTF.h \
            $$PWD/breakpad/src/google_breakpad/common/minidump_format.h \
            $$PWD/breakpad/src/google_breakpad/common/minidump_size.h \
            $$PWD/breakpad/src/google_breakpad/common/breakpad_types.h \
            $$PWD/breakpad/src/common/scoped_ptr.h \

    SOURCES += \
            $$PWD/breakpad/src/client/minidump_file_writer.cc \
            $$PWD/breakpad/src/common/string_conversion.cc \
            $$PWD/breakpad/src/common/convert_UTF.c \

    QMAKE_CXXFLAGS+=-g
}
#linux
linux{

 HEADERS += \
        $$PWD/breakpad/src/client/linux/handler/exception_handler.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/cpu_set.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h \
        $$PWD/breakpad/src/client/linux/crash_generation/crash_generation_client.h \
        $$PWD/breakpad/src/client/linux/handler/minidump_descriptor.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/line_reader.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/linux_dumper.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/directory_reader.h \
        $$PWD/breakpad/src/client/linux/log/log.h \
        $$PWD/breakpad/src/common/linux/linux_libc_support.h \
        $$PWD/breakpad/src/common/linux/eintr_wrapper.h \
        $$PWD/breakpad/src/common/linux/ignore_ret.h \
        $$PWD/breakpad/src/common/linux/file_id.h \
        $$PWD/breakpad/src/common/linux/memory_mapped_file.h \
        $$PWD/breakpad/src/common/linux/safe_readlink.h \
        $$PWD/breakpad/src/common/linux/guid_creator.h \
        $$PWD/breakpad/src/common/linux/elfutils.h \
        $$PWD/breakpad/src/common/linux/elfutils-inl.h \
        $$PWD/breakpad/src/common/linux/elf_gnu_compat.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/mapping_info.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h \
        $$PWD/breakpad/src/client/linux/microdump_writer/microdump_writer.h \
        $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.h \
        $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.h \
        $$PWD/breakpad/src/third_party/lss/linux_syscall_support.h

SOURCES +=  \
            $$PWD/breakpad/src/client/linux/crash_generation/crash_generation_client.cc \
            $$PWD/breakpad/src/client/linux/handler/exception_handler.cc \
            $$PWD/breakpad/src/client/linux/handler/minidump_descriptor.cc \
            $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.cc \
            $$PWD/breakpad/src/client/linux/minidump_writer/linux_dumper.cc \
            $$PWD/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
            $$PWD/breakpad/src/client/linux/microdump_writer/microdump_writer.cc \
            $$PWD/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc \
            $$PWD/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.cc \
            $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.cc \
            $$PWD/breakpad/src/client/linux/handler/exception_handler.h \
            $$PWD/breakpad/src/client/linux/log/log.cc \
            $$PWD/breakpad/src/common/linux/linux_libc_support.cc \
            $$PWD/breakpad/src/common/linux/file_id.cc \
            $$PWD/breakpad/src/common/linux/memory_mapped_file.cc \
            $$PWD/breakpad/src/common/linux/safe_readlink.cc \
            $$PWD/breakpad/src/common/linux/guid_creator.cc \
            $$PWD/breakpad/src/common/linux/elfutils.cc \

#breakpad app need debug info inside binaries

}

mac{

HEADERS += \
        $$PWD/breakpad/src/client/mac/handler/exception_handler.h

SOURCES += \
        $$PWD/breakpad/src/client/mac/handler/exception_handler.cc

}

DISTFILES += \
    $$PWD/README.md

#  Apache 2.0 License
#  copyright 2015 Speedovation

INCLUDEPATH += $$PWD $$PWD/breakpad $$PWD/breakpad/src $$PWD/CrashHandler

HEADERS += \
    $$PWD/CrashHandler/CrashHandler.h

SOURCES += \
    $$PWD/CrashHandler/CrashHandler.cpp

# Windows
win32:HEADERS += $$PWD/breakpad/src/common/windows/string_utils-inl.h
win32:HEADERS += $$PWD/breakpad/src/common/windows/guid_string.h
win32:HEADERS += $$PWD/breakpad/src/client/windows/handler/exception_handler.h
win32:HEADERS += $$PWD/breakpad/src/client/windows/common/ipc_protocol.h
win32:HEADERS += $$PWD/breakpad/src/google_breakpad/common/minidump_format.h
win32:HEADERS += $$PWD/breakpad/src/google_breakpad/common/breakpad_types.h
win32:HEADERS += $$PWD/breakpad/src/client/windows/crash_generation/crash_generation_client.h
win32:HEADERS += $$PWD/breakpad/src/common/scoped_ptr.h
win32:SOURCES += $$PWD/breakpad/src/client/windows/handler/exception_handler.cc
win32:SOURCES += $$PWD/breakpad/src/common/windows/string_utils.cc
win32:SOURCES += $$PWD/breakpad/src/common/windows/guid_string.cc
win32:SOURCES += $$PWD/breakpad/src/client/windows/crash_generation/crash_generation_client.cc

# Linux
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/cpu_set.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/handler/exception_handler.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/crash_generation/crash_generation_client.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/handler/minidump_descriptor.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/line_reader.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/linux_dumper.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/directory_reader.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/log/log.h
unix:HEADERS += $$PWD/breakpad/src/client/minidump_file_writer-inl.h
unix:HEADERS += $$PWD/breakpad/src/client/minidump_file_writer.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/linux_libc_support.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/eintr_wrapper.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/ignore_ret.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/file_id.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/memory_mapped_file.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/safe_readlink.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/guid_creator.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/elfutils.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/elfutils-inl.h
unix:HEADERS += $$PWD/breakpad/src/common/linux/elf_gnu_compat.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/mapping_info.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
unix:HEADERS += $$PWD/breakpad/src/common/using_std_string.h
unix:HEADERS += $$PWD/breakpad/src/common/memory.h
unix:HEADERS += $$PWD/breakpad/src/common/basictypes.h
unix:HEADERS += $$PWD/breakpad/src/common/memory_range.h
unix:HEADERS += $$PWD/breakpad/src/common/string_conversion.h
unix:HEADERS += $$PWD/breakpad/src/common/convert_UTF.h
unix:HEADERS += $$PWD/breakpad/src/google_breakpad/common/minidump_format.h
unix:HEADERS += $$PWD/breakpad/src/google_breakpad/common/minidump_size.h
unix:HEADERS += $$PWD/breakpad/src/google_breakpad/common/breakpad_types.h
unix:HEADERS += $$PWD/breakpad/src/common/scoped_ptr.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/microdump_writer/microdump_writer.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.h
unix:HEADERS += $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.h
unix:HEADERS += $$PWD/breakpad/src/third_party/lss/linux_syscall_support.h

unix:SOURCES += $$PWD/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/handler/exception_handler.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/handler/minidump_descriptor.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc

unix:SOURCES += $$PWD/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
#unix:SOURCES += $$PWD/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.cc
unix:SOURCES += $$PWD/breakpad/src/client/linux/dump_writer_common/thread_info.cc

unix:SOURCES += $$PWD/breakpad/src/client/linux/handler/exception_handler.h
unix:SOURCES += $$PWD/breakpad/src/client/linux/log/log.cc
unix:SOURCES += $$PWD/breakpad/src/client/minidump_file_writer.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/linux_libc_support.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/file_id.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/memory_mapped_file.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/safe_readlink.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/guid_creator.cc
unix:SOURCES += $$PWD/breakpad/src/common/linux/elfutils.cc
unix:SOURCES += $$PWD/breakpad/src/common/string_conversion.cc
unix:SOURCES += $$PWD/breakpad/src/common/convert_UTF.c
#breakpad app need debug info inside binaries
unix:QMAKE_CXXFLAGS+=-g

DISTFILES += \
    $$PWD/README.md


qcontactsymbiantransformerror.h/cpp was missing from tsrc.pri at symbian backend tests

# Symbian plugin header and source files
SYMBIAN_HEADERS += \
        ../../inc/qcontactsymbianengine_p.h \
        ../../inc/cnttransformcontact.h \
        ../../inc/cnttransformcontactdata.h \
        ../../inc/cnttransformname.h \
        ../../inc/cnttransformnickname.h \
        ../../inc/cnttransformphonenumber.h \
        ../../inc/cnttransformemail.h \
        ../../inc/cnttransformaddress.h \
        ../../inc/cnttransformurl.h \
        ../../inc/cnttransformbirthday.h \
        ../../inc/cnttransformonlineaccount.h \
        ../../inc/cnttransformorganisation.h \
        ../../inc/cnttransformavatar.h \
        ../../inc/cnttransformsynctarget.h \
        ../../inc/cnttransformgender.h \
        ../../inc/cnttransformanniversary.h \
        ../../inc/cnttransformgeolocation.h \
        ../../inc/cnttransformnote.h \
        ../../inc/cnttransformfamily.h \
        ../../inc/qabstractcontactfilter.h \
        ../../inc/qcontactsymbianfilterdbms.h \
        ../../inc/qcontactsymbianfiltersql.h \
        ../../inc/qcontactsymbiansorterdbms.h \
        ../../inc/qabstractcontactsorter.h \
        ../../inc/cntrelationship.h \
        ../../inc/cntabstractrelationship.h \
        ../../inc/cntrelationshipgroup.h \
        ../../inc/cntsymbianfiltersqlhelper.h \
        ../../inc/cntsrvconnection.h \
        ../../inc/qcontactsymbiantransformerror.h

SYMBIAN_SOURCES += \
        ../../src/qcontactsymbianengine_p.cpp \
        ../../src/cnttransformcontact.cpp \
        ../../src/cnttransformcontactdata.cpp \
        ../../src/cnttransformname.cpp \
        ../../src/cnttransformnickname.cpp \
        ../../src/cnttransformphonenumber.cpp \
        ../../src/cnttransformemail.cpp \
        ../../src/cnttransformaddress.cpp \
        ../../src/cnttransformurl.cpp \
        ../../src/cnttransformbirthday.cpp \
        ../../src/cnttransformonlineaccount.cpp \
        ../../src/cnttransformorganisation.cpp \
        ../../src/cnttransformavatar.cpp \
        ../../src/cnttransformsynctarget.cpp \
        ../../src/cnttransformgender.cpp \
        ../../src/cnttransformanniversary.cpp \
        ../../src/cnttransformgeolocation.cpp \
        ../../src/cnttransformnote.cpp \
        ../../src/cnttransformfamily.cpp \
        ../../src/qcontactsymbianfilterdbms.cpp \
        ../../src/qcontactsymbiansorterdbms.cpp \
        ../../src/qcontactsymbianfiltersql.cpp \
        ../../src/cntrelationship.cpp \
        ../../src/cntabstractrelationship.cpp \
        ../../src/cntrelationshipgroup.cpp \
        ../../src/cntsymbianfiltersqlhelper.cpp \
        ../../src/cntsrvconnection.cpp \
        ../../src/qcontactsymbiantransformerror.cpp

# Symbian plugin header and source files
SYMBIAN_HEADERS += \
        ../../inc/qcontactsymbianengine_p.h \
        ../../inc/cnttransformcontact.h \
        ../../inc/cnttransformcontactdata.h \
        ../../inc/cnttransformname.h \
        ../../inc/cnttransformnickname.h \
        ../../inc/cnttransformphonenumber.h \
        ../../inc/cnttransformemail.h \
        ../../inc/cnttransformaddress.h \
        ../../inc/cnttransformurl.h \
        ../../inc/cnttransformbirthday.h \
        ../../inc/cnttransformonlineaccount.h \
        ../../inc/cnttransformorganisation.h \
        ../../inc/cnttransformavatar.h \
        ../../inc/cnttransformsynctarget.h \
        ../../inc/cnttransformgender.h \
        ../../inc/cnttransformanniversary.h \
        ../../inc/cnttransformgeolocation.h \
        ../../inc/cnttransformnote.h \
        ../../inc/cnttransformfamily.h \
        ../../inc/qabstractcontactfilter.h \
        ../../inc/qcontactsymbianfilterdbms.h \
        ../../inc/qcontactsymbianfiltersql.h \
        ../../inc/qcontactsymbiansorterdbms.h \
        ../../inc/qabstractcontactsorter.h \
        ../../inc/cntrelationship.h \
        ../../inc/cntabstractrelationship.h \
        ../../inc/cntrelationshipgroup.h \
        ../../inc/cntsymbianfiltersqlhelper.h \
        ../../inc/cntsrvconnection.h

SYMBIAN_SOURCES += \
        ../../src/qcontactsymbianengine_p.cpp \
        ../../src/cnttransformcontact.cpp \
        ../../src/cnttransformcontactdata.cpp \
        ../../src/cnttransformname.cpp \
        ../../src/cnttransformnickname.cpp \
        ../../src/cnttransformphonenumber.cpp \
        ../../src/cnttransformemail.cpp \
        ../../src/cnttransformaddress.cpp \
        ../../src/cnttransformurl.cpp \
        ../../src/cnttransformbirthday.cpp \
        ../../src/cnttransformonlineaccount.cpp \
        ../../src/cnttransformorganisation.cpp \
        ../../src/cnttransformavatar.cpp \
        ../../src/cnttransformsynctarget.cpp \
        ../../src/cnttransformgender.cpp \
        ../../src/cnttransformanniversary.cpp \
        ../../src/cnttransformgeolocation.cpp \
        ../../src/cnttransformnote.cpp \
        ../../src/cnttransformfamily.cpp \
        ../../src/qcontactsymbianfilterdbms.cpp \
        ../../src/qcontactsymbiansorterdbms.cpp \
        ../../src/qcontactsymbianfiltersql.cpp \
        ../../src/cntrelationship.cpp \
        ../../src/cntabstractrelationship.cpp \
        ../../src/cntrelationshipgroup.cpp \
        ../../src/cntsymbianfiltersqlhelper.cpp \
        ../../src/cntsrvconnection.cpp


QtCreator now default build environment

QtCreator now default build environment

# -------------------------------------------------
# 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
# This file is part of the open groundstation project
# QGroundControl is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# QGroundControl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with QGroundControl. If not, see <http://www.gnu.org/licenses/>.
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains intial 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 {
        message("Linux build")
        CONFIG += LinuxBuild
    } else : android-g++ {
        message("Android build")
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        warning("Android build is experimental and not fully functional")
    } 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
    } 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
        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__
    warning("iOS build is experimental and not yet fully functional")
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

MobileBuild {
    DEFINES += __mobile__
}

# 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)
}

# Need to special case Windows debug_and_release since VS Project creation in this case does strange things [QTBUG-40351]
win32:debug_and_release {
    CONFIG += WindowsDebugAndRelease
}

# Setup our build directories

BASEDIR      = $$IN_PWD
DESTDIR      = $${OUT_PWD}/debug
BUILDDIR     = $${OUT_PWD}/build-debug

ReleaseBuild {
    DESTDIR  = $${OUT_PWD}/release
    BUILDDIR = $${OUT_PWD}/build-release
}

iOSBuild {
    # For whatever reason, the iOS build fails with these set. Some files have the full,
    # properly concatenaded path and file name while others have only the second portion,
    # as if BUILDDIR was empty.
    OBJECTS_DIR = $$(HOME)/tmp/qgcfoo
    MOC_DIR     = $$(HOME)/tmp/qgcfoo
    UI_DIR      = $$(HOME)/tmp/qgcfoo
    RCC_DIR     = $$(HOME)/tmp/qgcfoo
} else {
    OBJECTS_DIR = $${BUILDDIR}/obj
    MOC_DIR     = $${BUILDDIR}/moc
    UI_DIR      = $${BUILDDIR}/ui
    RCC_DIR     = $${BUILDDIR}/rcc
}

LANGUAGE = C++

AndroidBuild {
    target.path = $$DESTDIR
}

# We place the created plugin lib into the objects dir so that make clean will clean it as well
iOSBuild {
    LOCATION_PLUGIN_DESTDIR = $$(HOME)/tmp/qgcfoo
} else {
    LOCATION_PLUGIN_DESTDIR = $$OBJECTS_DIR
}

LOCATION_PLUGIN_NAME = QGeoServiceProviderFactoryQGC

message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET OUTPUT $$OUT_PWD)

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

#
# OS Specific settings
#

AndroidBuild {
    DEFINES += __STDC_LIMIT_MACROS
}

iOSBuild {
    QMAKE_IOS_DEPLOYMENT_TARGET = 7.0
}

MacBuild {
    CONFIG += x86_64
    CONFIG -= x86
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
    QMAKE_MAC_SDK = macosx10.11
}

LinuxBuild {
	DEFINES += __STDC_LIMIT_MACROS
}

WindowsBuild {
	DEFINES += __STDC_LIMIT_MACROS
}

#
# 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
    }
}

WindowsBuild {
	QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot
        /wd4005 \   # silence warnings about macro redefinition
        /wd4290 \   # ignore exception specifications
        /Zc:strictStrings-  # work around win 8.1 sdk sapi.h problem
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG
	WindowsBuild {
		# Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure)
		QMAKE_LFLAGS_LTCG = /LTCG
		QMAKE_CFLAGS_LTCG = -GL

		# Turn on debugging information so we can collect good crash dumps from release builds
		QMAKE_CXXFLAGS_RELEASE += /Zi
		QMAKE_LFLAGS_RELEASE += /DEBUG
    }
}

#
# Unit Test specific configuration goes here
#
# We have to special case Windows debug_and_release builds because you can't have files
# which are only in the debug variant [QTBUG-40351]. So in this case we include unit tests
# even in the release variant. If you want a Windows release build with no unit tests run
# qmake with CONFIG-=debug_and_release CONFIG+=release.
#

DebugBuild|WindowsDebugAndRelease {
    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
# This file is part of the open groundstation project
# QGroundControl is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# QGroundControl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with QGroundControl. If not, see <http://www.gnu.org/licenses/>.
# -------------------------------------------------

#
# This file contains configuration settings which are common to both the QGC Application and
# the Location Plugin. It should mainly contains intial 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 {
        message("Linux build")
        CONFIG += LinuxBuild
    } else : android-g++ {
        message("Android build")
        CONFIG += AndroidBuild MobileBuild
        DEFINES += __android__
        warning("Android build is experimental and not fully functional")
    } 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
    } 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
        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__
    warning("iOS build is experimental and not yet fully functional")
} else {
    error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
}

MobileBuild {
    DEFINES += __mobile__
}

# 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)
}

# Need to special case Windows debug_and_release since VS Project creation in this case does strange things [QTBUG-40351]
win32:debug_and_release {
    CONFIG += WindowsDebugAndRelease
}

# Setup our build directories

BASEDIR      = $$IN_PWD
DESTDIR      = $${OUT_PWD}/debug
BUILDDIR     = $${OUT_PWD}/build-debug

ReleaseBuild {
    DESTDIR  = $${OUT_PWD}/release
    BUILDDIR = $${OUT_PWD}/build-release
}

iOSBuild {
    # For whatever reason, the iOS build fails with these set. Some files have the full,
    # properly concatenaded path and file name while others have only the second portion,
    # as if BUILDDIR was empty.
    OBJECTS_DIR = $$(HOME)/tmp/qgcfoo
    MOC_DIR     = $$(HOME)/tmp/qgcfoo
    UI_DIR      = $$(HOME)/tmp/qgcfoo
    RCC_DIR     = $$(HOME)/tmp/qgcfoo
} else {
    OBJECTS_DIR = $${BUILDDIR}/obj
    MOC_DIR     = $${BUILDDIR}/moc
    UI_DIR      = $${BUILDDIR}/ui
    RCC_DIR     = $${BUILDDIR}/rcc
}

LANGUAGE = C++

AndroidBuild {
    target.path = $$DESTDIR
}

# We place the created plugin lib into the objects dir so that make clean will clean it as well
iOSBuild {
    LOCATION_PLUGIN_DESTDIR = $$(HOME)/tmp/qgcfoo
} else {
    LOCATION_PLUGIN_DESTDIR = $$OBJECTS_DIR
}

LOCATION_PLUGIN_NAME = QGeoServiceProviderFactoryQGC

message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET OUTPUT $$OUT_PWD)

# Turn off serial port warnings
DEFINES += _TTY_NOWARN_

#
# OS Specific settings
#

AndroidBuild {
    DEFINES += __STDC_LIMIT_MACROS
}

iOSBuild {
    QMAKE_IOS_DEPLOYMENT_TARGET = 7.0
}

MacBuild {
    CONFIG += x86_64
    CONFIG -= x86
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
    QMAKE_MAC_SDK = macosx10.11
}

LinuxBuild {
	DEFINES += __STDC_LIMIT_MACROS
}

WindowsBuild {
	DEFINES += __STDC_LIMIT_MACROS
	# Specify multi-process compilation within Visual Studio.
	# (drastically improves compilation times for multi-core computers)
	!jombuild {
		message("When using jom/QtCreator please add CONFIG+=jombuild to your project build settings")
		QMAKE_CXXFLAGS_DEBUG += -MP
		QMAKE_CXXFLAGS_RELEASE += -MP
	}
}

#
# 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
    }
}

WindowsBuild {
	QMAKE_CXXFLAGS_WARN_ON += /W3 \
        /wd4996 \   # silence warnings about deprecated strcpy and whatnot
        /wd4005 \   # silence warnings about macro redefinition
        /wd4290 \   # ignore exception specifications
        /Zc:strictStrings-  # work around win 8.1 sdk sapi.h problem
    WarningsAsErrorsOn {
        QMAKE_CXXFLAGS_WARN_ON += /WX
    }
}

#
# Build-specific settings
#

ReleaseBuild {
    DEFINES += QT_NO_DEBUG
	WindowsBuild {
		# Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure)
		QMAKE_LFLAGS_LTCG = /LTCG
		QMAKE_CFLAGS_LTCG = -GL

		# Turn on debugging information so we can collect good crash dumps from release builds
		QMAKE_CXXFLAGS_RELEASE += /Zi
		QMAKE_LFLAGS_RELEASE += /DEBUG
    }
}

#
# Unit Test specific configuration goes here
#
# We have to special case Windows debug_and_release builds because you can't have files
# which are only in the debug variant [QTBUG-40351]. So in this case we include unit tests
# even in the release variant. If you want a Windows release build with no unit tests run
# qmake with CONFIG-=debug_and_release CONFIG+=release.
#

DebugBuild|WindowsDebugAndRelease {
    DEFINES += UNITTEST_BUILD
}


libsensordatatypes will be now linked from build tree and not from system.

QT += testlib

include(../common-config.pri)

QMAKE_LIBDIR_FLAGS += -L../../datatypes -L../../../datatypes -lsensordatatypes

target.path = /usr/bin
INSTALLS += target

QT += testlib

include(../common-config.pri)

LIBS += -L../../datatypes -L../../../datatypes -lsensordatatypes

target.path = /usr/bin
INSTALLS += target


Improve configure error message

Improve configure error message

# This is a common file for the corelib, plugins and main
# Add with care

isEmpty(PROJECTROOT) {
    message("Building without a rational PROJECTROOT is undefined")
    error("Did you run configure?")
}

qt5 {
    DEFINES += QT5
    QT += v8 network sql quick widgets declarative qml#QDirModel from widgets!
} else {
    QT += declarative script network sql
}

TEMP_DIR = .tmp
OBJECTS_DIR = $$TEMP_DIR/.obj
MOC_DIR = $$TEMP_DIR/.moc

isEmpty(PREFIX) {
    #Use our fuzzy heuristic logic for prefix setting
    mac {
        PREFIX=$$PROJECTROOT
    }
    maemo5 {
        PREFIX=/opt/usr/
    }
    harmattan {
        PREFIX=/opt/qtmediahub/
    }
    isEmpty(PREFIX) {
        PREFIX=/usr/local/
    }
}

DEFINES += "QMH_PREFIX=\\\"$$PREFIX\\\""
DEFINES += "QMH_PROJECTROOT=\\\"$$PROJECTROOT\\\""
DEFINES += "QMH_DBUS_SERVICENAME=\\\"com.nokia.qtmediahub\\\""
DEFINES += "QMH_PLAYER_DBUS_SERVICENAME=\\\"com.nokia.qtmediahub.player\\\""

PKG_CONFIG_PATH=$$(PKG_CONFIG_PATH)
mac:isEmpty(PKG_CONFIG_PATH) {
    message(pkg-config usage on mac requires:)
    message(export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig)
}

# default options
linux* {
    !no-gl:CONFIG += glviewport
}

glgs {
    CONFIG += gl
    DEFINES += GLGS
}

glviewport {
    CONFIG += gl
    DEFINES += GLVIEWPORT
}

gl {
    DEFINES += GL
    QT += opengl
}

mac {
    # QT += webkit multimedia
    CONFIG += no-dbus
    #CONFIG += mobility
    #MOBILITY += multimedia systeminfo
}

!contains(QT_CONFIG, dbus) {
    #This catches dbus free Qt builds
    CONFIG += no-dbus
}

no-dbus {
    message(Disabling dbus support)
    DEFINES += NO_DBUS
}

# This is needed for Maemo5 to recognize minimization of the application window
# Thanks quit coding!
maemo5 {
    QT += dbus
}

CONFIG(debug, debug|release):!qt5:CONFIG += declarative_debug

# Include JS debugger library if QMLJSDEBUGGER_PATH is set
!isEmpty(QMLJSDEBUGGER_PATH) {
    include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
} else {
    DEFINES -= QMLJSDEBUGGER
}

# This is a common file for the corelib, plugins and main
# Add with care

isEmpty(PROJECTROOT) {
    error("Building without PROJECTROOT is not defined")
}

qt5 {
    DEFINES += QT5
    QT += v8 network sql quick widgets declarative qml#QDirModel from widgets!
} else {
    QT += declarative script network sql
}

TEMP_DIR = .tmp
OBJECTS_DIR = $$TEMP_DIR/.obj
MOC_DIR = $$TEMP_DIR/.moc

isEmpty(PREFIX) {
    #Use our fuzzy heuristic logic for prefix setting
    mac {
        PREFIX=$$PROJECTROOT
    }
    maemo5 {
        PREFIX=/opt/usr/
    }
    harmattan {
        PREFIX=/opt/qtmediahub/
    }
    isEmpty(PREFIX) {
        PREFIX=/usr/local/
    }
}

DEFINES += "QMH_PREFIX=\\\"$$PREFIX\\\""
DEFINES += "QMH_PROJECTROOT=\\\"$$PROJECTROOT\\\""
DEFINES += "QMH_DBUS_SERVICENAME=\\\"com.nokia.qtmediahub\\\""
DEFINES += "QMH_PLAYER_DBUS_SERVICENAME=\\\"com.nokia.qtmediahub.player\\\""

PKG_CONFIG_PATH=$$(PKG_CONFIG_PATH)
mac:isEmpty(PKG_CONFIG_PATH) {
    message(pkg-config usage on mac requires:)
    message(export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig)
}

# default options
linux* {
    !no-gl:CONFIG += glviewport
}

glgs {
    CONFIG += gl
    DEFINES += GLGS
}

glviewport {
    CONFIG += gl
    DEFINES += GLVIEWPORT
}

gl {
    DEFINES += GL
    QT += opengl
}

mac {
    # QT += webkit multimedia
    CONFIG += no-dbus
    #CONFIG += mobility
    #MOBILITY += multimedia systeminfo
}

!contains(QT_CONFIG, dbus) {
    #This catches dbus free Qt builds
    CONFIG += no-dbus
}

no-dbus {
    message(Disabling dbus support)
    DEFINES += NO_DBUS
}

# This is needed for Maemo5 to recognize minimization of the application window
# Thanks quit coding!
maemo5 {
    QT += dbus
}

CONFIG(debug, debug|release):!qt5:CONFIG += declarative_debug

# Include JS debugger library if QMLJSDEBUGGER_PATH is set
!isEmpty(QMLJSDEBUGGER_PATH) {
    include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
} else {
    DEFINES -= QMLJSDEBUGGER
}


deployment: skip qmlpropertyeditor files if QTCREATOR_INSTALL_DIR not set (#239)

include(../paths.pri)
TARGETPATH = $$replace(uri, \\., /)
DESIGNER = designer
DESTDIR = $$OUT_PWD/../../imports/$$TARGETPATH

isEmpty(PLUGIN_VERSION): PLUGIN_VERSION = 1.0

# ========== copy additional files ==========
copyqmlinfra.input = QML_INFRA_FILES
copyqmlinfra.output = $$OUT_PWD/../../imports/$$TARGETPATH/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
!win32: copyqmlinfra.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlinfra.output)) $$escape_expand(\n\t)
copyqmlinfra.commands +=  $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copyqmlinfra.CONFIG += no_link no_clean
copyqmlinfra.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmlinfra

copyqmlprivateinfra.input = QML_PRIVATE_INFRA_FILES
copyqmlprivateinfra.output = $$OUT_PWD/../../imports/$$TARGETPATH/Private/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
!win32: copyqmlprivateinfra.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlprivateinfra.output)) $$escape_expand(\n\t)
copyqmlprivateinfra.commands +=  $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copyqmlprivateinfra.CONFIG += no_link no_clean
copyqmlprivateinfra.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmlprivateinfra

copyqmldesigner.input = QML_DESIGNER_FILES
copyqmldesigner.output = $$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/designer/
copyqmldesigner.commands = $(COPY_DIR) ${QMAKE_FILE_IN} $$shell_path($$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/designer/)
copyqmldesigner.CONFIG += no_link no_clean
copyqmldesigner.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmldesigner

exists(QTCREATOR_INSTALL_DIR): CONFIG(release, debug|release): {
    copyqmlpropertyeditor.input = QML_PROPERTY_EDITOR_FILES
    copyqmlpropertyeditor.output = $$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/propertyEditorQmlSources/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
    !win32: copyqmlpropertyeditor.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlpropertyeditor.output)) $$escape_expand(\n\t)
    copyqmlpropertyeditor.commands += $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
    copyqmlpropertyeditor.CONFIG += no_link no_clean
    copyqmlpropertyeditor.variable_out = PRE_TARGETDEPS
    QMAKE_EXTRA_COMPILERS += copyqmlpropertyeditor
}

android: {
    copyjavafiles.input = JAVAFILES
    copyjavafiles.output = $$OUT_PWD/../../src/android/java/
    copyjavafiles.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyjavafiles.output)) $$escape_expand(\n\t)
    copyjavafiles.commands += $(COPY_DIR) ${QMAKE_FILE_IN} $$shell_path($$OUT_PWD/../../src/android/java/)
    copyjavafiles.CONFIG += no_link no_clean
    copyjavafiles.variable_out = PRE_TARGETDEPS
    QMAKE_EXTRA_COMPILERS += copyjavafiles
}

win32: QMAKE_DEL_FILE = del /q /f
!win32:QMAKE_DEL_FILE = rm -r -f
QMAKE_CLEAN += $$OUT_PWD/../../imports/$$TARGETPATH/

# ========== install additional files ==========
isEmpty(QMLPLUGINDUMP): QMLPLUGINDUMP = 1
equals(QMLPLUGINDUMP, 1): !ios: !android: CONFIG(release, debug|release): {
    dumppluginqmltypes.CONFIG = no_files no_path
    dumppluginqmltypes.commands = $$dirname(QMAKE_QMAKE)/qmlplugindump -nonrelocatable "$$uri $$PLUGIN_VERSION $$shell_path($$OUT_PWD/../../imports/) > $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes)"
    INSTALLS += dumppluginqmltypes

    copypluginqmltypes.CONFIG = no_files no_path
# make sure the directory exists
    !win32: copypluginqmltypes.commands = $$QMAKE_MKDIR $$shell_path(${DESTDIR}$$[QT_INSTALL_QML]/$$TARGETPATH/) $$escape_expand(\n\t)
    !win32: copypluginqmltypes.commands += $$QMAKE_COPY $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes) $$shell_path(${DESTDIR}$$[QT_INSTALL_QML]/$$TARGETPATH/plugins.qmltypes)
# ignore any errors on Windows
    win32: copypluginqmltypes.commands = xcopy $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes) $$shell_path($$[QT_INSTALL_QML]/$$TARGETPATH/plugins.qmltypes) /C /E /Q /Y $$escape_expand(\n\t)
    win32: copypluginqmltypes.commands = exit 0
    INSTALLS += copypluginqmltypes
}

copyqmlinfra_install.files = $$QML_INFRA_FILES
copyqmlinfra_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH
INSTALLS += copyqmlinfra_install

copyqmlprivateinfra_install.files = $$QML_PRIVATE_INFRA_FILES
copyqmlprivateinfra_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH/Private
INSTALLS += copyqmlprivateinfra_install

copyqmldesigner_install.files = $$QML_DESIGNER_FILES
copyqmldesigner_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH
INSTALLS += copyqmldesigner_install

exists(QTCREATOR_INSTALL_DIR): CONFIG(release, debug|release): {
    copyqmlpropertyeditor_install.files = $$QML_PROPERTY_EDITOR_FILES
    copyqmlpropertyeditor_install.path = $$QTCREATOR_INSTALL_DIR/share/qtcreator/qmldesigner/propertyEditorQmlSources/$$TARGETPATH
    INSTALLS += copyqmlpropertyeditor_install
}

android: {
    copyjavafiles_install.CONFIG = no_files no_path
    copyjavafiles_install.commands += $(COPY_DIR) $$shell_path($$OUT_PWD/../../src/android) $$shell_path($$[QT_INSTALL_ARCHDATA]/src)
    INSTALLS += copyjavafiles_install
}

target.path = $$[QT_INSTALL_QML]/$$TARGETPATH

INSTALLS += target

OTHER_FILES += \
    $$QML_INFRA_FILES \
    $$QML_PRIVATE_INFRA_FILES \
    $$QML_DESIGNER_FILES \
    $$QML_PROPERTY_EDITOR_FILES \
    $$JAVAFILES

include(../paths.pri)
TARGETPATH = $$replace(uri, \\., /)
DESIGNER = designer
DESTDIR = $$OUT_PWD/../../imports/$$TARGETPATH

isEmpty(PLUGIN_VERSION): PLUGIN_VERSION = 1.0

# ========== copy additional files ==========
copyqmlinfra.input = QML_INFRA_FILES
copyqmlinfra.output = $$OUT_PWD/../../imports/$$TARGETPATH/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
!win32: copyqmlinfra.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlinfra.output)) $$escape_expand(\n\t)
copyqmlinfra.commands +=  $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copyqmlinfra.CONFIG += no_link no_clean
copyqmlinfra.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmlinfra

copyqmlprivateinfra.input = QML_PRIVATE_INFRA_FILES
copyqmlprivateinfra.output = $$OUT_PWD/../../imports/$$TARGETPATH/Private/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
!win32: copyqmlprivateinfra.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlprivateinfra.output)) $$escape_expand(\n\t)
copyqmlprivateinfra.commands +=  $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copyqmlprivateinfra.CONFIG += no_link no_clean
copyqmlprivateinfra.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmlprivateinfra

copyqmldesigner.input = QML_DESIGNER_FILES
copyqmldesigner.output = $$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/designer/
copyqmldesigner.commands = $(COPY_DIR) ${QMAKE_FILE_IN} $$shell_path($$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/designer/)
copyqmldesigner.CONFIG += no_link no_clean
copyqmldesigner.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmldesigner

copyqmlpropertyeditor.input = QML_PROPERTY_EDITOR_FILES
copyqmlpropertyeditor.output = $$OUT_PWD/../../imports/$$DESIGNER/$$TARGETPATH/propertyEditorQmlSources/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
!win32: copyqmlpropertyeditor.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyqmlpropertyeditor.output)) $$escape_expand(\n\t)
copyqmlpropertyeditor.commands += $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copyqmlpropertyeditor.CONFIG += no_link no_clean
copyqmlpropertyeditor.variable_out = PRE_TARGETDEPS
QMAKE_EXTRA_COMPILERS += copyqmlpropertyeditor

android: {
    copyjavafiles.input = JAVAFILES
    copyjavafiles.output = $$OUT_PWD/../../src/android/java/
    copyjavafiles.commands = $$QMAKE_MKDIR $$shell_path($$dirname(copyjavafiles.output)) $$escape_expand(\n\t)
    copyjavafiles.commands += $(COPY_DIR) ${QMAKE_FILE_IN} $$shell_path($$OUT_PWD/../../src/android/java/)
    copyjavafiles.CONFIG += no_link no_clean
    copyjavafiles.variable_out = PRE_TARGETDEPS
    QMAKE_EXTRA_COMPILERS += copyjavafiles
}

win32: QMAKE_DEL_FILE = del /q /f
!win32:QMAKE_DEL_FILE = rm -r -f
QMAKE_CLEAN += $$OUT_PWD/../../imports/$$TARGETPATH/

# ========== install additional files ==========
isEmpty(QMLPLUGINDUMP): QMLPLUGINDUMP = 1
equals(QMLPLUGINDUMP, 1): !ios: !android: CONFIG(release, debug|release): {
    dumppluginqmltypes.CONFIG = no_files no_path
    dumppluginqmltypes.commands = $$dirname(QMAKE_QMAKE)/qmlplugindump -nonrelocatable "$$uri $$PLUGIN_VERSION $$shell_path($$OUT_PWD/../../imports/) > $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes)"
    INSTALLS += dumppluginqmltypes

    copypluginqmltypes.CONFIG = no_files no_path
# make sure the directory exists
    !win32: copypluginqmltypes.commands = $$QMAKE_MKDIR $$shell_path(${DESTDIR}$$[QT_INSTALL_QML]/$$TARGETPATH/) $$escape_expand(\n\t)
    !win32: copypluginqmltypes.commands += $$QMAKE_COPY $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes) $$shell_path(${DESTDIR}$$[QT_INSTALL_QML]/$$TARGETPATH/plugins.qmltypes)
# ignore any errors on Windows
    win32: copypluginqmltypes.commands = xcopy $$shell_path($$OUT_PWD/../../imports/$$TARGETPATH/plugins.qmltypes) $$shell_path($$[QT_INSTALL_QML]/$$TARGETPATH/plugins.qmltypes) /C /E /Q /Y $$escape_expand(\n\t)
    win32: copypluginqmltypes.commands = exit 0
    INSTALLS += copypluginqmltypes
}

copyqmlinfra_install.files = $$QML_INFRA_FILES
copyqmlinfra_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH
INSTALLS += copyqmlinfra_install

copyqmlprivateinfra_install.files = $$QML_PRIVATE_INFRA_FILES
copyqmlprivateinfra_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH/Private
INSTALLS += copyqmlprivateinfra_install

copyqmldesigner_install.files = $$QML_DESIGNER_FILES
copyqmldesigner_install.path = $$[QT_INSTALL_QML]/$$TARGETPATH
INSTALLS += copyqmldesigner_install

copyqmlpropertyeditor_install.files = $$QML_PROPERTY_EDITOR_FILES
copyqmlpropertyeditor_install.path = $$QTCREATOR_INSTALL_DIR/share/qtcreator/qmldesigner/propertyEditorQmlSources/$$TARGETPATH
INSTALLS += copyqmlpropertyeditor_install

android: {
    copyjavafiles_install.CONFIG = no_files no_path
    copyjavafiles_install.commands += $(COPY_DIR) $$shell_path($$OUT_PWD/../../src/android) $$shell_path($$[QT_INSTALL_ARCHDATA]/src)
    INSTALLS += copyjavafiles_install
}

target.path = $$[QT_INSTALL_QML]/$$TARGETPATH

INSTALLS += target

OTHER_FILES += \
    $$QML_INFRA_FILES \
    $$QML_PRIVATE_INFRA_FILES \
    $$QML_DESIGNER_FILES \
    $$QML_PROPERTY_EDITOR_FILES \
    $$JAVAFILES


Add system version pythonqt lookup

Add system version pythonqt lookup

# Add debug if debugmode (only default on for windows)
dbg_ext =
win32:CONFIG(debug, debug|release):dbg_ext = _d
unix:CONFIG(debug, debug|release):dbg_ext =

# Set hompath and libname
pythonqt_home = $${PWD}/pythonqt
pythonqt_lib = $${pythonqt_home}/lib
libname = PythonQt

defineTest(have_local_pythonqt) {
  exists($${pythonqt_lib}) {
    return(true)
  }
  return(false)
}

defineTest(have_system_pythonqt) {
  unix:system(ldconfig -p | grep -q lib$${libname}) {
    return(true)
  }
  return(false)
}

defineTest(have_pythonqt) {
  have_local_pythonqt() {
    return(true)
  }
  have_system_pythonqt() {
    return(true)
  }
  return(false)
}

have_local_pythonqt() {
  INCLUDEPATH *= $${pythonqt_home}/include
  LIBS *= -L$${pythonqt_lib} -l$${libname}$${dbg_ext}
  # Note! The RPATH is absolute and only meant for dev builds in the IDE, on release runtime paths should be stripped
  QMAKE_RPATHDIR *= $${pythonqt_lib}
  message(Found local PythonQt)
} else:have_system_pythonqt() {
  LIBS += -l$${libname}
  message(Found system ldconfig PythonQt)

}

# Add debug if debugmode (only default on for windows)
dbg_ext =
win32:CONFIG(debug, debug|release):dbg_ext = _d
unix:CONFIG(debug, debug|release):dbg_ext =

# Set hompath and libname
pythonqt_home = $${PWD}/pythonqt
pythonqt_lib = $${pythonqt_home}/lib
libname = PythonQt

defineTest(have_pythonqt) {
  exists($${pythonqt_lib}) {
    return(true)
  }
  return(false)
}

have_pythonqt() {
  INCLUDEPATH *= $${pythonqt_home}/include
  LIBS *= -L$${pythonqt_lib} -l$${libname}$${dbg_ext}
  # Note! The RPATH is absolute and only meant for dev builds in the IDE, on release runtime paths should be stripped
  QMAKE_RPATHDIR *= $${pythonqt_lib}
}


version 8.0

version 8.0


Activate C++17 on qmake, see https://forum.qt.io/topic/84269/can-i-use-clang-with-std-c-17-in-qmake/2

#Include libs the windows way, for visual studio 64 bit compiler
#static for VS
#Compile Qt from source
#Refrences for MSVC
# http://amin-ahmadi.com/2016/09/22/how-to-build-qt-5-7-statically-using-msvc14-microsoft-visual-studio-2015/
# https://stackoverflow.com/questions/32735678/how-to-build-qt-5-5-qtwebengine-on-windows-msvc-2015
# configure -prefix "C:\D\QtSDK\5.10.1\msvc2017_64_static" -platform win64-msvc2017 -developer-build -opensource -confirm-license -nomake examples -nomake tests -opengl desktop -debug-and-release -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -sql-sqlite -sql-odbc -make libs
# nmake
# nmake install
CONFIG += static
QMAKE_LFLAGS += -static
QMAKE_CXXFLAGS += /MT
QMAKE_CFLAGS += -O2 -MT
QMAKE_CXXFLAGS += -O2 -MT

DEFINES -= NDEBUG

CONFIG(release, debug|release) {
    message( "release" )
    LIBSPATH = $$PWD/../packages64bit/lib
}
CONFIG(debug, debug|release) {
    message( "debug" )
    LIBSPATH = $$PWD/../packages64bit/debug/lib
}

HEADERS += $$PWD/win/unistd.h
INCLUDEPATH += $$PWD/win

#Command to install dependencies (Static)
#vcpkg.exe install boost:x64-windows-static berkeleydb:x64-windows-static leveldb:x64-windows-static libevent:x64-windows-static lua:x64-windows-static openssl:x64-windows-static zlib:x64-windows-static
#Command to install dependencies (Dynamic)
#vcpkg.exe install boost:x64-windows berkeleydb:x64-windows leveldb:x64-windows libevent:x64-windows lua:x64-windows openssl:x64-windows zlib:x64-windows
DEFINES += BOOST_ASIO_ENABLE_OLD_SERVICES BOOST_SPIRIT_THREADSAFE BOOST_THREAD_USE_LIB
#DEFINES += BOOST_DISABLE_CURRENT_FUNCTION

INCLUDEPATH += $$PWD/../packages64bit/include
DEPENDPATH += $$PWD/../packages64bit/include

LIBS += -L$${LIBSPATH}/ -llua
PRE_TARGETDEPS += $${LIBSPATH}/lua.lib
LIBS += -L$${LIBSPATH} -lboost_chrono-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_chrono-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lboost_filesystem-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_filesystem-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lboost_program_options-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_program_options-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lboost_system-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_system-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lboost_thread-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_thread-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lboost_unit_test_framework-vc140-mt
PRE_TARGETDEPS += $${LIBSPATH}/boost_unit_test_framework-vc140-mt.lib
LIBS += -L$${LIBSPATH}/ -lzlib
PRE_TARGETDEPS += $${LIBSPATH}/zlib.lib
LIBS += -L$${LIBSPATH}/ -llibcryptoMD
PRE_TARGETDEPS += $${LIBSPATH}/libcryptoMD.lib
LIBS += -L$${LIBSPATH}/ -llibsslMD
PRE_TARGETDEPS += $${LIBSPATH}/libsslMD.lib
LIBS += -L$${LIBSPATH}/ -levent
PRE_TARGETDEPS += $${LIBSPATH}/event.lib
LIBS += -L$${LIBSPATH}/ -levent_core
PRE_TARGETDEPS += $${LIBSPATH}/event_core.lib
LIBS += -L$${LIBSPATH}/ -levent_extra
PRE_TARGETDEPS += $${LIBSPATH}/event_extra.lib
LIBS += -L$${LIBSPATH}/ -lWS2_32
PRE_TARGETDEPS += $${LIBSPATH}/WS2_32.lib
LIBS += -L$${LIBSPATH}/ -lAdvAPI32
PRE_TARGETDEPS += $${LIBSPATH}/AdvAPI32.lib
LIBS += -L$${LIBSPATH}/ -lshell32
PRE_TARGETDEPS += $${LIBSPATH}/shell32.lib
LIBS += -L$${LIBSPATH}/ -lUser32
PRE_TARGETDEPS += $${LIBSPATH}/User32.lib
LIBS += -L$${LIBSPATH}/ -lCrypt32
PRE_TARGETDEPS += $${LIBSPATH}/Crypt32.lib
#ShLwApi
LIBS += -L$${LIBSPATH}/ -lShLwApi
PRE_TARGETDEPS += $${LIBSPATH}/ShLwApi.lib

#LevelDB from VCPKG
LIBS += -L$${LIBSPATH}/ -llibleveldb
PRE_TARGETDEPS += $${LIBSPATH}/libleveldb.lib
#BerklyDB4.8 from our project repo (VCPKG version is not supported)
LIBS += -L$${LIBSPATH}/ -llibdb48
PRE_TARGETDEPS += $${LIBSPATH}/libdb48.lib
#libdb_stl48.lib (We need both libdb and libdbstl (Standered library)
LIBS += -L$${LIBSPATH}/ -llibdb_stl48
PRE_TARGETDEPS += $${LIBSPATH}/libdb_stl48.lib

#LIBS += -L$$PWD/../tor/ -ltorlib
#PRE_TARGETDEPS += $$PWD/../tor/torlib.lib
LIBS += -L$$PWD/../leveldb/ -lleveldblib
PRE_TARGETDEPS += $$PWD/../leveldb/leveldblib.lib
#LIBS += -L$$PWD/../db4.8/ -lberkeleydblib
#PRE_TARGETDEPS += $$PWD/../db4.8/berkeleydblib.lib

QMAKE_CFLAGS_WARN_ON -= -W3
QMAKE_CFLAGS_WARN_ON += -W2

QMAKE_CXXFLAGS_WARN_ON -= -W3
QMAKE_CXXFLAGS_WARN_ON += -W2

QMAKE_CXXFLAGS += -O2 -D_FORTIFY_SOURCE=1
QMAKE_CXXFLAGS += c++17


Change DESTDIR to reflect compiler name

Change DESTDIR to reflect compiler name

CONFIG(debug, debug|release) {
	BUILD_TYPE = debug
}
else:CONFIG(release, debug|release) {
	BUILD_TYPE = release
}
else {
	warning("Unknown build type; defaulting to debug")
	BUILD_TYPE = debug
}

OBJECTS_DIR = temp
MOC_DIR = temp
UI_DIR = temp
RCC_DIR = temp

INCLUDEPATH *= \
	$$MOC_DIR \
	$$UI_DIR \
	$$RCC_DIR \
	/usr/include \
	/usr/local/include \
	/usr/include/x86_64-linux-gnu \
	/usr/include/x86_64-linux-gnu/qt5 \
	/usr/include/qt5 \

DESTDIR = $$PWD/../build/$${BUILD_TYPE}-$${QMAKE_CC}/dist

LIBS *= \
	-L/usr/lib \
	-L/usr/local/lib \
	-L/usr/local/clang-3.5.0/lib \
	-L/usr/local/clang-3.6.0/lib \
	-L/usr/local/clang-3.7.0/lib \
	-L/usr/local/clang-3.8.0/lib \

CONFIG(debug, debug|release) {
	BUILD_TYPE = debug
}
else:CONFIG(release, debug|release) {
	BUILD_TYPE = release
}
else {
	warning("Unknown build type; defaulting to debug")
	BUILD_TYPE = debug
}

OBJECTS_DIR = temp
MOC_DIR = temp
UI_DIR = temp
RCC_DIR = temp

INCLUDEPATH *= \
	$$MOC_DIR \
	$$UI_DIR \
	$$RCC_DIR \
	/usr/include \
	/usr/local/include \
	/usr/include/x86_64-linux-gnu \
	/usr/include/x86_64-linux-gnu/qt5 \
	/usr/include/qt5 \

LIBS *= \
	-L/usr/lib \
	-L/usr/local/lib \
	-L/usr/local/clang-3.5.0/lib \
	-L/usr/local/clang-3.6.0/lib \
	-L/usr/local/clang-3.7.0/lib \
	-L/usr/local/clang-3.8.0/lib \

DESTDIR = $$PWD/../build/$${BUILD_TYPE}/dist


Version 0.7

Version 0.7


Changed qmake linker flags for win32-g++ build #13

# Load this from any subproject to link shared libs properly and easy.
#
# Takes a list of paths of shared libs (customLibs). The used list must
# contain 'path/to/lib/name's with path/to/lib relative to the caller.
#
# Example:
# - customLibs = ../path/to/lib/mylib ../other/path/to/otherlib
# - include(loadlibs.pri)
#
# Make sure to provide all libname.pri to set INCLUDEPATH & DEPENDPATH!
#
# Note: include(loadlibs.pri) will setup all given custom libs ->
# -> INCLUDEPATH, DEPENDPATH, LIBS, PRE_TARGETDEPS & QMAKE_LFLAGS.

include($$PWD/win32.pri)

QMAKE_PROJECT_DEPTH = 0 # Forces absolute paths

for(lib, customLibs) {
    !isEmpty(lib) {
        LIBDIR = $$dirname(lib)
        LIBNAME = $$basename(lib)
        #message("$${TARGET} is loading $$LIBNAME -> from: $$LIBDIR")

        # Load lib.pri to set INCLUDEPATH & DEPENDPATH
        exists($$_PRO_FILE_PWD_/$$LIBDIR/$$LIBNAME.pri) {
            include($$_PRO_FILE_PWD_/$$LIBDIR/$${LIBNAME}.pri)
        }
        #message($${INCLUDEPATH})

        #  Set library file extension
        LIB_EXTENSION = $$QMAKE_EXTENSION_SHLIB
        isEmpty(LIB_EXTENSION) {
            macx: LIB_EXTENSION = dylib
            unix:!macx: LIB_EXTENSION = so
        }
        win32 {
            LIB_EXTENSION = $$QMAKE_EXTENSION_STATICLIB
            isEmpty(LIB_EXTENSION) {
                LIB_EXTENSION = lib
            }
        }
        #message($${LIB_EXTENSION})

        # Get library's binary directory
        OUTDIR = $$clean_path($$OUT_PWD/$${LIBDIR})

        macx {
            frameworks += $$files($${OUTDIR}/$${LIBNAME}.framework)
            LIBS += -F$${OUTDIR}/ -framework $${LIBNAME}
            PRE_TARGETDEPS += $${OUTDIR}/$${LIBNAME}.framework
            INCLUDEPATH += -F$${LIBDIR}
        }
        win32 {
            msvc {
                LIBS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
                PRE_TARGETDEPS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
            }
            gcc {
                LIBS += -L$${OUTDIR}/$${WINDIR}/ -l$${LIBNAME}
                PRE_TARGETDEPS += $${OUTDIR}/$${WINDIR}/lib$${LIBNAME}.$${LIB_EXTENSION}
            }
        }
        unix:!macx {
            LIBS += -L$${OUTDIR}/ -l$${LIBNAME}
            PRE_TARGETDEPS += $${OUTDIR}/lib$${LIBNAME}.$${LIB_EXTENSION}
            QMAKE_LFLAGS += "-Wl,-rpath,\'$$OUTDIR\'"
        }
    }
}

macx { # Deploy all linked frameworks to target bundle
    APP_LIB_FILES.files = $$frameworks
    APP_LIB_FILES.path = Contents/Frameworks/
    QMAKE_BUNDLE_DATA += APP_LIB_FILES
}

# Load this from any subproject to link shared libs properly and easy.
#
# Takes a list of paths of shared libs (customLibs). The used list must
# contain 'path/to/lib/name's with path/to/lib relative to the caller.
#
# Example:
# - customLibs = ../path/to/lib/mylib ../other/path/to/otherlib
# - include(loadlibs.pri)
#
# Make sure to provide all libname.pri to set INCLUDEPATH & DEPENDPATH!
#
# Note: include(loadlibs.pri) will setup all given custom libs ->
# -> INCLUDEPATH, DEPENDPATH, LIBS, PRE_TARGETDEPS & QMAKE_LFLAGS.

include($$PWD/win32.pri)

QMAKE_PROJECT_DEPTH = 0 # Forces absolute paths

for(lib, customLibs) {
    !isEmpty(lib) {
        LIBDIR = $$dirname(lib)
        LIBNAME = $$basename(lib)
        #message("$${TARGET} is loading $$LIBNAME -> from: $$LIBDIR")

        # Load lib.pri to set INCLUDEPATH & DEPENDPATH
        exists($$_PRO_FILE_PWD_/$$LIBDIR/$$LIBNAME.pri) {
            include($$_PRO_FILE_PWD_/$$LIBDIR/$${LIBNAME}.pri)
        }
        #message($${INCLUDEPATH})

        #  Set library file extension
        LIB_EXTENSION = $$QMAKE_EXTENSION_SHLIB
        isEmpty(LIB_EXTENSION) {
            macx: LIB_EXTENSION = dylib
            unix:!macx: LIB_EXTENSION = so
        }
        win32 {
            LIB_EXTENSION = $$QMAKE_EXTENSION_STATICLIB
            isEmpty(LIB_EXTENSION) {
                LIB_EXTENSION = lib
            }
        }
        #message($${LIB_EXTENSION})

        # Get library's binary directory
        OUTDIR = $$clean_path($$OUT_PWD/$${LIBDIR})

        macx {
            frameworks += $$files($${OUTDIR}/$${LIBNAME}.framework)
            LIBS += -F$${OUTDIR}/ -framework $${LIBNAME}
            PRE_TARGETDEPS += $${OUTDIR}/$${LIBNAME}.framework
            INCLUDEPATH += -F$${LIBDIR}
        }
        win32 {
            msvc {
                LIBS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
                PRE_TARGETDEPS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
            }
            gcc {
                LIBS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
                PRE_TARGETDEPS += $${OUTDIR}/$${WINDIR}/$${LIBNAME}.$${LIB_EXTENSION}
            }
        }
        unix:!macx {
            LIBS += -L$${OUTDIR}/ -l$${LIBNAME}
            PRE_TARGETDEPS += $${OUTDIR}/lib$${LIBNAME}.$${LIB_EXTENSION}
            QMAKE_LFLAGS += "-Wl,-rpath,\'$$OUTDIR\'"
        }
    }
}

macx { # Deploy all linked frameworks to target bundle
    APP_LIB_FILES.files = $$frameworks
    APP_LIB_FILES.path = Contents/Frameworks/
    QMAKE_BUNDLE_DATA += APP_LIB_FILES
}


define COPASI_EXTUNIT for debug builds. This will enable support for area and length units.

# Begin CVS Header
#   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/common.pri,v $
#   $Revision: 1.104 $
#   $Name:  $
#   $Author: ssahle $
#   $Date: 2009/05/05 01:18:58 $
# End CVS Header

# Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., EML Research, gGmbH, University of Heidelberg,
# and The University of Manchester.
# All rights reserved.

# Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc. and EML Research, gGmbH.
# All rights reserved.

######################################################################
# $Revision: 1.104 $ $Author: ssahle $ $Date: 2009/05/05 01:18:58 $
######################################################################

# In the case the BUILD_OS is not specified we make a guess.
isEmpty(BUILD_OS) {
  win32 {
    BUILD_OS = WIN32

    MY_QT4DIR = $$system(echo %QT4DIR%)
    contains(MY_QT4DIR, %QT4DIR%) {
      MY_QTDIR = $$system(echo %QTDIR%)
      contains(MY_QTDIR, %QTDIR%) {
        QMAKE_QMAKE = qmake.exe
        !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=???.")
      } else {
        QMAKE_QMAKE = $(QTDIR)\bin\qmake.exe
        !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=$(QTDIR).")
      }
	} else {
      !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=$(QT4DIR).")
	}

  } else {
    BUILD_OS = $$system(uname)
    message("Configuring for $${BUILD_OS} with QTDIR=$(QTDIR).")
  }
}
DEFINES += $$BUILD_OS

TARGETDEPS += Makefile

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

#ifdef COPASI_LICENSE_COM
# COPASI License to use
DEFINES -= COPASI_LICENSE_US
DEFINES -= COPASI_LICENSE_DE
DEFINES -= COPASI_LICENSE_COM
DEFINES += COPASI_LICENSE_$$USE_LICENSE
#endif // COPASI_LICENSE_COM

INCLUDEPATH += ../..
QMAKE_CFLAGS   += $$(CFLAGS)
QMAKE_CXXFLAGS += $$(CXXFLAGS)
QMAKE_LFLAGS  += $$(LDFLAGS)

DEFINES += COPASI_TSSA

debug {
  DEFINES += COPASI_DEBUG
  DEFINES += COPASI_EXTUNIT

  isEmpty(COPASI_SRC_PACKAGE) {
    # DEFINES += COPASI_TSS
    #  stoichiometric stability analysis:
    # DEFINES += COPASI_SSA
  }
}

isEmpty(COPASI_SRC_PACKAGE) {
  DEFINES += HAVE_MML
}

contains(STATIC_LINKAGE, yes) {
  DEFINES+=XML_STATIC
  DEFINES+=LIBSBML_STATIC
  DEFINES+=LIBLAX_STATIC
  DEFINES+=RAPTOR_STATIC
  DEFINES+=SBW_STATIC
}

!contains(BUILD_OS, WIN32) {
  #Release code optimization
  QMAKE_CFLAGS_RELEASE -= -O1
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE -= -O4
  QMAKE_CFLAGS_RELEASE += -O3

  QMAKE_CXXFLAGS_RELEASE -= -O1
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE -= -O4
  QMAKE_CXXFLAGS_RELEASE += -O3

  QMAKE_LEX = ../../admin/flex.sh
  QMAKE_YACC = ../../admin/yacc.sh

  # 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")
  }
}

contains(BUILD_OS, Darwin) {
  release {
    contains(TEMPLATE, app) {
      QMAKE_POST_LINK = strip $(TARGET)
    }
  }

  INCLUDEPATH += /System/Library/Frameworks/Accelerate.framework/Headers
  INCLUDEPATH += /System/Library/Frameworks/Carbon.framework/Headers

  !isEmpty(SBML_PATH){
    LIBS +=  $${SBML_PATH}/lib/libsbml.a
    INCLUDEPATH += $${SBML_PATH}/include
  } else {
    LIBS += -lsbml
  }

  !isEmpty(EXPAT_PATH){
    LIBS+=  $${EXPAT_PATH}/lib/libexpat.a
    INCLUDEPATH += $${EXPAT_PATH}/include
  } else {
    LIBS += -lexpat
  }

  !isEmpty(RAPTOR_PATH){
    LIBS+=  $${RAPTOR_PATH}/lib/libraptor.a
    INCLUDEPATH += $${RAPTOR_PATH}/include
  } else {
    LIBS += -lraptor
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX DARWIN
    }

    !isEmpty(QWT_PATH){
       LIBS+=  $${QWT_PATH}/lib/libqwt.a
       INCLUDEPATH += $${QWT_PATH}/include
    } else {
      LIBS += -lqwt
    }

    !isEmpty(QWT3D_PATH){
      LIBS +=  $${QWT3D_PATH}/lib/libqwtplot3d.a
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }
  }

  LIBS += -framework Accelerate
  LIBS += -framework Carbon
  LIBS += -framework QuickTime
  LIBS += -lz
}

contains(BUILD_OS, WIN32) {
  QMAKE_LEX = C:\cygwin\bin\bash ../../admin/flex.sh
  QMAKE_YACC = C:\cygwin\bin\bash ../../admin/yacc.sh

  DEFINES -= UNICODE

  #Release code optimization
  QMAKE_CFLAGS_RELEASE -= -O1
  QMAKE_CFLAGS_RELEASE *= -O2

  QMAKE_CXXFLAGS_RELEASE -= -O1
  QMAKE_CXXFLAGS_RELEASE *= -O2

  !contains(STATIC_LINKAGE, yes) {
    RUNTIME =
  }

  contains(RUNTIME, MT) {
    debug: RUNTIME = MTd

	QMAKE_CFLAGS_MT -= -MD
	QMAKE_CFLAGS_MT *= -MT
	QMAKE_CFLAGS_MT_DBG -= -MDd
	QMAKE_CFLAGS_MT_DBG *= -MTd

	QMAKE_CXXFLAGS_MT -= -MD
	QMAKE_CXXFLAGS_MT *= -MT
	QMAKE_CXXFLAGS_MT_DBG -= -MDd
	QMAKE_CXXFLAGS_MT_DBG *= -MTd

    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrtd.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprtd.lib"

    release: QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmtd.lib"

    debug: QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmt.lib"
  } else {
    release: RUNTIME = MD
    debug: RUNTIME = MDd

	QMAKE_CFLAGS_MT -= -MT
	QMAKE_CFLAGS_MT *= -MD
	QMAKE_CFLAGS_MT_DBG -= -MTd
	QMAKE_CFLAGS_MT_DBG *= -MDd

	QMAKE_CXXFLAGS_MT -= -MT
	QMAKE_CXXFLAGS_MT *= -MD
	QMAKE_CXXFLAGS_MT_DBG -= -MTd
	QMAKE_CXXFLAGS_MT_DBG *= -MDd

    QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmtd.lib"

    release {
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrtd.lib"
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprtd.lib"
    }

    debug {
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrt.lib"
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprt.lib"
    }
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    QMAKE_CXXFLAGS += -I\"$${MKL_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${MKL_PATH}\ia32\lib\"
    QMAKE_LFLAGS += /LIBPATH:\"$${MKL_PATH}\..\Compiler\C++\9.0\IA32\Lib\"
    LIBS += mkl_c.lib
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      QMAKE_CXXFLAGS   += -I\"$${CLAPACK_PATH}\include\"
      QMAKE_LFLAGS += /LIBPATH:\"$${CLAPACK_PATH}\lib\"
      LIBS += clapack.lib
    } else {
      error( "Either MKL_PATH or CLAPACK_PATH must be specified" )
    }
  }

  !isEmpty(EXPAT_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${EXPAT_PATH}\Source\lib\"
    QMAKE_CXXFLAGS   += -I\"$${EXPAT_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\StaticLibs\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\bin\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\lib\"
    contains(STATIC_LINKAGE, yes) {
      LIBS += libexpatMT.lib
    } else {
      LIBS += libexpat.lib
    }
  } else {
    error( "EXPAT_PATH must be specified" )
  }

  win32-msvc2005 {
    contains(STATIC_LINKAGE, yes) {
      LIBS += libsbml$${RUNTIME}.lib
    } else {
      release: LIBS += libsbml.lib
      debug:   LIBS += libsbmlD.lib
    }
  } else {
    LIBS += libsbml.lib
  }

  !isEmpty(SBML_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${SBML_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${SBML_PATH}\lib\"
    QMAKE_LFLAGS += /LIBPATH:\"$${SBML_PATH}\bin\"
  } else {
    error( "SBML_PATH must be specified" )
  }

# The raptor library
  contains(STATIC_LINKAGE, yes) {
    LIBS += raptor$${RUNTIME}.lib
  } else {
    release: LIBS += raptor.lib
    debug:   LIBS += raptorD.lib
  }

  !isEmpty(RAPTOR_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${RAPTOR_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${RAPTOR_PATH}\lib\"
  } else {
    error( "RAPTOR_PATH must be specified" )
  }

  contains(CONFIG, qt) {
    contains(STATIC_LINKAGE, yes) {
      DEFINES += SBW_STATIC
      LIBS += SBW$${RUNTIME}.lib ws2_32.lib
    } else {
      release: LIBS += SBW.lib
      debug:   LIBS += SBWD.lib
    }

    !isEmpty(SBW_PATH){
      QMAKE_CXXFLAGS   += -I"$${SBW_PATH}\include"
      QMAKE_LFLAGS += /LIBPATH:"$${SBW_PATH}\lib"

      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES *= WIN32
    }

    !isEmpty(QWT_PATH){
       LIBS+=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    }
    release: LIBS += -lqwtplot3d
    debug: LIBS += -lqwtplot3dD
  }
}

contains(BUILD_OS, SunOS) {
contains(STATIC_LINKAGE, yes) {
# :TODO: This should be set through configure.
  LIBS += -L/export/home/shoops/copasi/gcc/lib
}

  release {
    contains(TEMPLATE, app) {
# Note: This must be the SunOS strip command.
      QMAKE_POST_LINK = /usr/ccs/bin/strip $(TARGET)
    }
  }

  !isEmpty(CLAPACK_PATH) {
    DEFINES += USE_CLAPACK
    INCLUDEPATH += $${CLAPACK_PATH}/include
#    LIBS += -llapack -lblas -lF77 -lfl
    LIBS += -llapack -lblas -lF77
    LIBS += -L$${CLAPACK_PATH}/lib
  } else {
    !isEmpty(LAPACK_PATH) {
      message("Using lapack.")
      DEFINES += USE_LAPACK
      INCLUDEPATH += $${LAPACK_PATH}/include
      LIBS += -llapack -lblas  -lg2c
      LIBS += -L$${LAPACK_PATH}/lib
    } else {
      message("Using sunperf.")
      DEFINES += USE_SUNPERF
      LIBS += -lsunperf
      QMAKE_CFLAGS   += -dalign
      QMAKE_CXXFLAGS   += -dalign
    }
  }
  !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 += -lsbml -lexpat

# The raptor library
  LIBS += -lraptor
  !isEmpty(RAPTOR_PATH){
      LIBS+=  -L$${RAPTOR_PATH}/lib
      INCLUDEPATH += $${RAPTOR_PATH}/include
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX SOLARIS
    }

    !isEmpty(QWT_PATH){
       LIBS+=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }

    LIBS += -lSM
  } else {
    QMAKE_LIBS_THREAD -= -lpthread
    QMAKE_LIBS_THREAD -= -lrt
  }
}

contains(BUILD_OS, Linux) {
  release {
    contains(TEMPLATE, app) {
      QMAKE_POST_LINK = strip $(TARGET)
    }
  }

  contains(PACKAGE, yes) {
    QMAKE_LFLAGS -= -static
  }
  else {
    contains(STATIC_LINKAGE, yes) {
      QMAKE_LFLAGS += -static
    }
    else {
      QMAKE_LFLAGS -= -static
    }
  }

  !isEmpty(SBML_PATH){
    INCLUDEPATH += $${SBML_PATH}/include
    INCLUDEPATH += $${SBML_PATH}/include/sbml

    contains(PACKAGE, yes) {
      LIBS += $${SBML_PATH}/lib/libsbml.a
    }
    else {
      LIBS += -L$${SBML_PATH}/lib
      LIBS += -lsbml
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("SBML_PATH must be given.")
    }
    else {
      LIBS += -lsbml
    }
  }

  !isEmpty(EXPAT_PATH){
    INCLUDEPATH += $${EXPAT_PATH}/include

    contains(PACKAGE, yes) {
      LIBS += $${EXPAT_PATH}/lib/libexpat.a
    }
    else {
      LIBS += -L$${EXPAT_PATH}/lib
      LIBS += -lexpat
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("EXPAT_PATH must be given.")
    }
    else {
      LIBS += -lexpat
    }
  }

# The raptor library
  !isEmpty(RAPTOR_PATH){
      LIBS +=  -L$${RAPTOR_PATH}/lib
      INCLUDEPATH += $${RAPTOR_PATH}/include

    contains(PACKAGE, yes) {
      LIBS += $${RAPTOR_PATH}/lib/libraptor.a
    }
    else {
      LIBS += -L$${RAPTOR_PATH}/lib
      LIBS += -lraptor
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("RAPTOR_PATH must be given.")
    }
    else {
      LIBS += -lraptor
    }
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    INCLUDEPATH += $${MKL_PATH}/include
#    LIBS += -lmkl_lapack -lmkl_ia32 -lg2c -lpthread
    LIBS += -lmkl_lapack -lmkl_ia32 -lguide -lpthread
    LIBS  +=  -L$${MKL_PATH}/lib/32
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      INCLUDEPATH += $${CLAPACK_PATH}/include
#      LIBS += -llapack -lblas -lF77 -lfl
      LIBS += -llapack -lblas -lF77
      LIBS += -L$${CLAPACK_PATH}/lib
    } else {
      !isEmpty(LAPACK_PATH) {
        message("Using lapack.")
        DEFINES += USE_LAPACK
        INCLUDEPATH += $${LAPACK_PATH}/include

        contains(PACKAGE, yes) {
          LIBS += $${LAPACK_PATH}/lib/liblapack.a
          LIBS += $${LAPACK_PATH}/lib/libblas.a
          LIBS += $$system(locate libg2c.a)
        }
        else {
          LIBS += -L$${LAPACK_PATH}/lib
          LIBS += -llapack
          LIBS += -lblas
          HAVE_G2C = $$system(locate libg2c)
          !isEmpty(HAVE_G2C) LIBS += -lg2c
        }
      } else {
        error( "Either MKL_PATH, CLAPACK_PATH, or LAPACK_PATH must be specified" )
      }
    }
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX
    }

    !isEmpty(QWT_PATH){
       LIBS +=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }
  }
}

DEP1.target   = depend
DEP1.depends  = qmake

QMAKE_EXTRA_UNIX_TARGETS += DEP1

!equals(TEMPLATE, subdirs) {
  # Copy the sources for the tar ball
  src_distribution.depends = Makefile
  src_distribution.commands =   \
    $(CHK_DIR_EXISTS) ../../copasi_src || $(MKDIR) ../../copasi_src; \
    $(CHK_DIR_EXISTS) ../../copasi_src/copasi || \
      $(MKDIR) ../../copasi_src/copasi; \
    $(CHK_DIR_EXISTS) ../../copasi_src/copasi/$$SRC_TARGET || \
      $(MKDIR) ../../copasi_src/copasi/$$SRC_TARGET; \
    $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) \
      ../../copasi_src/copasi/$$SRC_TARGET/

  QMAKE_EXTRA_UNIX_TARGETS += src_distribution
}

# addSubdirs(subdirs,deps): Adds directories to the project that depend on
# other directories
defineTest(addSubdirs) {
    for(subdirs, 1) {
        entries = $$files($$subdirs)
        for(entry, entries) {
            name = $$replace(entry, [/\\\\], _)
            SUBDIRS += $$name
            eval ($${name}.subdir = $$entry)
            for(dep, 2):eval ($${name}.depends += $$replace(dep, [/\\\\], _))
            export ($${name}.subdir)
            export ($${name}.depends)
        }
    }
    export (SUBDIRS)
}

# Begin CVS Header
#   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/common.pri,v $
#   $Revision: 1.103 $
#   $Name:  $
#   $Author: shoops $
#   $Date: 2009/04/21 16:12:03 $
# End CVS Header

# Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., EML Research, gGmbH, University of Heidelberg,
# and The University of Manchester.
# All rights reserved.

# Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc. and EML Research, gGmbH.
# All rights reserved.

######################################################################
# $Revision: 1.103 $ $Author: shoops $ $Date: 2009/04/21 16:12:03 $
######################################################################

# In the case the BUILD_OS is not specified we make a guess.
isEmpty(BUILD_OS) {
  win32 {
    BUILD_OS = WIN32

    MY_QT4DIR = $$system(echo %QT4DIR%)
    contains(MY_QT4DIR, %QT4DIR%) {
      MY_QTDIR = $$system(echo %QTDIR%)
      contains(MY_QTDIR, %QTDIR%) {
        QMAKE_QMAKE = qmake.exe
        !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=???.")
      } else {
        QMAKE_QMAKE = $(QTDIR)\bin\qmake.exe
        !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=$(QTDIR).")
      }
	} else {
      !build_pass: message("Configuring for $${BUILD_OS} with QTDIR=$(QT4DIR).")
	}

  } else {
    BUILD_OS = $$system(uname)
    message("Configuring for $${BUILD_OS} with QTDIR=$(QTDIR).")
  }
}
DEFINES += $$BUILD_OS

TARGETDEPS += Makefile

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

#ifdef COPASI_LICENSE_COM
# COPASI License to use
DEFINES -= COPASI_LICENSE_US
DEFINES -= COPASI_LICENSE_DE
DEFINES -= COPASI_LICENSE_COM
DEFINES += COPASI_LICENSE_$$USE_LICENSE
#endif // COPASI_LICENSE_COM

INCLUDEPATH += ../..
QMAKE_CFLAGS   += $$(CFLAGS)
QMAKE_CXXFLAGS += $$(CXXFLAGS)
QMAKE_LFLAGS  += $$(LDFLAGS)

DEFINES += COPASI_TSSA

debug {
  DEFINES += COPASI_DEBUG

  isEmpty(COPASI_SRC_PACKAGE) {
    # DEFINES += COPASI_TSS
    #  stoichiometric stability analysis:
    # DEFINES += COPASI_SSA
  }
}

isEmpty(COPASI_SRC_PACKAGE) {
  DEFINES += HAVE_MML
}

contains(STATIC_LINKAGE, yes) {
  DEFINES+=XML_STATIC
  DEFINES+=LIBSBML_STATIC
  DEFINES+=LIBLAX_STATIC
  DEFINES+=RAPTOR_STATIC
  DEFINES+=SBW_STATIC
}

!contains(BUILD_OS, WIN32) {
  #Release code optimization
  QMAKE_CFLAGS_RELEASE -= -O1
  QMAKE_CFLAGS_RELEASE -= -O2
  QMAKE_CFLAGS_RELEASE -= -O4
  QMAKE_CFLAGS_RELEASE += -O3

  QMAKE_CXXFLAGS_RELEASE -= -O1
  QMAKE_CXXFLAGS_RELEASE -= -O2
  QMAKE_CXXFLAGS_RELEASE -= -O4
  QMAKE_CXXFLAGS_RELEASE += -O3

  QMAKE_LEX = ../../admin/flex.sh
  QMAKE_YACC = ../../admin/yacc.sh

  # 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")
  }
}

contains(BUILD_OS, Darwin) {
  release {
    contains(TEMPLATE, app) {
      QMAKE_POST_LINK = strip $(TARGET)
    }
  }

  INCLUDEPATH += /System/Library/Frameworks/Accelerate.framework/Headers
  INCLUDEPATH += /System/Library/Frameworks/Carbon.framework/Headers

  !isEmpty(SBML_PATH){
    LIBS +=  $${SBML_PATH}/lib/libsbml.a
    INCLUDEPATH += $${SBML_PATH}/include
  } else {
    LIBS += -lsbml
  }

  !isEmpty(EXPAT_PATH){
    LIBS+=  $${EXPAT_PATH}/lib/libexpat.a
    INCLUDEPATH += $${EXPAT_PATH}/include
  } else {
    LIBS += -lexpat
  }

  !isEmpty(RAPTOR_PATH){
    LIBS+=  $${RAPTOR_PATH}/lib/libraptor.a
    INCLUDEPATH += $${RAPTOR_PATH}/include
  } else {
    LIBS += -lraptor
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX DARWIN
    }

    !isEmpty(QWT_PATH){
       LIBS+=  $${QWT_PATH}/lib/libqwt.a
       INCLUDEPATH += $${QWT_PATH}/include
    } else {
      LIBS += -lqwt
    }

    !isEmpty(QWT3D_PATH){
      LIBS +=  $${QWT3D_PATH}/lib/libqwtplot3d.a
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }
  }

  LIBS += -framework Accelerate
  LIBS += -framework Carbon
  LIBS += -framework QuickTime
  LIBS += -lz
}

contains(BUILD_OS, WIN32) {
  QMAKE_LEX = C:\cygwin\bin\bash ../../admin/flex.sh
  QMAKE_YACC = C:\cygwin\bin\bash ../../admin/yacc.sh

  DEFINES -= UNICODE

  #Release code optimization
  QMAKE_CFLAGS_RELEASE -= -O1
  QMAKE_CFLAGS_RELEASE *= -O2

  QMAKE_CXXFLAGS_RELEASE -= -O1
  QMAKE_CXXFLAGS_RELEASE *= -O2

  !contains(STATIC_LINKAGE, yes) {
    RUNTIME =
  }

  contains(RUNTIME, MT) {
    debug: RUNTIME = MTd

	QMAKE_CFLAGS_MT -= -MD
	QMAKE_CFLAGS_MT *= -MT
	QMAKE_CFLAGS_MT_DBG -= -MDd
	QMAKE_CFLAGS_MT_DBG *= -MTd

	QMAKE_CXXFLAGS_MT -= -MD
	QMAKE_CXXFLAGS_MT *= -MT
	QMAKE_CXXFLAGS_MT_DBG -= -MDd
	QMAKE_CXXFLAGS_MT_DBG *= -MTd

    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrtd.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprtd.lib"

    release: QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmtd.lib"

    debug: QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmt.lib"
  } else {
    release: RUNTIME = MD
    debug: RUNTIME = MDd

	QMAKE_CFLAGS_MT -= -MT
	QMAKE_CFLAGS_MT *= -MD
	QMAKE_CFLAGS_MT_DBG -= -MTd
	QMAKE_CFLAGS_MT_DBG *= -MDd

	QMAKE_CXXFLAGS_MT -= -MT
	QMAKE_CXXFLAGS_MT *= -MD
	QMAKE_CXXFLAGS_MT_DBG -= -MTd
	QMAKE_CXXFLAGS_MT_DBG *= -MDd

    QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmt.lib"
    QMAKE_LFLAGS *= /NODEFAULTLIB:"libcmtd.lib"

    release {
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrtd.lib"
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprtd.lib"
    }

    debug {
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcrt.lib"
      QMAKE_LFLAGS *= /NODEFAULTLIB:"msvcprt.lib"
    }
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    QMAKE_CXXFLAGS += -I\"$${MKL_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${MKL_PATH}\ia32\lib\"
    QMAKE_LFLAGS += /LIBPATH:\"$${MKL_PATH}\..\Compiler\C++\9.0\IA32\Lib\"
    LIBS += mkl_c.lib
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      QMAKE_CXXFLAGS   += -I\"$${CLAPACK_PATH}\include\"
      QMAKE_LFLAGS += /LIBPATH:\"$${CLAPACK_PATH}\lib\"
      LIBS += clapack.lib
    } else {
      error( "Either MKL_PATH or CLAPACK_PATH must be specified" )
    }
  }

  !isEmpty(EXPAT_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${EXPAT_PATH}\Source\lib\"
    QMAKE_CXXFLAGS   += -I\"$${EXPAT_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\StaticLibs\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\bin\"
    QMAKE_LFLAGS += /LIBPATH:\"$${EXPAT_PATH}\lib\"
    contains(STATIC_LINKAGE, yes) {
      LIBS += libexpatMT.lib
    } else {
      LIBS += libexpat.lib
    }
  } else {
    error( "EXPAT_PATH must be specified" )
  }

  win32-msvc2005 {
    contains(STATIC_LINKAGE, yes) {
      LIBS += libsbml$${RUNTIME}.lib
    } else {
      release: LIBS += libsbml.lib
      debug:   LIBS += libsbmlD.lib
    }
  } else {
    LIBS += libsbml.lib
  }

  !isEmpty(SBML_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${SBML_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${SBML_PATH}\lib\"
    QMAKE_LFLAGS += /LIBPATH:\"$${SBML_PATH}\bin\"
  } else {
    error( "SBML_PATH must be specified" )
  }

# The raptor library
  contains(STATIC_LINKAGE, yes) {
    LIBS += raptor$${RUNTIME}.lib
  } else {
    release: LIBS += raptor.lib
    debug:   LIBS += raptorD.lib
  }

  !isEmpty(RAPTOR_PATH) {
    QMAKE_CXXFLAGS   += -I\"$${RAPTOR_PATH}\include\"
    QMAKE_LFLAGS += /LIBPATH:\"$${RAPTOR_PATH}\lib\"
  } else {
    error( "RAPTOR_PATH must be specified" )
  }

  contains(CONFIG, qt) {
    contains(STATIC_LINKAGE, yes) {
      DEFINES += SBW_STATIC
      LIBS += SBW$${RUNTIME}.lib ws2_32.lib
    } else {
      release: LIBS += SBW.lib
      debug:   LIBS += SBWD.lib
    }

    !isEmpty(SBW_PATH){
      QMAKE_CXXFLAGS   += -I"$${SBW_PATH}\include"
      QMAKE_LFLAGS += /LIBPATH:"$${SBW_PATH}\lib"

      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES *= WIN32
    }

    !isEmpty(QWT_PATH){
       LIBS+=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    }
    release: LIBS += -lqwtplot3d
    debug: LIBS += -lqwtplot3dD
  }
}

contains(BUILD_OS, SunOS) {
contains(STATIC_LINKAGE, yes) {
# :TODO: This should be set through configure.
  LIBS += -L/export/home/shoops/copasi/gcc/lib
}

  release {
    contains(TEMPLATE, app) {
# Note: This must be the SunOS strip command.
      QMAKE_POST_LINK = /usr/ccs/bin/strip $(TARGET)
    }
  }

  !isEmpty(CLAPACK_PATH) {
    DEFINES += USE_CLAPACK
    INCLUDEPATH += $${CLAPACK_PATH}/include
#    LIBS += -llapack -lblas -lF77 -lfl
    LIBS += -llapack -lblas -lF77
    LIBS += -L$${CLAPACK_PATH}/lib
  } else {
    !isEmpty(LAPACK_PATH) {
      message("Using lapack.")
      DEFINES += USE_LAPACK
      INCLUDEPATH += $${LAPACK_PATH}/include
      LIBS += -llapack -lblas  -lg2c
      LIBS += -L$${LAPACK_PATH}/lib
    } else {
      message("Using sunperf.")
      DEFINES += USE_SUNPERF
      LIBS += -lsunperf
      QMAKE_CFLAGS   += -dalign
      QMAKE_CXXFLAGS   += -dalign
    }
  }
  !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 += -lsbml -lexpat

# The raptor library
  LIBS += -lraptor
  !isEmpty(RAPTOR_PATH){
      LIBS+=  -L$${RAPTOR_PATH}/lib
      INCLUDEPATH += $${RAPTOR_PATH}/include
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX SOLARIS
    }

    !isEmpty(QWT_PATH){
       LIBS+=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }

    LIBS += -lSM
  } else {
    QMAKE_LIBS_THREAD -= -lpthread
    QMAKE_LIBS_THREAD -= -lrt
  }
}

contains(BUILD_OS, Linux) {
  release {
    contains(TEMPLATE, app) {
      QMAKE_POST_LINK = strip $(TARGET)
    }
  }

  contains(PACKAGE, yes) {
    QMAKE_LFLAGS -= -static
  }
  else {
    contains(STATIC_LINKAGE, yes) {
      QMAKE_LFLAGS += -static
    }
    else {
      QMAKE_LFLAGS -= -static
    }
  }

  !isEmpty(SBML_PATH){
    INCLUDEPATH += $${SBML_PATH}/include
    INCLUDEPATH += $${SBML_PATH}/include/sbml

    contains(PACKAGE, yes) {
      LIBS += $${SBML_PATH}/lib/libsbml.a
    }
    else {
      LIBS += -L$${SBML_PATH}/lib
      LIBS += -lsbml
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("SBML_PATH must be given.")
    }
    else {
      LIBS += -lsbml
    }
  }

  !isEmpty(EXPAT_PATH){
    INCLUDEPATH += $${EXPAT_PATH}/include

    contains(PACKAGE, yes) {
      LIBS += $${EXPAT_PATH}/lib/libexpat.a
    }
    else {
      LIBS += -L$${EXPAT_PATH}/lib
      LIBS += -lexpat
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("EXPAT_PATH must be given.")
    }
    else {
      LIBS += -lexpat
    }
  }

# The raptor library
  !isEmpty(RAPTOR_PATH){
      LIBS +=  -L$${RAPTOR_PATH}/lib
      INCLUDEPATH += $${RAPTOR_PATH}/include

    contains(PACKAGE, yes) {
      LIBS += $${RAPTOR_PATH}/lib/libraptor.a
    }
    else {
      LIBS += -L$${RAPTOR_PATH}/lib
      LIBS += -lraptor
    }
  }
  else {
    contains(PACKAGE, yes) {
      error("RAPTOR_PATH must be given.")
    }
    else {
      LIBS += -lraptor
    }
  }

  !isEmpty(MKL_PATH) {
    DEFINES += USE_MKL
    INCLUDEPATH += $${MKL_PATH}/include
#    LIBS += -lmkl_lapack -lmkl_ia32 -lg2c -lpthread
    LIBS += -lmkl_lapack -lmkl_ia32 -lguide -lpthread
    LIBS  +=  -L$${MKL_PATH}/lib/32
  } else {
    !isEmpty(CLAPACK_PATH) {
      DEFINES += USE_CLAPACK
      INCLUDEPATH += $${CLAPACK_PATH}/include
#      LIBS += -llapack -lblas -lF77 -lfl
      LIBS += -llapack -lblas -lF77
      LIBS += -L$${CLAPACK_PATH}/lib
    } else {
      !isEmpty(LAPACK_PATH) {
        message("Using lapack.")
        DEFINES += USE_LAPACK
        INCLUDEPATH += $${LAPACK_PATH}/include

        contains(PACKAGE, yes) {
          LIBS += $${LAPACK_PATH}/lib/liblapack.a
          LIBS += $${LAPACK_PATH}/lib/libblas.a
          LIBS += $$system(locate libg2c.a)
        }
        else {
          LIBS += -L$${LAPACK_PATH}/lib
          LIBS += -llapack
          LIBS += -lblas
          HAVE_G2C = $$system(locate libg2c)
          !isEmpty(HAVE_G2C) LIBS += -lg2c
        }
      } else {
        error( "Either MKL_PATH, CLAPACK_PATH, or LAPACK_PATH must be specified" )
      }
    }
  }

  contains(CONFIG, qt) {
    !isEmpty(SBW_PATH){
      LIBS+=  $${SBW_PATH}/lib/libSBW.a
      INCLUDEPATH += $${SBW_PATH}/include
      DEFINES += COPASI_SBW_INTEGRATION
      DEFINES += LINUX
    }

    !isEmpty(QWT_PATH){
       LIBS +=  -L$${QWT_PATH}/lib
       INCLUDEPATH += $${QWT_PATH}/include
    }
    LIBS += -lqwt

    !isEmpty(QWT3D_PATH){
      LIBS += -L$${QWT3D_PATH}/lib/
      INCLUDEPATH += $${QWT3D_PATH}/include
    } else {
      LIBS += -lqwtplot3d
    }
  }
}

DEP1.target   = depend
DEP1.depends  = qmake

QMAKE_EXTRA_UNIX_TARGETS += DEP1

!equals(TEMPLATE, subdirs) {
  # Copy the sources for the tar ball
  src_distribution.depends = Makefile
  src_distribution.commands =   \
    $(CHK_DIR_EXISTS) ../../copasi_src || $(MKDIR) ../../copasi_src; \
    $(CHK_DIR_EXISTS) ../../copasi_src/copasi || \
      $(MKDIR) ../../copasi_src/copasi; \
    $(CHK_DIR_EXISTS) ../../copasi_src/copasi/$$SRC_TARGET || \
      $(MKDIR) ../../copasi_src/copasi/$$SRC_TARGET; \
    $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) \
      ../../copasi_src/copasi/$$SRC_TARGET/

  QMAKE_EXTRA_UNIX_TARGETS += src_distribution
}

# addSubdirs(subdirs,deps): Adds directories to the project that depend on
# other directories
defineTest(addSubdirs) {
    for(subdirs, 1) {
        entries = $$files($$subdirs)
        for(entry, entries) {
            name = $$replace(entry, [/\\\\], _)
            SUBDIRS += $$name
            eval ($${name}.subdir = $$entry)
            for(dep, 2):eval ($${name}.depends += $$replace(dep, [/\\\\], _))
            export ($${name}.subdir)
            export ($${name}.depends)
        }
    }
    export (SUBDIRS)
}