QGCExternalLibs.pri 14.4 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
# Some logic is involved here in selecting the proper dialect for
# the selected autopilot system.
Don Gagne's avatar
Don Gagne committed
12
#
13
# If the user config file exists, it will be included. If this file
14 15 16
# specifies the MAVLINK_CONF variable with a MAVLink dialect, support 
# for it will be compiled in to QGC. It will also create a 
# QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use within the actual code.
17 18 19
#
MAVLINKPATH_REL = libs/mavlink/include/mavlink/v1.0
MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL
Don Gagne's avatar
Don Gagne committed
20 21
DEFINES += MAVLINK_NO_DATA

22 23 24
# 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) {
25
    message($$sprintf("Using MAVLink dialect '%1' specified at the command line.", $$MAVLINK_CONF))
26
}
27
# Otherwise they can specify MAVLINK_CONF within user_config.pri
28
else:exists(user_config.pri):infile(user_config.pri, MAVLINK_CONF) {
29
    MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
30
    !isEmpty(MAVLINK_CONF) {
31
        message($$sprintf("Using MAVLink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF))
32
    }
Don Gagne's avatar
Don Gagne committed
33
}
34 35

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

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))
            }
47
        } else {
Lorenz Meier's avatar
Lorenz Meier committed
48
            error(Only a single mavlink dialect can be specified in MAVLINK_CONF)
49 50
        }
    } else {
Lorenz Meier's avatar
Lorenz Meier committed
51 52
        warning("No MAVLink dialect specified, only common messages supported.")
        INCLUDEPATH += $$MAVLINKPATH/common
53
    }
Don Gagne's avatar
Don Gagne committed
54
} else {
Lorenz Meier's avatar
Lorenz Meier committed
55
    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
56 57 58
}

#
59
# [OPTIONAL] OpenSceneGraph
60 61 62 63 64 65 66
# Allow the user to override OpenSceneGraph compilation through a DISABLE_OPEN_SCENE_GRAPH
# define like: `qmake DEFINES=DISABLE_OPEN_SCENE_GRAPH`
contains(DEFINES, DISABLE_OPEN_SCENE_GRAPH) {
    message("Skipping support for OpenSceneGraph (manual override from command line)")
    DEFINES -= DISABLE_OPEN_SCENE_GRAPH
}
# Otherwise the user can still disable this feature in the user_config.pri file.
67
else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_OPEN_SCENE_GRAPH) {
68 69 70
    message("Skipping support for OpenSceneGraph (manual override from user_config.pri)")
}
else:MacBuild {
Don Gagne's avatar
Don Gagne committed
71
    # GLUT and OpenSceneGraph are part of standard install on Mac
72
	message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
73 74 75 76 77 78 79 80
	CONFIG += OSGDependency

    INCLUDEPATH += \
        $$BASEDIR/libs/lib/mac64/include

	LIBS += \
        -L$$BASEDIR/libs/lib/mac64/lib \
        -losgWidget
81
} else:LinuxBuild {
Don Gagne's avatar
Don Gagne committed
82
	exists(/usr/include/osg) | exists(/usr/local/include/osg) {
83
		message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
84
        CONFIG += OSGDependency
85 86
	} else {
		warning("Skipping support for OpenSceneGraph (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
87
	}
88
} else:WindowsBuild {
Don Gagne's avatar
Don Gagne committed
89
	exists($$BASEDIR/libs/lib/osg123) {
90
		message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
91 92 93 94 95 96 97
        CONFIG += OSGDependency

		INCLUDEPATH += \
            $$BASEDIR/libs/lib/osgEarth/win32/include \
			$$BASEDIR/libs/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/include

		LIBS += -L$$BASEDIR/libs/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/lib
98 99
	} else {
		warning("Skipping support for OpenSceneGraph (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
100
	}
101 102
} else {
    message("Skipping support for OpenSceneGraph (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
}

OSGDependency {
	DEFINES += QGC_OSG_ENABLED
    
    LIBS += \
        -losg \
        -losgViewer \
        -losgGA \
        -losgDB \
        -losgText \
        -lOpenThreads

    HEADERS += \
        src/ui/map3D/gpl.h \
        src/ui/map3D/CameraParams.h \
        src/ui/map3D/ViewParamWidget.h \
        src/ui/map3D/SystemContainer.h \
        src/ui/map3D/SystemViewParams.h \
        src/ui/map3D/GlobalViewParams.h \
        src/ui/map3D/SystemGroupNode.h \
        src/ui/map3D/Q3DWidget.h \
        src/ui/map3D/GCManipulator.h \
        src/ui/map3D/ImageWindowGeode.h \
        src/ui/map3D/PixhawkCheetahNode.h \
        src/ui/map3D/Pixhawk3DWidget.h \
        src/ui/map3D/Q3DWidgetFactory.h \
        src/ui/map3D/WebImageCache.h \
        src/ui/map3D/WebImage.h \
        src/ui/map3D/TextureCache.h \
        src/ui/map3D/Texture.h \
        src/ui/map3D/Imagery.h \
        src/ui/map3D/HUDScaleGeode.h \
        src/ui/map3D/WaypointGroupNode.h \
        src/ui/map3D/TerrainParamDialog.h \
        src/ui/map3D/ImageryParamDialog.h
        
    SOURCES += \
        src/ui/map3D/gpl.cc \
        src/ui/map3D/CameraParams.cc \
        src/ui/map3D/ViewParamWidget.cc \
        src/ui/map3D/SystemContainer.cc \
        src/ui/map3D/SystemViewParams.cc \
        src/ui/map3D/GlobalViewParams.cc \
        src/ui/map3D/SystemGroupNode.cc \
        src/ui/map3D/Q3DWidget.cc \
        src/ui/map3D/ImageWindowGeode.cc \
        src/ui/map3D/GCManipulator.cc \
        src/ui/map3D/PixhawkCheetahNode.cc \
        src/ui/map3D/Pixhawk3DWidget.cc \
        src/ui/map3D/Q3DWidgetFactory.cc \
        src/ui/map3D/WebImageCache.cc \
        src/ui/map3D/WebImage.cc \
        src/ui/map3D/TextureCache.cc \
        src/ui/map3D/Texture.cc \
        src/ui/map3D/Imagery.cc \
        src/ui/map3D/HUDScaleGeode.cc \
        src/ui/map3D/WaypointGroupNode.cc \
        src/ui/map3D/TerrainParamDialog.cc \
        src/ui/map3D/ImageryParamDialog.cc
}

#
166 167
# [OPTIONAL] Google Earth dependency. Provides Google Earth view to supplement 2D map view.
# Only supported on Mac and Windows where Google Earth can be installed.
Don Gagne's avatar
Don Gagne committed
168
#
169
contains(DEFINES, DISABLE_GOOGLE_EARTH) {
170
    message("Skipping support for Google Earth view (manual override from command line)")
171
    DEFINES -= DISABLE_GOOGLE_EARTH
172 173
}
# Otherwise the user can still disable this feature in the user_config.pri file.
174
else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_GOOGLE_EARTH) {
175
    message("Skipping support for Google Earth view (manual override from user_config.pri)")
176 177
} else:MacBuild {
    message("Including support for Google Earth view")
178
    DEFINES += QGC_GOOGLE_EARTH_ENABLED
Don Gagne's avatar
Don Gagne committed
179 180 181 182 183 184 185
    HEADERS += src/ui/map3D/QGCGoogleEarthView.h \
                src/ui/map3D/QGCWebPage.h \
                src/ui/QGCWebView.h
    SOURCES += src/ui/map3D/QGCGoogleEarthView.cc \
                src/ui/map3D/QGCWebPage.cc \
                src/ui/QGCWebView.cc
    FORMS += src/ui/QGCWebView.ui
186 187
} else:WindowsBuild {
    message("Including support for Google Earth view")
188
    DEFINES += QGC_GOOGLE_EARTH_ENABLED
Don Gagne's avatar
Don Gagne committed
189 190 191 192 193 194 195
    HEADERS += src/ui/map3D/QGCGoogleEarthView.h \
                src/ui/map3D/QGCWebPage.h \
                src/ui/QGCWebView.h
    SOURCES += src/ui/map3D/QGCGoogleEarthView.cc \
                src/ui/map3D/QGCWebPage.cc \
                src/ui/QGCWebView.cc
    FORMS += src/ui/QGCWebView.ui
196
    QT += axcontainer
Don Gagne's avatar
Don Gagne committed
197
} else {
198
    message("Skipping support for Google Earth view (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
199 200 201
}

#
202 203
# [REQUIRED] EIGEN matrix library
# NOMINMAX constant required to make internal min/max work.
Don Gagne's avatar
Don Gagne committed
204 205 206 207
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

#
208
# [REQUIRED] OPMapControl library from OpenPilot. Provides 2D mapping functionality.
Don Gagne's avatar
Don Gagne committed
209 210 211 212 213 214 215 216 217
#
include(libs/opmapcontrol/opmapcontrol_external.pri)

INCLUDEPATH += \
    libs/utils \
    libs \
    libs/opmapcontrol

#
218
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
Don Gagne's avatar
Don Gagne committed
219
#
220 221 222
include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
Don Gagne's avatar
Don Gagne committed
223 224

#
225
# [OPTIONAL] XBee wireless support. This is not necessary for basic serial/UART communications.
226 227 228 229 230
# 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
231
#
232 233 234 235 236 237 238 239 240 241
XBEE_DEPENDENT_HEADERS += \
	src/comm/XbeeLinkInterface.h \
	src/comm/XbeeLink.h \
	src/comm/HexSpinBox.h \
	src/ui/XbeeConfigurationWindow.h \
	src/comm/CallConv.h
XBEE_DEPENDENT_SOURCES += \
	src/comm/XbeeLink.cpp \
	src/comm/HexSpinBox.cpp \
	src/ui/XbeeConfigurationWindow.cpp
242
XBEE_DEFINES = QGC_XBEE_ENABLED
243 244

contains(DEFINES, DISABLE_XBEE) {
245
	message("Skipping support for native XBee API (manual override from command line)")
246
	DEFINES -= DISABLE_XBEE
247
# Otherwise the user can still disable this feature in the user_config.pri file.
248
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_XBEE) {
249
    message("Skipping support for native XBee API (manual override from user_config.pri)")
250
} else:LinuxBuild {
251 252 253
        linux-g++-64 {
            message("Skipping support for XBee API (64-bit Linux builds not supported)")
        } else:exists(/usr/include/xbee.h) {
254 255 256 257 258
		message("Including support for XBee API")

		HEADERS += $$XBEE_DEPENDENT_HEADERS
		SOURCES += $$XBEE_DEPENDENT_SOURCES
		DEFINES += $$XBEE_DEFINES
259
		LIBS += -L/usr/lib -lxbee
260
	} else {
261
		warning("Skipping support for XBee API (missing libraries, see README)")
262 263 264 265 266 267 268
	}
} else:WindowsBuild {
	message("Including support for XBee API")
	HEADERS += $$XBEE_DEPENDENT_HEADERS
	SOURCES += $$XBEE_DEPENDENT_SOURCES
	DEFINES += $$XBEE_DEFINES
	INCLUDEPATH += libs/thirdParty/libxbee
269
        LIBS += -l$$BASEDIR/libs/thirdParty/libxbee/lib/libxbee
Don Gagne's avatar
Don Gagne committed
270
} else {
271
	message("Skipping support for XBee API (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
272 273 274
}

#
275
# [OPTIONAL] Magellan 3DxWare library. Provides support for 3DConnexion's 3D mice.
Don Gagne's avatar
Don Gagne committed
276
#
277
contains(DEFINES, DISABLE_3DMOUSE) {
278
	message("Skipping support for 3DConnexion mice (manual override from command line)")
279
	DEFINES -= DISABLE_3DMOUSE
280
# Otherwise the user can still disable this feature in the user_config.pri file.
281
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_3DMOUSE) {
282
    message("Skipping support for 3DConnexion mice (manual override from user_config.pri)")
283 284 285
} else:LinuxBuild {
	exists(/usr/local/lib/libxdrvlib.so) {
		message("Including support for 3DConnexion mice")
Don Gagne's avatar
Don Gagne committed
286

287
                DEFINES += \
288
		QGC_MOUSE_ENABLED_LINUX \
289 290
                ParameterCheck
                # Hack: Has to be defined for magellan usage
Don Gagne's avatar
Don Gagne committed
291

292 293 294 295 296 297 298 299
		HEADERS += src/input/Mouse6dofInput.h
		SOURCES += src/input/Mouse6dofInput.cpp
		LIBS += -L/usr/local/lib/ -lxdrvlib
	} else {
		warning("Skipping support for 3DConnexion mice (missing libraries, see README)")
	}
} else:WindowsBuild {
    message("Including support for 3DConnexion mice")
Don Gagne's avatar
Don Gagne committed
300

301
    DEFINES += QGC_MOUSE_ENABLED_WIN
Don Gagne's avatar
Don Gagne committed
302 303 304 305 306 307 308 309 310 311 312 313 314

    INCLUDEPATH += libs/thirdParty/3DMouse/win

    HEADERS += \
        libs/thirdParty/3DMouse/win/I3dMouseParams.h \
        libs/thirdParty/3DMouse/win/MouseParameters.h \
        libs/thirdParty/3DMouse/win/Mouse3DInput.h \
        src/input/Mouse6dofInput.h

    SOURCES += \
        libs/thirdParty/3DMouse/win/MouseParameters.cpp \
        libs/thirdParty/3DMouse/win/Mouse3DInput.cpp \
        src/input/Mouse6dofInput.cpp
315 316
} else {
	message("Skipping support for 3DConnexion mice (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
317 318 319
}

#
320
# [OPTIONAL] Opal RT-LAB Library. Provides integration with Opal-RT's RT-LAB simulator.
Don Gagne's avatar
Don Gagne committed
321
#
322
contains(DEFINES, DISABLE_RTLAB) {
323
	message("Skipping support for RT-LAB (manual override from command line)")
324
	DEFINES -= DISABLE_RTLAB
325
# Otherwise the user can still disable this feature in the user_config.pri file.
326
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_RTLAB) {
327
    message("Skipping support for RT-LAB (manual override from user_config.pri)")
328 329
} else:WindowsBuild {
	exists(src/lib/opalrt/OpalApi.h) : exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) {
330
		message("Including support for RT-LAB")
331

332
		DEFINES += QGC_RTLAB_ENABLED
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361

		INCLUDEPATH +=
			src/lib/opalrt
			libs/lib/opal/include \

		FORMS += src/ui/OpalLinkSettings.ui

		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

		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

		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
362
} else {
363
    message("Skipping support for RT-LAB (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
364 365 366
}

#
367 368 369
# [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
370 371 372 373 374 375 376 377
#
MacBuild {
    INCLUDEPATH += \
        $$BASEDIR/libs/lib/Frameworks/SDL.framework/Headers

    LIBS += \
        -F$$BASEDIR/libs/lib/Frameworks \
        -framework SDL
378
} else:LinuxBuild {
379
	PKGCONFIG = sdl
380
} else:WindowsBuild {
Don Gagne's avatar
Don Gagne committed
381 382 383 384 385 386 387 388 389
	INCLUDEPATH += \
        $$BASEDIR/libs/lib/sdl/msvc/include \

	LIBS += \
        -L$$BASEDIR/libs/lib/sdl/msvc/lib \
        -lSDLmain \
        -lSDL
}

390
##
391
# [OPTIONAL] Speech synthesis library support.
392
# Can be forcibly disabled by adding a `DEFINES+=DISABLE_SPEECH` argument to qmake.
393
# Linux support requires the eSpeak speech synthesizer (espeak).
394 395
# 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
396
#
397
contains (DEFINES, DISABLE_SPEECH) {
398
	message("Skipping support for speech output (manual override from command line)")
399
	DEFINES -= DISABLE_SPEECH
400
# Otherwise the user can still disable this feature in the user_config.pri file.
401
} else:exists(user_config.pri):infile(user_config.pri, DEFINES, DISABLE_SPEECH) {
402
    message("Skipping support for speech output (manual override from user_config.pri)")
403
} else:LinuxBuild {
404
	exists(/usr/include/espeak) | exists(/usr/local/include/espeak) {
405
		message("Including support for speech output")
406
		DEFINES += QGC_SPEECH_ENABLED
407
		LIBS += \
408
		-lespeak
409
	} else {
410
		warning("Skipping support for speech output (missing libraries, see README)")
411 412
	}
}
413 414 415
# Mac support is built into OS 10.6+.
else:MacBuild {
	message("Including support for speech output")
416
	DEFINES += QGC_SPEECH_ENABLED
417
}
418 419 420
# Windows supports speech through native API.
else:WindowsBuild {
	message("Including support for speech output")
421
	DEFINES += QGC_SPEECH_ENABLED
Don Gagne's avatar
Don Gagne committed
422
}