From fb052d2a8d1961ded897b92b1f101ca468db6792 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 17 Mar 2014 12:40:22 -0700 Subject: [PATCH] Only a single MAVLink dialect is supported --- QGCExternalLibs.pri | 57 ++++++++++++++++---------------------------- user_config.pri.dist | 8 +++---- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/QGCExternalLibs.pri b/QGCExternalLibs.pri index 004d42801..9d0e6aabd 100644 --- a/QGCExternalLibs.pri +++ b/QGCExternalLibs.pri @@ -78,10 +78,9 @@ else { # the selected autopilot system. # # 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. +# 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. # MAVLINKPATH_REL = libs/mavlink/include/mavlink/v1.0 MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL @@ -90,52 +89,36 @@ DEFINES += MAVLINK_NO_DATA # 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)) - } - } + message($$sprintf("Using MAVLink dialect '%1' specified at the command line.", $$MAVLINK_CONF)) } -# Otherwise they can specify MAVLINK_CONF within user_config.pri else:infile(user_config.pri, MAVLINK_CONF) { MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF) !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)) - } - } + message($$sprintf("Using MAVLink dialect '%1' specified in user_config.pri", $$MAVLINK_CONF)) } } # 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)) - } - } + MAVLINK_CONF=ardupilotmega + message($$sprintf("Using default MAVLink dialect '%1'.", $$MAVLINK_CONF)) } -# Then we add the proper include paths dependent on the dialects and notify -# the user of the current dialect. + +# Then we add the proper include paths dependent on the dialect. INCLUDEPATH += $$MAVLINKPATH -!isEmpty(MAVLINK_DIALECTS) { - for(dialect, MAVLINK_DIALECTS) { - INCLUDEPATH += $$MAVLINKPATH/$$dialect - DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$dialect)) +!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)) + } + } else { + error(Only a single mavlink dialect can be specified in MAVLINK_CONF) } } else { - warning("No valid MAVLink dialects found, only common messages supported.") + warning("No MAVLink dialect specified, only common messages supported.") INCLUDEPATH += $$MAVLINKPATH/common } diff --git a/user_config.pri.dist b/user_config.pri.dist index 60e4b841b..81bdb3f71 100644 --- a/user_config.pri.dist +++ b/user_config.pri.dist @@ -23,10 +23,10 @@ # #------------------------------------------------- -# Specify MAVLink dialects to compile support for here. This variable is processed -# by QGCExternalLibs.pri, which handles MAVLink configuration. -# To specify dialects to include set MAVLINK_CONF to a space-separated list of dialects. -# Each dialect should correspond to an include folder under `libs/mavlink/include` +# Specify the MAVLink dialect to compile support for here. This variable is processed +# by QGCExternalLibs.pri, which handles MAVLink configuration. The dialect should +# correspond to an include folder under `libs/mavlink/include/mavlink/v1.0`. You can +# also force a build to use only common mavlink message by setting MAVLINK_CONF to empty here. #MAVLINK_CONF = pixhawk # Override compilation of QGroundControl's features in your build. This overrides the default -- 2.22.0