QGCExternalLibs.pri 6.58 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1
#
2
# [REQUIRED] Add support for <inttypes.h> to Windows.
Don Gagne's avatar
Don Gagne committed
3 4 5 6 7 8
#
WindowsBuild {
    INCLUDEPATH += libs/lib/msinttypes
}

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

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

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

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

34
isEmpty(MAVLINKPATH) {
35 36 37 38 39 40
    exists(user_config.pri):infile(user_config.pri, MAVLINKPATH) {
        MAVLINKPATH     = $$fromfile(user_config.pri, MAVLINKPATH)
        message($$sprintf("Using user-supplied mavlink path '%1' specified in user_config.pri", $$MAVLINKPATH))
    } else {
        MAVLINKPATH     = $$BASEDIR/$$MAVLINKPATH_REL
    }
41
}
42

43
isEmpty(MAVLINK_CONF) {
44 45 46 47 48 49
    exists(user_config.pri):infile(user_config.pri, MAVLINK_CONF) {
        MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
        message($$sprintf("Using user-supplied mavlink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF))
    } else {
        MAVLINK_CONF = ardupilotmega
    }
50 51 52 53 54 55 56
}

# If defined, all APM specific MAVLink messages are disabled
contains (CONFIG, QGC_DISABLE_APM_MAVLINK) {
    message("Disable APM MAVLink support")
    DEFINES += NO_ARDUPILOT_DIALECT
}
Don Gagne's avatar
Don Gagne committed
57

58 59 60
# First we select the dialect, checking for valid user selection
# Users can override all other settings by specifying MAVLINK_CONF as an argument to qmake
!isEmpty(MAVLINK_CONF) {
61
    message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
Don Gagne's avatar
Don Gagne committed
62
}
63 64

# Then we add the proper include paths dependent on the dialect.
Don Gagne's avatar
Don Gagne committed
65
INCLUDEPATH += $$MAVLINKPATH
Lorenz Meier's avatar
Lorenz Meier committed
66 67 68 69 70 71 72 73 74 75

exists($$MAVLINKPATH/common) {
    !isEmpty(MAVLINK_CONF) {
        count(MAVLINK_CONF, 1) {
            exists($$MAVLINKPATH/$$MAVLINK_CONF) {
                INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF
                DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$MAVLINK_CONF))
            } else {
                error($$sprintf("MAVLink dialect '%1' does not exist at '%2'!", $$MAVLINK_CONF, $$MAVLINKPATH_REL))
            }
76
        } else {
Lorenz Meier's avatar
Lorenz Meier committed
77
            error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
78 79
        }
    } else {
Lorenz Meier's avatar
Lorenz Meier committed
80
        INCLUDEPATH += $$MAVLINKPATH/common
81
    }
Don Gagne's avatar
Don Gagne committed
82
} else {
Lorenz Meier's avatar
Lorenz Meier committed
83
    error($$sprintf("MAVLink folder does not exist at '%1'! Run 'git submodule init && git submodule update' on the command line.",$$MAVLINKPATH_REL))
Don Gagne's avatar
Don Gagne committed
84 85 86
}

#
87 88
# [REQUIRED] EIGEN matrix library
# NOMINMAX constant required to make internal min/max work.
Don Gagne's avatar
Don Gagne committed
89 90 91
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

92 93 94 95 96 97 98
#
# [REQUIRED] shapelib library
INCLUDEPATH += libs/shapelib
SOURCES += \
    libs/shapelib/shpopen.c \
    libs/shapelib/safileio.c

Don Gagne's avatar
Don Gagne committed
99
#
100
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
Don Gagne's avatar
Don Gagne committed
101
#
Don Gagne's avatar
Don Gagne committed
102
!MobileBuild {
103 104 105
include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
Don Gagne's avatar
Don Gagne committed
106
}
Don Gagne's avatar
Don Gagne committed
107 108

#
109 110 111
# [REQUIRED] SDL dependency. Provides joystick/gamepad support.
# The SDL is packaged with QGC for the Mac and Windows. Linux support requires installing the SDL
# library (development libraries and static binaries).
Don Gagne's avatar
Don Gagne committed
112 113 114
#
MacBuild {
    INCLUDEPATH += \
115
        $$BASEDIR/libs/lib/Frameworks/SDL2.framework/Headers
Don Gagne's avatar
Don Gagne committed
116 117 118

    LIBS += \
        -F$$BASEDIR/libs/lib/Frameworks \
119
        -framework SDL2
120
} else:LinuxBuild {
121
    PKGCONFIG = sdl2
122
} else:WindowsBuild {
123
    INCLUDEPATH += $$BASEDIR/libs/lib/sdl2/msvc/include
Don Gagne's avatar
Don Gagne committed
124

125 126 127 128 129
    contains(QT_ARCH, i386) {
        LIBS += -L$$BASEDIR/libs/lib/sdl2/msvc/lib/x86
    } else {
        LIBS += -L$$BASEDIR/libs/lib/sdl2/msvc/lib/x64
    }
dogmaphobic's avatar
dogmaphobic committed
130
    LIBS += \
131 132
        -lSDL2main \
        -lSDL2
Don Gagne's avatar
Don Gagne committed
133 134
}

135 136 137 138 139 140 141 142 143 144
AndroidBuild {
    contains(QT_ARCH, arm) {
        ANDROID_EXTRA_LIBS += $$BASEDIR/libs/AndroidOpenSSL/arch-armeabi-v7a/lib/libcrypto.so
        ANDROID_EXTRA_LIBS += $$BASEDIR/libs/AndroidOpenSSL/arch-armeabi-v7a/lib/libssl.so
    } else {
        ANDROID_EXTRA_LIBS += $$BASEDIR/libs/AndroidOpenSSL/arch-x86/lib/libcrypto.so
        ANDROID_EXTRA_LIBS += $$BASEDIR/libs/AndroidOpenSSL/arch-x86/lib/libssl.so
    }
}

145 146 147 148 149 150 151 152 153 154 155 156 157
#
# [OPTIONAL] Zeroconf for UDP links
#
contains (DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from command line)")
    DEFINES -= DISABLE_ZEROCONF
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_ZEROCONF) {
    message("Skipping support for Zeroconf (manual override from user_config.pri)")
# Mac support is built into OS
} else:MacBuild|iOSBuild {
    message("Including support for Zeroconf (Bonjour)")
    DEFINES += QGC_ZEROCONF_ENABLED
Gus Grubba's avatar
Gus Grubba committed
158 159
} else {
    message("Skipping support for Zeroconf (unsupported platform)")
160 161
}

162 163 164 165 166 167 168 169 170 171 172

#
# [OPTIONAL] AirMap Support
#
contains (DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from command line)")
# Otherwise the user can still disable this feature in the user_config.pri file.
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_AIRMAP) {
    message("Skipping support for AirMap (manual override from user_config.pri)")
} else {
    AIRMAPD_PATH = $$PWD/libs/airmapd
Gus Grubba's avatar
Gus Grubba committed
173
    MacBuild {
174
        exists($${AIRMAPD_PATH}/macOS/Qt.5.11.0) {
175
            message("Including support for AirMap for macOS")
176
            LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.11.0 -lairmap-qt
177
            DEFINES += QGC_AIRMAP_ENABLED
178
        }
179
    } else:LinuxBuild {
180
        exists($${AIRMAPD_PATH}/linux/Qt.5.11.0) {
181
            message("Including support for AirMap for Linux")
182
            LIBS += -L$${AIRMAPD_PATH}/linux/Qt.5.11.0 -lairmap-qt
183
            DEFINES += QGC_AIRMAP_ENABLED
184
        }
185
    } else {
186 187 188 189 190
        message("Skipping support for Airmap (unsupported platform)")
    }
    contains (DEFINES, QGC_AIRMAP_ENABLED) {
        INCLUDEPATH += \
            $${AIRMAPD_PATH}/include
191 192
    }
}