QGCExternalLibs.pri 15.8 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#
# Tell the Linux build to look in a few additional places for libs
#

LinuxBuild {
	INCLUDEPATH += \
        /usr/include \
        /usr/local/include

	LIBS += \
		-L/usr/lib

    linux-g++-64 {
        LIBS += \
            -L/usr/local/lib64 \
            -L/usr/lib64
	}
}

#
# Add in a few missing headers to windows
#

WindowsBuild {
    INCLUDEPATH += libs/lib/msinttypes
}

#
29
# QUpgrade support.
Don Gagne's avatar
Don Gagne committed
30
#
31 32 33 34 35 36 37 38
# Allow the user to override QUpgrade compilation through a DISABLE_QUPGRADE
# define like: `qmake DEFINES=DISABLE_QUPGRADE`
contains(DEFINES, DISABLE_QUPGRADE) {
    message("Skipping support for QUpgrade (manual override)")
}
# If the QUpgrade submodule has been initialized, build in support by default.
else:exists(qupgrade/.git) {
    message("Including support for QUpgrade")
Don Gagne's avatar
Don Gagne committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65

    DEFINES += QUPGRADE_SUPPORT

    INCLUDEPATH += qupgrade/src/apps/qupgrade

    FORMS += \
        qupgrade/src/apps/qupgrade/dialog_bare.ui \
        qupgrade/src/apps/qupgrade/boardwidget.ui

    HEADERS += \
        qupgrade/src/apps/qupgrade/qgcfirmwareupgradeworker.h \
        qupgrade/src/apps/qupgrade/uploader.h \
        qupgrade/src/apps/qupgrade/dialog_bare.h \
        qupgrade/src/apps/qupgrade/boardwidget.h

    SOURCES += \
        qupgrade/src/apps/qupgrade/qgcfirmwareupgradeworker.cpp \
        qupgrade/src/apps/qupgrade/uploader.cpp \
        qupgrade/src/apps/qupgrade/dialog_bare.cpp \
        qupgrade/src/apps/qupgrade/boardwidget.cpp

    RESOURCES += \
        qupgrade/qupgrade.qrc

    LinuxBuild:CONFIG += qesp_linux_udev

    include(qupgrade/libs/qextserialport/src/qextserialport.pri)
66 67 68
}
# Otherwise notify the user and don't compile it.
else {
69
    warning("Skipping support for QUpgrade (missing submodule, see README)")
Don Gagne's avatar
Don Gagne committed
70 71 72
}

#
73 74 75
# Add support for MAVLink. This is a required dependency for QGC.
# Some logic is involved here in selecting the proper dialect for
# the selected autopilot system.
Don Gagne's avatar
Don Gagne committed
76
#
77 78 79 80 81 82 83 84
# If the user config file exists, it will be included. If this file
# specifies the MAVLINK_CONF variable with a list of MAVLink
# dialects, support for them will be compiled in to QGC. It will also
# create a QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use within
# the actual code.
#
MAVLINKPATH_REL = libs/mavlink/include/mavlink/v1.0
MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL
Don Gagne's avatar
Don Gagne committed
85 86
DEFINES += MAVLINK_NO_DATA

87 88 89 90 91 92 93 94 95 96 97 98 99 100
# 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) {
    for(dialect, MAVLINK_CONF) {
	    exists($$MAVLINKPATH/$$dialect) {
		MAVLINK_DIALECTS += $$dialect
		message($$sprintf("Using MAVLink dialect '%1' specified at the command line.", $$dialect))
	    } else {
		error($$sprintf("MAVLink dialect '%1' specified at the command line does not exist at '%2'!", $$dialect, $$MAVLINKPATH_REL))
	    }
    }
}
# Otherwise they can specify MAVLINK_CONF within user_config.pri
else:exists(user_config.pri) {
Don Gagne's avatar
Don Gagne committed
101
    include(user_config.pri)
102 103 104 105 106 107 108 109 110 111
    !isEmpty(MAVLINK_CONF) {
	for(dialect, MAVLINK_CONF) {
		exists($$MAVLINKPATH/$$dialect) {
		    MAVLINK_DIALECTS += $$dialect
		    message($$sprintf("Using MAVLink dialect '%1' specified in user_config.pri", $$dialect))
		} else {
		    error($$sprintf("MAVLink dialect '%1' specified in user_config.pri does not exist at '%2'!", $$dialect, $$MAVLINKPATH_REL))
		}
	}
    }
Don Gagne's avatar
Don Gagne committed
112
}
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
# If no valid user selection is found, default to the ardupilotmega if it's available.
# Note: This can be a list of several dialects.
else {
    DEFAULT_MAVLINK_DIALECTS=ardupilotmega
    for(dialect, DEFAULT_MAVLINK_DIALECTS) {
	exists($$MAVLINKPATH/$$dialect) {
	    MAVLINK_DIALECTS += $$dialect
	    message($$sprintf("Using default MAVLink dialect '%1'.", $$dialect))
	} else {
	    warning($$sprintf("Default MAVLink dialect '%1' does not exist at '%2'!", $$dialect, $$MAVLINKPATH_REL))
	}
    }
}
# Then we add the proper include paths dependent on the dialects and notify
# the user of the current dialect.
Don Gagne's avatar
Don Gagne committed
128
INCLUDEPATH += $$MAVLINKPATH
129 130 131 132 133
!isEmpty(MAVLINK_DIALECTS) {
    for(dialect, MAVLINK_DIALECTS) {
	    INCLUDEPATH += $$MAVLINKPATH/$$dialect
	    DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$dialect))
    }
Don Gagne's avatar
Don Gagne committed
134
} else {
135
    warning("No valid MAVLink dialects found, only common messages supported.")
136
    INCLUDEPATH += $$MAVLINKPATH/common
Don Gagne's avatar
Don Gagne committed
137 138 139
}

#
140 141
# [DEPRECATED] MAVLink generator UI. Provides a GUI interface for generating MAVLink dialects.
# Replaced by mavgenerator.py within the MAVLink project.
Don Gagne's avatar
Don Gagne committed
142
#
143 144 145 146
contains(DEFINES, ENABLE_MAVGEN) {
	warning("Including support for MAVLink generator GUI (caution: deprecated)")
	DEPENDPATH += \
		src/apps/mavlinkgen
Don Gagne's avatar
Don Gagne committed
147

148 149 150 151
	INCLUDEPATH += \
		src/apps/mavlinkgen \
		src/apps/mavlinkgen/ui \
		src/apps/mavlinkgen/generator
Don Gagne's avatar
Don Gagne committed
152

153 154 155 156
	include(src/apps/mavlinkgen/mavlinkgen.pri)
} else {
	message("Skipping support for MAVLink generator GUI (deprecated, see README)")
}
Don Gagne's avatar
Don Gagne committed
157 158

#
159
# [OPTIONAL] OpenSceneGraph
Don Gagne's avatar
Don Gagne committed
160 161 162
#
MacBuild {
    # GLUT and OpenSceneGraph are part of standard install on Mac
163
	message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
164 165 166 167 168 169 170 171
	CONFIG += OSGDependency

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

	LIBS += \
        -L$$BASEDIR/libs/lib/mac64/lib \
        -losgWidget
172
} else:LinuxBuild {
Don Gagne's avatar
Don Gagne committed
173
	exists(/usr/include/osg) | exists(/usr/local/include/osg) {
174
		message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
175 176 177 178 179 180
        CONFIG += OSGDependency
        exists(/usr/include/osg/osgQt) | exists(/usr/include/osgQt) | exists(/usr/local/include/osg/osgQt) | exists(/usr/local/include/osgQt) {
            message("Including support for Linux OpenSceneGraph Qt")
            LIBS += -losgQt
            DEFINES += QGC_OSG_QT_ENABLED
        } else {
181
            warning("Skipping support for Linux OpenSceneGraph Qt (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
182
        }
183 184
	} else {
		warning("Skipping support for OpenSceneGraph (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
185
	}
186
} else:WindowsBuild {
Don Gagne's avatar
Don Gagne committed
187
	exists($$BASEDIR/libs/lib/osg123) {
188
		message("Including support for OpenSceneGraph")
Don Gagne's avatar
Don Gagne committed
189 190 191 192 193 194 195
        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
196 197
	} else {
		warning("Skipping support for OpenSceneGraph (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
198
	}
199 200
} else {
    message("Skipping support for OpenSceneGraph (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
}

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
}

#
264 265
# [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
266
#
267 268 269 270 271 272 273 274
contains(DEFINES, DISABLE_GOOGLE_EARTH) {
	message("Skipping support for Google Earth view (manual override)")
} else:MacBuild {
    message("Including support for Google Earth view")
    HEADERS += src/ui/map3D/QGCGoogleEarthView.h
    SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
} else:WindowsBuild {
    message("Including support for Google Earth view")
Don Gagne's avatar
Don Gagne committed
275 276 277

    HEADERS += src/ui/map3D/QGCGoogleEarthView.h
    SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
278
    CONFIG += qaxcontainer
Don Gagne's avatar
Don Gagne committed
279
} else {
280
    message("Skipping support for Google Earth view (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
281 282 283 284 285 286
}

#
# Protcol Buffers for PixHawk
#

287
LinuxBuild : contains(MAVLINK_DIALECT, pixhawk) {
Don Gagne's avatar
Don Gagne committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
    exists(/usr/local/include/google/protobuf) | exists(/usr/include/google/protobuf) {
        message("Including support for Protocol Buffers")

        DEFINES += QGC_PROTOBUF_ENABLED

        LIBS += \
            -lprotobuf \
            -lprotobuf-lite \
            -lprotoc

        HEADERS += \
            libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.pb.h \
            src/ui/map3D/ObstacleGroupNode.h \
            src/ui/map3D/GLOverlayGeode.h

        SOURCES += \
            libs/mavlink/share/mavlink/src/v1.0/pixhawk/pixhawk.pb.cc \
            src/ui/map3D/ObstacleGroupNode.cc \
            src/ui/map3D/GLOverlayGeode.cc
    } else {
        message("Skipping support for Protocol Buffers")
    }
} else {
    message("Skipping support for Protocol Buffers")
}

#
315
# [OPTIONAL] Kinect support using libfreenect on POSIX systems.
Don Gagne's avatar
Don Gagne committed
316
#
317 318 319
contains(DEFINES, DISABLE_KINECT) {
	message("Skipping support for the Kinect (manual override)")
} else:MacBuild | LinuxBuild {
Don Gagne's avatar
Don Gagne committed
320
    exists(/opt/local/include/libfreenect) | exists(/usr/local/include/libfreenect) {
321
        message("Including support for the Kinect")
Don Gagne's avatar
Don Gagne committed
322 323 324 325 326 327 328

        #INCLUDEPATH += /usr/include/libusb-1.0
        DEFINES += QGC_LIBFREENECT_ENABLED
        LIBS += -lfreenect
        HEADERS += src/input/Freenect.h
        SOURCES += src/input/Freenect.cc
    } else {
329
        warning("Skipping support for the Kinect (missing libraries, see README)")
Don Gagne's avatar
Don Gagne committed
330 331
    }
} else {
332
    message("Skipping support for the Kinect (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
}

#
# EIGEN matrix library (NOMINMAX needed to make internal min/max work)
#

INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX

#
# OPMapControl library (from OpenPilot)
#

include(libs/utils/utils_external.pri)
include(libs/opmapcontrol/opmapcontrol_external.pri)

DEPENDPATH += \
    libs/utils \
    libs/utils/src \
    libs/opmapcontrol \
    libs/opmapcontrol/src \
    libs/opmapcontrol/src/mapwidget

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

#
# QWT plotting library
#

include(libs/qwt/qwt.pri)

#
# QSerialPort - serial port library
#

include(libs/serialport/qserialport.pri)

WindowsBuild {
    # Used to enumerate serial ports by QSerialPort
	LIBS += -lsetupapi
}


#
380 381 382 383 384 385
# XBee wireless support. This is not necessary for basic serial/UART communications.
# 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
386
#
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
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
XBEE_DEFINES = XBEELINK

contains(DEFINES, DISABLE_XBEE) {
	message("Skipping support for native XBee API (manual override)")
} else:LinuxBuild {
	exists(/usr/include/xbee.h) {
		message("Including support for XBee API")

		HEADERS += $$XBEE_DEPENDENT_HEADERS
		SOURCES += $$XBEE_DEPENDENT_SOURCES
		DEFINES += $$XBEE_DEFINES
		LIBS += -lxbee
	} else {
		warning("Skipping support for XBee API (missing library, see README)")
	}
} else:WindowsBuild {
	message("Including support for XBee API")
	HEADERS += $$XBEE_DEPENDENT_HEADERS
	SOURCES += $$XBEE_DEPENDENT_SOURCES
	DEFINES += $$XBEE_DEFINES
	INCLUDEPATH += libs/thirdParty/libxbee
418
        LIBS += -l$$BASEDIR/libs/thirdParty/libxbee/lib/libxbee
Don Gagne's avatar
Don Gagne committed
419
} else {
420
	message("Skipping support for XBee API (unsupported platform)")
Don Gagne's avatar
Don Gagne committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
}

#
# 3DConnexion 3d Mice support
#

LinuxBuild : exists(/usr/local/lib/libxdrvlib.so) {
    message("Including support for Magellan 3DxWare")

    DEFINES +=
        MOUSE_ENABLED_LINUX \
        ParameterCheck                      # Hack: Has to be defined for magellan usage

    INCLUDEPATH *= /usr/local/include
    HEADERS += src/input/Mouse6dofInput.h
    SOURCES += src/input/Mouse6dofInput.cpp
    LIBS += -L/usr/local/lib/ -lxdrvlib
}

WindowsBuild {
    message("Including support for Magellan 3DxWare")

    DEFINES += MOUSE_ENABLED_WIN

    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
}

#
# Opal RT-LAB Library
#

WindowsBuild : win32 : exists(src/lib/opalrt/OpalApi.h) : exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) {
    message("Including support for Opal-RT")

    DEFINES += OPAL_RT

    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 {
    message("Skipping support for Opal-RT")
}

#
# SDL
#

MacBuild {
    INCLUDEPATH += \
        $$BASEDIR/libs/lib/Frameworks/SDL.framework/Headers

    LIBS += \
        -F$$BASEDIR/libs/lib/Frameworks \
        -framework SDL
}

LinuxBuild {
	LIBS += \
		-lSDL \
		-lSDLmain
}

WindowsBuild {
	INCLUDEPATH += \
        $$BASEDIR/libs/lib/sdl/msvc/include \

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

526 527 528
##
# Speech synthesis library support.
# Can be forcibly disabled by adding a `DEFINES+=DISABLE_SPEECH` argument to qmake.
Don Gagne's avatar
Don Gagne committed
529 530
#

531
# Festival Lite speech synthesis engine
Don Gagne's avatar
Don Gagne committed
532
LinuxBuild {
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
	contains (DEFINES, DISABLE_SPEECH) {
		message("Skipping support for speech synthesis (manual override)")
	} else:exists(/usr/include/flite) | exists(/usr/local/include/flite) {
		message(Enabling support for speech output)
		LIBS += \
			-lflite_cmu_us_kal \
			-lflite_usenglish \
			-lflite_cmulex \
			-lflite
	} else {
		DEFINES += DISABLE_SPEECH
		warning("Skipping support for speech synthesis (missing flite libraries, see README)")
	}
}

# Mac support for speech synthesis is currently broken.
# Library support is built into Mac OS X
MacBuild {
	message("Including support for speech synthesis.")
}

# Windows support for speech synthesis is currently broken
# Library support is built into Windows
WindowsBuild {
	DEFINES += DISABLE_SPEECH
	message("Skipping support for speech synthesis (unsupported on Windows)")
Don Gagne's avatar
Don Gagne committed
559 560
}