From 909727e360817cf1a12f4298858a4c6c6ea466f0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 28 Dec 2011 18:31:49 +0100 Subject: [PATCH] Added auto-fixing of OpenSceneGraph library dependencies on Mac OS X --- qgroundcontrol.pri | 61 ++++++++++++++++++++++++++++++- src/uas/ArduPilotMegaMAV.cc | 3 +- src/uas/UAS.cc | 26 ++----------- src/ui/linechart/LinechartPlot.cc | 27 ++++++++++---- 4 files changed, 84 insertions(+), 33 deletions(-) diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index a2b8db18b..d3e5ba9da 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -93,7 +93,66 @@ macx|macx-g++42|macx-g++: { # Copy parameter tooltip files QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/qgroundcontrol.app/Contents/MacOS # Copy libraries - QMAKE_POST_LINK += && cp -rf $$BASEDIR/lib/mac64/lib/* $$TARGETDIR/qgroundcontrol.app/Contents/MacOS + QMAKE_POST_LINK += && mkdir -p $$TARGETDIR/qgroundcontrol.app/Contents/libs + QMAKE_POST_LINK += && cp -rf $$BASEDIR/lib/mac64/lib/* $$TARGETDIR/qgroundcontrol.app/Contents/libs + + # Fix library paths inside executable + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + QMAKE_POST_LINK += && install_name_tool -change libosgWidget.dylib "@executable_path/../libs/libosgWidget.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/qgroundcontrol + + # Fix library paths within libraries (inter-library dependencies) + + # OSG GA LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgGA.dylib + + # OSG DB LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgDB.dylib + + # OSG TEXT LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgText.dylib + + # OSG UTIL LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgUtil.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgUtil.dylib + + + # OSG VIEWER LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgViewer.dylib + + # OSG WIDGET LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libosgGA.dylib "@executable_path/../libs/libosgGA.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgText.dylib "@executable_path/../libs/libosgText.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgDB.dylib "@executable_path/../libs/libosgDB.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgUtil.dylib "@executable_path/../libs/libosgUtil.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libosg.dylib "@executable_path/../libs/libosg.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + QMAKE_POST_LINK += && install_name_tool -change libosgViewer.dylib "@executable_path/../libs/libosgViewer.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosgWidget.dylib + + # CORE OSG LIBRARY + QMAKE_POST_LINK += && install_name_tool -change libOpenThreads.dylib "@executable_path/../libs/libOpenThreads.dylib" $$TARGETDIR/qgroundcontrol.app/Contents/libs/libosg.dylib + + # Copy model files #QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs diff --git a/src/uas/ArduPilotMegaMAV.cc b/src/uas/ArduPilotMegaMAV.cc index 0c11bdc5e..99df9774f 100644 --- a/src/uas/ArduPilotMegaMAV.cc +++ b/src/uas/ArduPilotMegaMAV.cc @@ -50,7 +50,8 @@ void ArduPilotMegaMAV::receiveMessage(LinkInterface* link, mavlink_message_t mes if (message.sysid == uasId) { // Handle your special messages switch (message.msgid) { - case MAVLINK_MSG_ID_HEARTBEAT: { + case MAVLINK_MSG_ID_HEARTBEAT: + { //qDebug() << "ARDUPILOT RECEIVED HEARTBEAT"; break; } diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index bfe98d216..c0c6e690c 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -164,7 +164,8 @@ void UAS::updateState() void UAS::setSelected() { - if (UASManager::instance()->getActiveUAS() != this) { + if (UASManager::instance()->getActiveUAS() != this) + { UASManager::instance()->setActiveUAS(this); emit systemSelected(true); } @@ -175,24 +176,6 @@ bool UAS::getSelected() const return (UASManager::instance()->getActiveUAS() == this); } -//void UAS::receiveMessageNamedValue(const mavlink_message_t& message) -//{ -// if (message.msgid == MAVLINK_MSG_ID_NAMED_VALUE_FLOAT) -// { -// mavlink_named_value_float_t val; -// mavlink_msg_named_value_float_decode(&message, &val); -// QByteArray bytes(val.name, MAVLINK_MSG_NAMED_VALUE_FLOAT_FIELD_NAME_LEN); -// emit valueChanged(this->getUASID(), QString(bytes), tr("raw"), val.value, getUnixTime()); -// } -// else if (message.msgid == MAVLINK_MSG_ID_NAMED_VALUE_INT) -// { -// mavlink_named_value_int_t val; -// mavlink_msg_named_value_int_decode(&message, &val); -// QByteArray bytes(val.name, MAVLINK_MSG_NAMED_VALUE_INT_FIELD_NAME_LEN); -// emit valueChanged(this->getUASID(), QString(bytes), tr("raw"), val.value, getUnixTime()); -// } -//} - void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) { if (!link) return; @@ -201,10 +184,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) addLink(link); // qDebug() << __FILE__ << __LINE__ << "ADDED LINK!" << link->getName(); } - // else - // { - // qDebug() << __FILE__ << __LINE__ << "DID NOT ADD LINK" << link->getName() << "ALREADY IN LIST"; - // } // qDebug() << "UAS RECEIVED from" << message.sysid << "component" << message.compid << "msg id" << message.msgid << "seq no" << message.seq; @@ -429,6 +408,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) // compass = 0.0f; // } + attitudeKnown = true; emit attitudeChanged(this, roll, pitch, yaw, time); emit attitudeSpeedChanged(uasId, attitude.rollspeed, attitude.pitchspeed, attitude.yawspeed, time); diff --git a/src/ui/linechart/LinechartPlot.cc b/src/ui/linechart/LinechartPlot.cc index c8c6aee69..b886239dd 100644 --- a/src/ui/linechart/LinechartPlot.cc +++ b/src/ui/linechart/LinechartPlot.cc @@ -287,7 +287,11 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value) if(ms > maxTime) maxTime = ms; storageInterval = maxTime - minTime; - if(time > lastTime) lastTime = time; + if(time > lastTime) + { + qDebug() << "UPDATED LAST TIME!" << dataname << time << lastTime; + lastTime = time; + } // if (value < minValue) minValue = value; @@ -524,8 +528,10 @@ bool LinechartPlot::isVisible(QString id) bool LinechartPlot::anyCurveVisible() { bool visible = false; - foreach (QString key, curves.keys()) { - if (curves.value(key)->isVisible()) { + foreach (QString key, curves.keys()) + { + if (curves.value(key)->isVisible()) + { visible = true; } } @@ -599,7 +605,8 @@ void LinechartPlot::setPlotInterval(int interval) { plotInterval = interval; QMap::iterator j; - for(j = data.begin(); j != data.end(); ++j) { + for(j = data.begin(); j != data.end(); ++j) + { TimeSeriesData* d = data.value(j.key()); d->setInterval(interval); } @@ -644,7 +651,8 @@ void LinechartPlot::setLinearScaling() void LinechartPlot::setAverageWindow(int windowSize) { this->averageWindowSize = windowSize; - foreach(TimeSeriesData* series, data) { + foreach(TimeSeriesData* series, data) + { series->setAverageWindowSize(windowSize); } } @@ -664,7 +672,8 @@ void LinechartPlot::paintRealtime() #endif // Update plot window value to new max time if the last time was also the max time windowLock.lock(); - if (automaticScrollActive) { + if (automaticScrollActive) + { // FIXME Check, but commenting this out should have been // beneficial (does only add complexity) @@ -741,7 +750,8 @@ void LinechartPlot::removeAllData() datalock.lock(); // Delete curves QMap::iterator i; - for(i = curves.begin(); i != curves.end(); ++i) { + for(i = curves.begin(); i != curves.end(); ++i) + { // Remove from curve list QwtPlotCurve* curve = curves.take(i.key()); // Delete the object @@ -755,7 +765,8 @@ void LinechartPlot::removeAllData() // Delete data QMap::iterator j; - for(j = data.begin(); j != data.end(); ++j) { + for(j = data.begin(); j != data.end(); ++j) + { // Remove from data list TimeSeriesData* d = data.take(j.key()); // Delete the object -- 2.22.0