QGCExternalLibs.pri 8.56 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
# Mavlink dialect is hardwired to arudpilotmega for now. The reason being
# the current codebase supports both PX4 and APM flight stack. PX4 flight stack
Ricardo de Almeida Gonzaga's avatar
Ricardo de Almeida Gonzaga committed
12
# only usese common mavlink specifications, whereas APM flight stack uses custom
13 14
# mavlink specifications which add to common. So by using the adupilotmega dialect
# QGC can support both in the same codebase.
15
#
16 17 18 19
# 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.

Don Gagne's avatar
Don Gagne committed
20
MAVLINKPATH_REL = libs/mavlink/include/mavlink/v2.0
21
MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL
22
MAVLINK_CONF = ardupilotmega
Don Gagne's avatar
Don Gagne committed
23 24
DEFINES += MAVLINK_NO_DATA

25 26 27
# 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) {
28
    message($$sprintf("Using MAVLink dialect '%1'.", $$MAVLINK_CONF))
Don Gagne's avatar
Don Gagne committed
29
}
30 31

# Then we add the proper include paths dependent on the dialect.
Don Gagne's avatar
Don Gagne committed
32
INCLUDEPATH += $$MAVLINKPATH
Lorenz Meier's avatar
Lorenz Meier committed
33 34 35 36 37 38 39 40 41 42

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))
            }
43
        } else {
Lorenz Meier's avatar
Lorenz Meier committed
44
            error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
45 46
        }
    } else {
Lorenz Meier's avatar
Lorenz Meier committed
47
        INCLUDEPATH += $$MAVLINKPATH/common
48
    }
Don Gagne's avatar
Don Gagne committed
49
} else {
Lorenz Meier's avatar
Lorenz Meier committed
50
    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
51 52 53
}

#
54 55
# [REQUIRED] EIGEN matrix library
# NOMINMAX constant required to make internal min/max work.
Don Gagne's avatar
Don Gagne committed
56 57 58 59
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

#
60
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
Don Gagne's avatar
Don Gagne committed
61
#
Don Gagne's avatar
Don Gagne committed
62
!MobileBuild {
63 64 65
include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
Don Gagne's avatar
Don Gagne committed
66
}
Don Gagne's avatar
Don Gagne committed
67 68

#
69
# [OPTIONAL] XBee wireless support. This is not necessary for basic serial/UART communications.
70 71 72 73 74
# It's only required for speaking directly to the Xbee using their proprietary API.
# Unsupported on Mac.
# Installation on Windows is unnecessary, as we just link to our included .dlls directly.
# Installing on Linux involves running `make;sudo make install` in `libs/thirdParty/libxbee`
# Uninstalling from Linux can be done with `sudo make uninstall`.
Don Gagne's avatar
Don Gagne committed
75
#
76
XBEE_DEPENDENT_HEADERS += \
dogmaphobic's avatar
dogmaphobic committed
77 78 79 80 81
    src/comm/XbeeLinkInterface.h \
    src/comm/XbeeLink.h \
    src/comm/HexSpinBox.h \
    src/ui/XbeeConfigurationWindow.h \
    src/comm/CallConv.h
82
XBEE_DEPENDENT_SOURCES += \
dogmaphobic's avatar
dogmaphobic committed
83 84 85
    src/comm/XbeeLink.cpp \
    src/comm/HexSpinBox.cpp \
    src/ui/XbeeConfigurationWindow.cpp
86
XBEE_DEFINES = QGC_XBEE_ENABLED
87 88

contains(DEFINES, DISABLE_XBEE) {
dogmaphobic's avatar
dogmaphobic committed
89 90
    message("Skipping support for native XBee API (manual override from command line)")
    DEFINES -= DISABLE_XBEE
91
# Otherwise the user can still disable this feature in the user_config.pri file.
92
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_XBEE) {
93
    message("Skipping support for native XBee API (manual override from user_config.pri)")
94
} else:LinuxBuild {
95 96 97
        linux-g++-64 {
            message("Skipping support for XBee API (64-bit Linux builds not supported)")
        } else:exists(/usr/include/xbee.h) {
dogmaphobic's avatar
dogmaphobic committed
98
        message("Including support for XBee API")
99

dogmaphobic's avatar
dogmaphobic committed
100 101 102 103 104 105 106
        HEADERS += $$XBEE_DEPENDENT_HEADERS
        SOURCES += $$XBEE_DEPENDENT_SOURCES
        DEFINES += $$XBEE_DEFINES
        LIBS += -L/usr/lib -lxbee
    } else {
        warning("Skipping support for XBee API (missing libraries, see README)")
    }
107
} else:WindowsBuild {
dogmaphobic's avatar
dogmaphobic committed
108 109 110 111 112
    message("Including support for XBee API")
    HEADERS += $$XBEE_DEPENDENT_HEADERS
    SOURCES += $$XBEE_DEPENDENT_SOURCES
    DEFINES += $$XBEE_DEFINES
    INCLUDEPATH += libs/thirdParty/libxbee
113
        LIBS += -l$$BASEDIR/libs/thirdParty/libxbee/lib/libxbee
Don Gagne's avatar
Don Gagne committed
114
} else {
dogmaphobic's avatar
dogmaphobic committed
115
    message("Skipping support for XBee API (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
116 117 118
}

#
119
# [OPTIONAL] Opal RT-LAB Library. Provides integration with Opal-RT's RT-LAB simulator.
Don Gagne's avatar
Don Gagne committed
120
#
121
contains(DEFINES, DISABLE_RTLAB) {
dogmaphobic's avatar
dogmaphobic committed
122 123
    message("Skipping support for RT-LAB (manual override from command line)")
    DEFINES -= DISABLE_RTLAB
124
# Otherwise the user can still disable this feature in the user_config.pri file.
125
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_RTLAB) {
126
    message("Skipping support for RT-LAB (manual override from user_config.pri)")
127
} else:WindowsBuild {
dogmaphobic's avatar
dogmaphobic committed
128 129
    exists(src/lib/opalrt/OpalApi.h) : exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) {
        message("Including support for RT-LAB")
130

dogmaphobic's avatar
dogmaphobic committed
131
        DEFINES += QGC_RTLAB_ENABLED
132

dogmaphobic's avatar
dogmaphobic committed
133 134 135
        INCLUDEPATH +=
            src/lib/opalrt
            libs/lib/opal/include \
136

dogmaphobic's avatar
dogmaphobic committed
137
        FORMS += src/ui/OpalLinkSettings.ui
138

dogmaphobic's avatar
dogmaphobic committed
139 140 141 142 143 144 145
        HEADERS += \
            src/comm/OpalRT.h \
            src/comm/OpalLink.h \
            src/comm/Parameter.h \
            src/comm/QGCParamID.h \
            src/comm/ParameterList.h \
            src/ui/OpalLinkConfigurationWindow.h
146

dogmaphobic's avatar
dogmaphobic committed
147 148 149 150 151 152 153
        SOURCES += \
            src/comm/OpalRT.cc \
            src/comm/OpalLink.cc \
            src/comm/Parameter.cc \
            src/comm/QGCParamID.cc \
            src/comm/ParameterList.cc \
            src/ui/OpalLinkConfigurationWindow.cc
154

dogmaphobic's avatar
dogmaphobic committed
155 156 157 158 159 160
        LIBS += \
            -LC:/OPAL-RT/RT-LAB7.2.4/Common/bin \
            -lOpalApi
    } else {
        warning("Skipping support for RT-LAB (missing libraries, see README)")
    }
Don Gagne's avatar
Don Gagne committed
161
} else {
162
    message("Skipping support for RT-LAB (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
163 164 165
}

#
166 167 168
# [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
169 170 171
#
MacBuild {
    INCLUDEPATH += \
172
        $$BASEDIR/libs/lib/Frameworks/SDL2.framework/Headers
Don Gagne's avatar
Don Gagne committed
173 174 175

    LIBS += \
        -F$$BASEDIR/libs/lib/Frameworks \
176
        -framework SDL2
177
} else:LinuxBuild {
178
    PKGCONFIG = sdl2
179
} else:WindowsBuild {
dogmaphobic's avatar
dogmaphobic committed
180
    INCLUDEPATH += \
181
        $$BASEDIR/libs/lib/sdl2/msvc/include \
Don Gagne's avatar
Don Gagne committed
182

dogmaphobic's avatar
dogmaphobic committed
183
    LIBS += \
184
        -L$$BASEDIR/libs/lib/sdl2/msvc/lib/x86 \
185 186
        -lSDL2main \
        -lSDL2
Don Gagne's avatar
Don Gagne committed
187 188
}

189
##
190
# [OPTIONAL] Speech synthesis library support.
191
# Can be forcibly disabled by adding a `DEFINES+=DISABLE_SPEECH` argument to qmake.
192
# Linux support requires the eSpeak speech synthesizer (espeak).
193 194
# Mac support is provided in Snow Leopard and newer (10.6+)
# Windows is supported as of Windows 7
Don Gagne's avatar
Don Gagne committed
195
#
196
contains (DEFINES, DISABLE_SPEECH) {
dogmaphobic's avatar
dogmaphobic committed
197 198
    message("Skipping support for speech output (manual override from command line)")
    DEFINES -= DISABLE_SPEECH
199
# Otherwise the user can still disable this feature in the user_config.pri file.
200
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_SPEECH) {
201
    message("Skipping support for speech output (manual override from user_config.pri)")
202
} else:LinuxBuild {
dogmaphobic's avatar
dogmaphobic committed
203 204 205 206 207 208 209 210
    exists(/usr/include/espeak) | exists(/usr/local/include/espeak) {
        message("Including support for speech output")
        DEFINES += QGC_SPEECH_ENABLED
        LIBS += \
        -lespeak
    } else {
        warning("Skipping support for speech output (missing libraries, see README)")
    }
211
}
212
# Mac support is built into OS 10.6+.
dogmaphobic's avatar
dogmaphobic committed
213
else:MacBuild|iOSBuild {
214 215
    message("Including support for speech output")
    DEFINES += QGC_SPEECH_ENABLED
216
}
217 218
# Windows supports speech through native API.
else:WindowsBuild {
219 220 221
    message("Including support for speech output")
    DEFINES += QGC_SPEECH_ENABLED
    LIBS    += -lOle32
Don Gagne's avatar
Don Gagne committed
222
}
dogmaphobic's avatar
dogmaphobic committed
223 224 225 226 227
# Android supports speech through native (Java) API.
else:AndroidBuild {
    message("Including support for speech output")
    DEFINES += QGC_SPEECH_ENABLED
}
228 229 230 231 232 233 234 235 236 237 238 239 240 241

#
# [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
242 243
} else {
    message("Skipping support for Zeroconf (unsupported platform)")
244 245
}