Commit fb052d2a authored by Don Gagne's avatar Don Gagne

Only a single MAVLink dialect is supported

parent 4574fd52
...@@ -78,10 +78,9 @@ else { ...@@ -78,10 +78,9 @@ else {
# the selected autopilot system. # the selected autopilot system.
# #
# If the user config file exists, it will be included. If this file # If the user config file exists, it will be included. If this file
# specifies the MAVLINK_CONF variable with a list of MAVLink # specifies the MAVLINK_CONF variable with a MAVLink dialect, support
# dialects, support for them will be compiled in to QGC. It will also # for it will be compiled in to QGC. It will also create a
# create a QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use within # QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use within the actual code.
# the actual code.
# #
MAVLINKPATH_REL = libs/mavlink/include/mavlink/v1.0 MAVLINKPATH_REL = libs/mavlink/include/mavlink/v1.0
MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL MAVLINKPATH = $$BASEDIR/$$MAVLINKPATH_REL
...@@ -90,52 +89,36 @@ DEFINES += MAVLINK_NO_DATA ...@@ -90,52 +89,36 @@ DEFINES += MAVLINK_NO_DATA
# First we select the dialect, checking for valid user selection # 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 # Users can override all other settings by specifying MAVLINK_CONF as an argument to qmake
!isEmpty(MAVLINK_CONF) { !isEmpty(MAVLINK_CONF) {
for(dialect, MAVLINK_CONF) { message($$sprintf("Using MAVLink dialect '%1' specified at the command line.", $$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:infile(user_config.pri, MAVLINK_CONF) { else:infile(user_config.pri, MAVLINK_CONF) {
MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF) MAVLINK_CONF = $$fromfile(user_config.pri, MAVLINK_CONF)
!isEmpty(MAVLINK_CONF) { !isEmpty(MAVLINK_CONF) {
for(dialect, MAVLINK_CONF) { message($$sprintf("Using MAVLink dialect '%1' specified in user_config.pri", $$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))
}
}
} }
} }
# If no valid user selection is found, default to the ardupilotmega if it's available. # If no valid user selection is found, default to the ardupilotmega if it's available.
# Note: This can be a list of several dialects. # Note: This can be a list of several dialects.
else { else {
DEFAULT_MAVLINK_DIALECTS=ardupilotmega MAVLINK_CONF=ardupilotmega
for(dialect, DEFAULT_MAVLINK_DIALECTS) { message($$sprintf("Using default MAVLink dialect '%1'.", $$MAVLINK_CONF))
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. # Then we add the proper include paths dependent on the dialect.
INCLUDEPATH += $$MAVLINKPATH INCLUDEPATH += $$MAVLINKPATH
!isEmpty(MAVLINK_DIALECTS) { !isEmpty(MAVLINK_CONF) {
for(dialect, MAVLINK_DIALECTS) { count(MAVLINK_CONF, 1) {
INCLUDEPATH += $$MAVLINKPATH/$$dialect exists($$MAVLINKPATH/$$MAVLINK_CONF) {
DEFINES += $$sprintf('QGC_USE_%1_MESSAGES', $$upper($$dialect)) 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 { } else {
warning("No valid MAVLink dialects found, only common messages supported.") warning("No MAVLink dialect specified, only common messages supported.")
INCLUDEPATH += $$MAVLINKPATH/common INCLUDEPATH += $$MAVLINKPATH/common
} }
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
# #
#------------------------------------------------- #-------------------------------------------------
# Specify MAVLink dialects to compile support for here. This variable is processed # Specify the MAVLink dialect to compile support for here. This variable is processed
# by QGCExternalLibs.pri, which handles MAVLink configuration. # by QGCExternalLibs.pri, which handles MAVLink configuration. The dialect should
# To specify dialects to include set MAVLINK_CONF to a space-separated list of dialects. # correspond to an include folder under `libs/mavlink/include/mavlink/v1.0`. You can
# Each dialect should correspond to an include folder under `libs/mavlink/include` # also force a build to use only common mavlink message by setting MAVLINK_CONF to empty here.
#MAVLINK_CONF = pixhawk #MAVLINK_CONF = pixhawk
# Override compilation of QGroundControl's features in your build. This overrides the default # Override compilation of QGroundControl's features in your build. This overrides the default
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment