Skip to content
Snippets Groups Projects
QGCCommon.pri 7.16 KiB
Newer Older
  • Learn to ignore specific revisions
  • # -------------------------------------------------
    # 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
    
    nopeppermint's avatar
    nopeppermint committed
    # 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 {
    
    Daniel Agar's avatar
    Daniel Agar committed
        linux-g++ | linux-g++-64 | linux-g++-32 | linux-clang {
    
            message("Linux build")
            CONFIG += LinuxBuild
    
    dogmaphobic's avatar
    dogmaphobic committed
            DEFINES += __STDC_LIMIT_MACROS
    
    Daniel Agar's avatar
    Daniel Agar committed
    		linux-clang {
    			message("Linux clang")
    			QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
    		}
    
    ChukRhodes's avatar
    ChukRhodes committed
        } else : linux-rasp-pi2-g++ {
            message("Linux R-Pi2 build")
            CONFIG += LinuxBuild
            DEFINES += __STDC_LIMIT_MACROS __rasp_pi2__
    
    dogmaphobic's avatar
    dogmaphobic committed
        } else : android-g++ {
            message("Android build")
    
    dogmaphobic's avatar
    dogmaphobic committed
            CONFIG += AndroidBuild MobileBuild
    
    dogmaphobic's avatar
    dogmaphobic committed
            DEFINES += __android__
    
    dogmaphobic's avatar
    dogmaphobic committed
            DEFINES += __STDC_LIMIT_MACROS
    
    dogmaphobic's avatar
    dogmaphobic committed
            DEFINES += QGC_ENABLE_BLUETOOTH
    
    dogmaphobic's avatar
    dogmaphobic committed
            target.path = $$DESTDIR
    
        } 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
    
    dogmaphobic's avatar
    dogmaphobic committed
            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
    
    dogmaphobic's avatar
    dogmaphobic committed
            DEFINES += __macos__
    
    dogmaphobic's avatar
    dogmaphobic committed
            CONFIG += x86_64
            CONFIG -= x86
    
    equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
            QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
    } else {
    
    dogmaphobic's avatar
    dogmaphobic committed
            QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
    
    dogmaphobic's avatar
    dogmaphobic committed
            QMAKE_MAC_SDK = macosx10.11
    
            QMAKE_CXXFLAGS += -fvisibility=hidden
        } else {
            error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
        }
    
    dogmaphobic's avatar
    dogmaphobic committed
    } else : ios {
    
    dogmaphobic's avatar
    dogmaphobic committed
        !equals(QT_MAJOR_VERSION, 5) | !greaterThan(QT_MINOR_VERSION, 4) {
            error("Unsupported Qt version, 5.5.x or greater is required for iOS")
        }
    
    dogmaphobic's avatar
    dogmaphobic committed
        message("iOS build")
        CONFIG += iOSBuild MobileBuild app_bundle
        DEFINES += __ios__
    
    dogmaphobic's avatar
    dogmaphobic committed
        QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
    
        QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
    
    dogmaphobic's avatar
    dogmaphobic committed
        QMAKE_LFLAGS += -Wl,-no_pie
    
    } else {
    
    dogmaphobic's avatar
    dogmaphobic committed
        error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported")
    }
    
    MobileBuild {
        DEFINES += __mobile__
    
    dogmaphobic's avatar
    dogmaphobic committed
    # set the QGC version from git
    
    exists ($$PWD/.git) {
    
        GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags)
        GIT_HASH     = $$system(git rev-parse HEAD)
        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_DESCRIBE} hash $${GIT_HASH})
        } else {
            message(QGroundControl version $${VERSION} describe $${GIT_DESCRIBE} hash $${GIT_HASH})
        }
    
    dogmaphobic's avatar
    dogmaphobic committed
    } else {
    
        GIT_DESCRIBE    = None
        GIT_HASH        = None
        VERSION         = 0.0.0   # Marker to indicate out-of-tree build
        MAC_VERSION     = 0.0.0
        MAC_BUILD       = 0
    
    DEFINES += GIT_TAG=\"\\\"$$GIT_DESCRIBE\\\"\"
    DEFINES += GIT_HASH=\"\\\"$$GIT_HASH\\\"\"
    
    dogmaphobic's avatar
    dogmaphobic committed
    
    
    # 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
    
    
    dogmaphobic's avatar
    dogmaphobic committed
    BASEDIR      = $$IN_PWD
    
    dogmaphobic's avatar
    dogmaphobic committed
    !iOSBuild {
    
    dogmaphobic's avatar
    dogmaphobic committed
        OBJECTS_DIR  = $${OUT_PWD}/obj
        MOC_DIR      = $${OUT_PWD}/moc
        UI_DIR       = $${OUT_PWD}/ui
        RCC_DIR      = $${OUT_PWD}/rcc
    
    dogmaphobic's avatar
    dogmaphobic committed
    }
    
    LANGUAGE = C++
    
    
    dogmaphobic's avatar
    dogmaphobic committed
    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 {
    
    dogmaphobic's avatar
    dogmaphobic committed
        QMAKE_CXXFLAGS_WARN_ON += -Wall
    
        WarningsAsErrorsOn {
            QMAKE_CXXFLAGS_WARN_ON += -Werror
        }
    
    Don Gagne's avatar
    Don Gagne committed
        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
    
    dogmaphobic's avatar
    dogmaphobic committed
        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
        }
    
    dogmaphobic's avatar
    dogmaphobic committed
    
    
        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
    #
    
    
        DEFINES += UNITTEST_BUILD
    }