From ff10d1136c662c757eae24423b205447ff62ffa3 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Wed, 13 Apr 2016 14:20:05 -0300 Subject: [PATCH] AP_GPS: reorganize includes Due to the way the headers are organized a single change in a AP_GPS backend would trigger a rebuild for most of the files in the project. Time could be saved by using ccache (since most of the things didn't change) but we can do better, i.e. re-organize the headers so we don't have to re-build everything. This makes internal headers internal and then other libraries only depend on the AP_GPS.h header. --- libraries/AP_GPS/AP_GPS.cpp | 13 +++++++++++++ libraries/AP_GPS/AP_GPS.h | 13 ------------- libraries/AP_GPS/AP_GPS_ERB.h | 2 ++ libraries/AP_GPS/AP_GPS_GSOF.h | 1 + libraries/AP_GPS/AP_GPS_MTK.h | 1 + libraries/AP_GPS/AP_GPS_MTK19.cpp | 1 + libraries/AP_GPS/AP_GPS_MTK19.h | 1 + libraries/AP_GPS/AP_GPS_NMEA.h | 1 + libraries/AP_GPS/AP_GPS_PX4.h | 3 +++ libraries/AP_GPS/AP_GPS_QURT.h | 3 +++ libraries/AP_GPS/AP_GPS_SBF.h | 1 + libraries/AP_GPS/AP_GPS_SBP.h | 1 + libraries/AP_GPS/AP_GPS_SIRF.h | 4 +++- libraries/AP_GPS/AP_GPS_UBLOX.h | 2 ++ libraries/AP_GPS/GPS_Backend.cpp | 1 + libraries/AP_GPS/GPS_detect_state.h | 2 +- 16 files changed, 35 insertions(+), 15 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index 5ce72a3c99..6f610c658c 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -21,6 +21,19 @@ #include #include +#include "AP_GPS_ERB.h" +#include "AP_GPS_GSOF.h" +#include "AP_GPS_MTK.h" +#include "AP_GPS_MTK19.h" +#include "AP_GPS_NMEA.h" +#include "AP_GPS_PX4.h" +#include "AP_GPS_QURT.h" +#include "AP_GPS_SBF.h" +#include "AP_GPS_SBP.h" +#include "AP_GPS_SIRF.h" +#include "AP_GPS_UBLOX.h" +#include "GPS_Backend.h" + extern const AP_HAL::HAL &hal; // table of user settable parameters diff --git a/libraries/AP_GPS/AP_GPS.h b/libraries/AP_GPS/AP_GPS.h index dbcdf45395..defe29a657 100644 --- a/libraries/AP_GPS/AP_GPS.h +++ b/libraries/AP_GPS/AP_GPS.h @@ -397,16 +397,3 @@ private: }; #define GPS_BAUD_TIME_MS 1200 - -#include "GPS_Backend.h" -#include "AP_GPS_UBLOX.h" -#include "AP_GPS_MTK.h" -#include "AP_GPS_MTK19.h" -#include "AP_GPS_NMEA.h" -#include "AP_GPS_SIRF.h" -#include "AP_GPS_SBP.h" -#include "AP_GPS_PX4.h" -#include "AP_GPS_QURT.h" -#include "AP_GPS_SBF.h" -#include "AP_GPS_GSOF.h" -#include "AP_GPS_ERB.h" diff --git a/libraries/AP_GPS/AP_GPS_ERB.h b/libraries/AP_GPS/AP_GPS_ERB.h index 51e6fc0020..8d04697111 100644 --- a/libraries/AP_GPS/AP_GPS_ERB.h +++ b/libraries/AP_GPS/AP_GPS_ERB.h @@ -21,7 +21,9 @@ #pragma once #include + #include "AP_GPS.h" +#include "GPS_Backend.h" class AP_GPS_ERB : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_GSOF.h b/libraries/AP_GPS/AP_GPS_GSOF.h index 61a049675f..4b115edfd9 100644 --- a/libraries/AP_GPS/AP_GPS_GSOF.h +++ b/libraries/AP_GPS/AP_GPS_GSOF.h @@ -21,6 +21,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" class AP_GPS_GSOF : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_MTK.h b/libraries/AP_GPS/AP_GPS_MTK.h index 230880e4be..e8ce210e3a 100644 --- a/libraries/AP_GPS/AP_GPS_MTK.h +++ b/libraries/AP_GPS/AP_GPS_MTK.h @@ -25,6 +25,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" #include "AP_GPS_MTK_Common.h" class AP_GPS_MTK : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_MTK19.cpp b/libraries/AP_GPS/AP_GPS_MTK19.cpp index 300985c752..de3e05e9d5 100644 --- a/libraries/AP_GPS/AP_GPS_MTK19.cpp +++ b/libraries/AP_GPS/AP_GPS_MTK19.cpp @@ -23,6 +23,7 @@ // Note that this driver supports both the 1.6 and 1.9 protocol varients // +#include "AP_GPS_MTK.h" #include "AP_GPS_MTK19.h" extern const AP_HAL::HAL& hal; diff --git a/libraries/AP_GPS/AP_GPS_MTK19.h b/libraries/AP_GPS/AP_GPS_MTK19.h index 1197b5745c..43b08618a2 100644 --- a/libraries/AP_GPS/AP_GPS_MTK19.h +++ b/libraries/AP_GPS/AP_GPS_MTK19.h @@ -23,6 +23,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" #include "AP_GPS_MTK_Common.h" #define MTK_GPS_REVISION_V16 16 diff --git a/libraries/AP_GPS/AP_GPS_NMEA.h b/libraries/AP_GPS/AP_GPS_NMEA.h index 8a3da74bea..2f0f11fc06 100644 --- a/libraries/AP_GPS/AP_GPS_NMEA.h +++ b/libraries/AP_GPS/AP_GPS_NMEA.h @@ -45,6 +45,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" /// NMEA parser /// diff --git a/libraries/AP_GPS/AP_GPS_PX4.h b/libraries/AP_GPS/AP_GPS_PX4.h index a7fcb961b0..ba9d7e0075 100644 --- a/libraries/AP_GPS/AP_GPS_PX4.h +++ b/libraries/AP_GPS/AP_GPS_PX4.h @@ -21,7 +21,10 @@ #pragma once #include + #include "AP_GPS.h" +#include "GPS_Backend.h" + #if CONFIG_HAL_BOARD == HAL_BOARD_PX4 #include diff --git a/libraries/AP_GPS/AP_GPS_QURT.h b/libraries/AP_GPS/AP_GPS_QURT.h index b3bdf1e540..788c2800b7 100644 --- a/libraries/AP_GPS/AP_GPS_QURT.h +++ b/libraries/AP_GPS/AP_GPS_QURT.h @@ -17,7 +17,10 @@ #pragma once #include + #include "AP_GPS.h" +#include "GPS_Backend.h" + #if CONFIG_HAL_BOARD == HAL_BOARD_QURT class AP_GPS_QURT : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_SBF.h b/libraries/AP_GPS/AP_GPS_SBF.h index ef4c448a4c..eb2a4a441b 100644 --- a/libraries/AP_GPS/AP_GPS_SBF.h +++ b/libraries/AP_GPS/AP_GPS_SBF.h @@ -21,6 +21,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" #define SBF_SETUP_MSG "\nsso, Stream1, COM1, PVTGeodetic+DOP+ExtEventPVTGeodetic, msec100\n" diff --git a/libraries/AP_GPS/AP_GPS_SBP.h b/libraries/AP_GPS/AP_GPS_SBP.h index 308ad61fb9..cb279e797b 100644 --- a/libraries/AP_GPS/AP_GPS_SBP.h +++ b/libraries/AP_GPS/AP_GPS_SBP.h @@ -23,6 +23,7 @@ #pragma once #include "AP_GPS.h" +#include "GPS_Backend.h" class AP_GPS_SBP : public AP_GPS_Backend { diff --git a/libraries/AP_GPS/AP_GPS_SIRF.h b/libraries/AP_GPS/AP_GPS_SIRF.h index 21e4179b79..6c6f74bc90 100644 --- a/libraries/AP_GPS/AP_GPS_SIRF.h +++ b/libraries/AP_GPS/AP_GPS_SIRF.h @@ -20,9 +20,11 @@ // #pragma once -#include #include +#include + #include "AP_GPS.h" +#include "GPS_Backend.h" #define SIRF_SET_BINARY "$PSRF100,0,38400,8,1,0*3C\r\n" diff --git a/libraries/AP_GPS/AP_GPS_UBLOX.h b/libraries/AP_GPS/AP_GPS_UBLOX.h index 82e8836e2b..2ea52abad0 100644 --- a/libraries/AP_GPS/AP_GPS_UBLOX.h +++ b/libraries/AP_GPS/AP_GPS_UBLOX.h @@ -22,7 +22,9 @@ #pragma once #include + #include "AP_GPS.h" +#include "GPS_Backend.h" /* * try to put a UBlox into binary mode. This is in two parts. diff --git a/libraries/AP_GPS/GPS_Backend.cpp b/libraries/AP_GPS/GPS_Backend.cpp index 3ae9a49f3b..b0e613c7a9 100644 --- a/libraries/AP_GPS/GPS_Backend.cpp +++ b/libraries/AP_GPS/GPS_Backend.cpp @@ -15,6 +15,7 @@ */ #include "AP_GPS.h" +#include "GPS_Backend.h" extern const AP_HAL::HAL& hal; diff --git a/libraries/AP_GPS/GPS_detect_state.h b/libraries/AP_GPS/GPS_detect_state.h index fdd81b4871..111055b3ff 100644 --- a/libraries/AP_GPS/GPS_detect_state.h +++ b/libraries/AP_GPS/GPS_detect_state.h @@ -73,4 +73,4 @@ struct SBP_detect_state { uint8_t msg_len; uint16_t crc_so_far; uint16_t crc; -}; \ No newline at end of file +};