From cfd82a5e9755632d12d0cce1d98cae7709772218 Mon Sep 17 00:00:00 2001
From: lm <pixhawk@pixhawk02.(none)>
Date: Tue, 26 Oct 2010 11:40:54 +0200
Subject: [PATCH] Ensured that a default-configured QGroundControl src repo
 compiles

---
 qgroundcontrol.pro    | 30 ++++++++++++++++++++++++++++--
 src/comm/QGCMAVLink.h | 14 ++++++++------
 user_config.pri.dist  | 22 +++++-----------------
 3 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 9625c87..fa0aafd 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -51,11 +51,38 @@ OBJECTS_DIR = $$BUILDDIR/obj
 MOC_DIR = $$BUILDDIR/moc
 UI_HEADERS_DIR = src/ui/generated
 
+MAVLINK_CONF = ""
+
 exists(user_config.pri) {
     message("----- USING USER QGROUNDCONTROL CONFIG FROM user_config.pri -----")
     include(user_config.pri)
 }
 
+INCLUDEPATH += $$BASEDIR/../mavlink/include/common
+
+contains(MAVLINK_CONF, pixhawk) {
+# Remove the default set - it is included anyway
+INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
+# PIXHAWK SPECIAL MESSAGES
+INCLUDEPATH += $$BASEDIR/../mavlink/include/pixhawk
+DEFINES += QGC_USE_PIXHAWK_MESSAGES
+}
+
+contains(MAVLINK_CONF, slugs) {
+# Remove the default set - it is included anyway
+INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
+# SLUGS SPECIAL MESSAGES
+INCLUDEPATH += $$BASEDIR/../mavlink/include/slugs
+DEFINES += QGC_USE_SLUGS_MESSAGES
+}
+
+contains(MAVLINK_CONF, ualberta) {
+# Remove the default set - it is included anyway
+INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
+# UALBERTA SPECIAL MESSAGES
+INCLUDEPATH += $$BASEDIR/../mavlink/include/ualberta
+DEFINES += QGC_USE_UALBERTA_MESSAGES
+}
 
 # }
 # Include general settings for MAVGround
@@ -75,8 +102,7 @@ DEPENDPATH += . \
     plugins
 INCLUDEPATH += . \
     lib/QMapControl \
-    $$BASEDIR/../mavlink/include \
-    $$BASEDIR/../mavlink/include/common
+    $$BASEDIR/../mavlink/include
 
 # ../mavlink/include \
 # MAVLink/include \
diff --git a/src/comm/QGCMAVLink.h b/src/comm/QGCMAVLink.h
index c73d3a6..d09d896 100644
--- a/src/comm/QGCMAVLink.h
+++ b/src/comm/QGCMAVLink.h
@@ -33,20 +33,22 @@ This file is part of the QGROUNDCONTROL project
 #include <mavlink_types.h>
 #include <mavlink.h>
 
-//#ifdef QGC_USE_PIXHAWK_MESSAGES
+#ifdef QGC_USE_PIXHAWK_MESSAGES
 #include <pixhawk.h>
-//#endif
+#endif
 
-//#ifdef QGC_USE_SLUGS_MESSAGES
+#ifdef QGC_USE_SLUGS_MESSAGES
 #include <slugs.h>
-//#endif
+#endif
 
-//#ifdef QGC_USE_UALBERTA_MESSAGES
+#ifdef QGC_USE_UALBERTA_MESSAGES
 #include <ualberta.h>
-//#endif
+#endif
 
 #ifdef QGC_USE_ARDUPILOT_MESSAGES
 #include <ardupilot.h>
 #endif
 
+
 #endif // QGCMAVLINK_H
+
diff --git a/user_config.pri.dist b/user_config.pri.dist
index c4c046d..fa149a1 100644
--- a/user_config.pri.dist
+++ b/user_config.pri.dist
@@ -23,22 +23,10 @@
 #
 #-------------------------------------------------
 
-# Uncomment ONE of these lines to enable the special message set of a project.
-# Several message sets can be also enabled in parallel, as long as function names
-# and message ids do not conflict.
+# Add or remove custom message specs here. The matching mavlink headers are
+# included in the main qgroundcontrol.pro file.
 
-# Remove the default set - it is included anyway
-INCLUDEPATH -= $$BASEDIR/../mavlink/include/common
-
-# PIXHAWK SPECIAL MESSAGES
-INCLUDEPATH += $$BASEDIR/../mavlink/include/pixhawk
-DEFINES += QGC_USE_PIXHAWK_MESSAGES
-
-# SLUGS SPECIAL MESSAGES
-INCLUDEPATH += $$BASEDIR/../mavlink/include/slugs
-DEFINES += QGC_USE_SLUGS_MESSAGES
-
-# UALBERTA SPECIAL MESSAGES
-INCLUDEPATH += $$BASEDIR/../mavlink/include/ualberta
-DEFINES += QGC_USE_UALBERTA_MESSAGES
+MAVLINK_CONF += pixhawk \
+                slugs \
+                ualberta