Skip to content

Commit

Permalink
Migrate the QGC build system to the upgraded (aarch64-supporting) AirMap
Browse files Browse the repository at this point in the history
All I do here is ask qmake for the architecture and use it to download
the correct *.deb package. The rest of the changes is simply indentation.
I do not have an aarch64 linux so testing against Android NDK.
clang is slightly more picky with the unused 'this' captured by the
Airmap/services/*.cpp files
  • Loading branch information
remster authored and patrickelectric committed Nov 18, 2022
1 parent ef55fab commit ecd3ae2
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 119 deletions.
56 changes: 32 additions & 24 deletions QGCExternalLibs.pri
Original file line number Diff line number Diff line change
Expand Up @@ -296,32 +296,40 @@ contains (DEFINES, DISABLE_AIRMAP) {
LIBS += -L$${AIRMAPD_PATH}/macOS/$$AIRMAP_QT_PATH -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED
}
} else:LinuxBuild {
#-- Download and install platform-sdk libs and headers iff they're not already in the build directory
AIRMAP_PLATFORM_SDK_URL = "https://github.com/airmap/platform-sdk/releases/download/2.0/airmap-platform-sdk-2.0.0-Linux.deb"
AIRMAP_PLATFORM_SDK_FILEPATH = "$${OUT_PWD}/airmap-platform-sdk.deb"
AIRMAP_PLATFORM_SDK_INSTALL_DIR = "tmp"
} else {
AIRMAP_PLATFORM_SDK_ARCH = ""
LinuxBuild {
AIRMAP_PLATFORM_SDK_ARCH = "x86_64"
} else:AndroidBuild {
AIRMAP_PLATFORM_SDK_ARCH = "aarch64"
}
isEmpty( AIRMAP_PLATFORM_SDK_ARCH ) {
message("Skipping support for Airmap (unsupported architecture)")
} else {
#-- Download and install platform-sdk libs and headers iff they're not already in the build directory
AIRMAP_PLATFORM_SDK_URL = "https://github.com/airmap/platform-sdk/releases/download/2.0.1/airmap-platform-sdk-2.0.1-Linux-$${AIRMAP_PLATFORM_SDK_ARCH}.deb"
AIRMAP_PLATFORM_SDK_FILEPATH = "$${OUT_PWD}/airmap-platform-sdk.deb"
AIRMAP_PLATFORM_SDK_INSTALL_DIR = "tmp"

airmap_platform_sdk_install.target = $${AIRMAP_PLATFORM_SDK_PATH}/include/airmap
airmap_platform_sdk_install.commands = \
rm -rf $${AIRMAP_PLATFORM_SDK_PATH} && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}" && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/include/airmap" && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}" && \
curl --location --output "$${AIRMAP_PLATFORM_SDK_FILEPATH}" "$${AIRMAP_PLATFORM_SDK_URL}" && \
ar p "$${AIRMAP_PLATFORM_SDK_FILEPATH}" data.tar.gz | tar xvz -C "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/" --strip-components=1 && \
mv -u "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/usr/lib/x86_64-linux-gnu/*" "$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}/" && \
mv -u "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/usr/include/airmap/*" "$${AIRMAP_PLATFORM_SDK_PATH}/include/airmap/" && \
rm -rf "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}" && \
rm "$${AIRMAP_PLATFORM_SDK_FILEPATH}"
airmap_platform_sdk_install.depends =
QMAKE_EXTRA_TARGETS += airmap_platform_sdk_install
PRE_TARGETDEPS += $$airmap_platform_sdk_install.target
airmap_platform_sdk_install.target = $${AIRMAP_PLATFORM_SDK_PATH}/include/airmap
airmap_platform_sdk_install.commands = \
rm -rf $${AIRMAP_PLATFORM_SDK_PATH} && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}" && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/include/airmap" && \
mkdir -p "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}" && \
curl --location --output "$${AIRMAP_PLATFORM_SDK_FILEPATH}" "$${AIRMAP_PLATFORM_SDK_URL}" && \
ar p "$${AIRMAP_PLATFORM_SDK_FILEPATH}" data.tar.gz | tar xvz -C "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/" --strip-components=1 && \
mv -u "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/usr/lib/$${AIRMAP_PLATFORM_SDK_ARCH}-linux-gnu/*" "$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH}/" && \
mv -u "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}/usr/include/airmap/*" "$${AIRMAP_PLATFORM_SDK_PATH}/include/airmap/" && \
rm -rf "$${AIRMAP_PLATFORM_SDK_PATH}/$${AIRMAP_PLATFORM_SDK_INSTALL_DIR}" && \
rm "$${AIRMAP_PLATFORM_SDK_FILEPATH}"
airmap_platform_sdk_install.depends =
QMAKE_EXTRA_TARGETS += airmap_platform_sdk_install
PRE_TARGETDEPS += $$airmap_platform_sdk_install.target

LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH} -lairmap-cpp
DEFINES += QGC_AIRMAP_ENABLED
} else {
message("Skipping support for Airmap (unsupported platform)")
LIBS += -L$${AIRMAP_PLATFORM_SDK_PATH}/linux/$${AIRMAP_QT_PATH} -lairmap-cpp
DEFINES += QGC_AIRMAP_ENABLED
}
}
contains (DEFINES, QGC_AIRMAP_ENABLED) {
INCLUDEPATH += \
Expand Down
2 changes: 1 addition & 1 deletion QGCPostLinkCommon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ LinuxBuild {

# Airmap
contains (DEFINES, QGC_AIRMAP_ENABLED) {
QMAKE_POST_LINK += && $$QMAKE_COPY $$OUT_PWD/libs/airmap-platform-sdk/linux/$$AIRMAP_QT_PATH/libairmap-cpp.so.2.0.0 $$DESTDIR/Qt/libs/
QMAKE_POST_LINK += && $$QMAKE_COPY $$OUT_PWD/libs/airmap-platform-sdk/linux/$$AIRMAP_QT_PATH/libairmap-cpp.so.2.0.1 $$DESTDIR/Qt/libs/
}

# QGroundControl start script
Expand Down
1 change: 0 additions & 1 deletion src/Airmap/AirMapAdvisoryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ AirMapAdvisoryManager::_requestAdvisories()
_advisories.clearAndDeleteContents();

Advisory::Search::Parameters params;
params.authorization = _shared.loginToken().toStdString();
//-- Geometry
Geometry::Polygon polygon;
//-- Get ROI bounding box, clipping to max area of interest
Expand Down
1 change: 0 additions & 1 deletion src/Airmap/AirMapRulesetsManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ void AirMapRulesetsManager::setROI(const QGCGeoBoundingCube& roi, bool reset)
_ruleSets.clearAndDeleteContents();
_state = State::RetrieveItems;
RuleSets::Search::Parameters params;
params.authorization = _shared.loginToken().toStdString();
//-- Geometry: Polygon
Geometry::Polygon polygon;
//-- Get ROI bounding box, clipping to max area of interest
Expand Down
12 changes: 6 additions & 6 deletions src/Airmap/services/advisory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ airmap::services::Advisory::Advisory(const std::shared_ptr<Dispatcher>& dispatch
}

void airmap::services::Advisory::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().for_id(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().for_id(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Advisory::search(const Search::Parameters& parameters, const Search::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().search(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().search(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Advisory::report_weather(const ReportWeather::Parameters& parameters,
const ReportWeather::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().report_weather(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->advisory().report_weather(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
Expand Down
12 changes: 6 additions & 6 deletions src/Airmap/services/aircrafts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ airmap::services::Aircrafts::Aircrafts(const std::shared_ptr<Dispatcher>& dispat

void airmap::services::Aircrafts::manufacturers(const Manufacturers::Parameters& parameters,
const Manufacturers::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().manufacturers(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().manufacturers(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Aircrafts::models(const Models::Parameters& parameters, const Models::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().models(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().models(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Aircrafts::model_for_id(const ModelForId::Parameters& parameters, const ModelForId::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().model_for_id(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->aircrafts().model_for_id(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/Airmap/services/airspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ airmap::services::Airspaces::Airspaces(const std::shared_ptr<Dispatcher>& dispat
}

void airmap::services::Airspaces::search(const Search::Parameters& parameters, const Search::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->airspaces().search(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->airspaces().search(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Airspaces::for_ids(const ForIds::Parameters& parameters, const ForIds::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->airspaces().for_ids(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->airspaces().for_ids(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
Expand Down
12 changes: 6 additions & 6 deletions src/Airmap/services/authenticator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ airmap::services::Authenticator::Authenticator(const std::shared_ptr<Dispatcher>

void airmap::services::Authenticator::authenticate_with_password(const AuthenticateWithPassword::Params& parameters,
const AuthenticateWithPassword::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().authenticate_with_password(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().authenticate_with_password(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Authenticator::authenticate_anonymously(const AuthenticateAnonymously::Params& parameters,
const AuthenticateAnonymously::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().authenticate_anonymously(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().authenticate_anonymously(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::Authenticator::renew_authentication(const RenewAuthentication::Params& parameters,
const RenewAuthentication::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().renew_authentication(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->authenticator().renew_authentication(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
Expand Down
24 changes: 12 additions & 12 deletions src/Airmap/services/flight_plans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ airmap::services::FlightPlans::FlightPlans(const std::shared_ptr<Dispatcher>& di
}

void airmap::services::FlightPlans::for_id(const ForId::Parameters& parameters, const ForId::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().for_id(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().for_id(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::FlightPlans::create_by_polygon(const Create::Parameters& parameters, const Create::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().create_by_polygon(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().create_by_polygon(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::FlightPlans::update(const Update::Parameters& parameters, const Update::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().update(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().update(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::FlightPlans::delete_(const Delete::Parameters& parameters, const Delete::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().delete_(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().delete_(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::FlightPlans::render_briefing(const RenderBriefing::Parameters& parameters,
const RenderBriefing::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().render_briefing(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().render_briefing(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
}

void airmap::services::FlightPlans::submit(const Submit::Parameters& parameters, const Submit::Callback& cb) {
dispatcher_->dispatch_to_airmap([this, sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().submit(parameters, [this, sp, cb](const auto& result) {
dispatcher_->dispatch_to_airmap([sp = shared_from_this(), parameters, cb]() {
sp->client_->flight_plans().submit(parameters, [sp, cb](const auto& result) {
sp->dispatcher_->dispatch_to_qt([sp, result, cb]() { cb(result); });
});
});
Expand Down
Loading

0 comments on commit ecd3ae2

Please sign in to comment.