1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-29 make dependency on osgQt and osgearthQt optional

This commit is contained in:
Philippe Renon 2016-01-15 08:55:46 +01:00
parent 3cc581a002
commit f5a1498b36
4 changed files with 39 additions and 15 deletions

View File

@ -87,7 +87,6 @@ osg:win32 {
libosgManipulator$${DS}.dll \
libosgParticle$${DS}.dll \
libosgPresentation$${DS}.dll \
libosgQt$${DS}.dll \
libosgShadow$${DS}.dll \
libosgSim$${DS}.dll \
libosgTerrain$${DS}.dll \
@ -97,6 +96,9 @@ osg:win32 {
libosgVolume$${DS}.dll \
libosgWidget$${DS}.dll
osgQt:OSG_LIBS += \
libosgQt$${DS}.dll
for(lib, OSG_LIBS) {
addCopyFileTarget($${lib},$${OSG_SDK_DIR}/bin,$${GCS_APP_PATH})
}
@ -185,10 +187,12 @@ osgearth:win32 {
libosgEarth$${DS}.dll \
libosgEarthAnnotation$${DS}.dll \
libosgEarthFeatures$${DS}.dll \
libosgEarthQt$${DS}.dll \
libosgEarthSymbology$${DS}.dll \
libosgEarthUtil$${DS}.dll
osgearthQt:OSGEARTH_LIBS += \
libosgEarthQt$${DS}.dll
for(lib, OSGEARTH_LIBS) {
addCopyFileTarget($${lib},$${OSGEARTH_SDK_DIR}/bin,$${GCS_APP_PATH})
}

View File

@ -4,17 +4,23 @@ DEFINES += OSGEARTH_LIBRARY
#CONFIG += mys2
!msys2:OSG_VERSION = 3.4.0
msys2:OSG_VERSION = 3.5.1
CONFIG += osg
DEFINES += USE_OSG
#CONFIG += osgQt
exists( $(OSGEARTH_SDK_DIR) ) {
CONFIG += osgearth
DEFINES += USE_OSGEARTH
#CONFIG += osgearthQt
}
!msys2:OSG_VERSION = 3.4.0
msys2:OSG_VERSION = 3.5.1
osg:DEFINES += USE_OSG
osgQt:DEFINES += USE_OSG_QT
osgearth:DEFINES += USE_OSGEARTH
osgearthQt:DEFINES += USE_OSGEARTH_QT
#DEFINES += OSG_USE_QT_PRIVATE
QT += widgets opengl qml quick

View File

@ -18,12 +18,14 @@ osg {
linux|macx {
LIBS += -L$$OSG_SDK_DIR/$$LIB_DIR_NAME
LIBS +=-lOpenThreads -losg -losgUtil -losgDB -losgGA -losgFX -losgViewer -losgText -losgQt
LIBS += -lOpenThreads -losg -losgUtil -losgDB -losgGA -losgFX -losgViewer -losgText
osgQt:LIBS += -losgQt
}
win32 {
LIBS += -L$$OSG_SDK_DIR/lib
LIBS += -lOpenThreads$${DS} -losg$${DS} -losgUtil$${DS} -losgDB$${DS} -losgGA$${DS} -losgFX$${DS} -losgViewer$${DS} -losgText$${DS} -losgQt$${DS}
LIBS += -lOpenThreads$${DS} -losg$${DS} -losgUtil$${DS} -losgDB$${DS} -losgGA$${DS} -losgFX$${DS} -losgViewer$${DS} -losgText$${DS}
osgQt:LIBS += -losgQt$${DS}
}
}
@ -35,11 +37,13 @@ osgearth {
linux|macx {
LIBS += -L$$OSGEARTH_SDK_DIR/$$LIB_DIR_NAME
LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation -losgEarthQt
LIBS += -losgEarth -losgEarthUtil -losgEarthFeatures -losgEarthSymbology -losgEarthAnnotation
osgearthQt:LIBS += -losgEarthQt
}
win32 {
LIBS += -L$$OSGEARTH_SDK_DIR/lib
LIBS += -losgEarth$${DS} -losgEarthUtil$${DS} -losgEarthFeatures$${DS} -losgEarthSymbology$${DS} -losgEarthAnnotation$${DS} -losgEarthQt$${DS}
LIBS += -losgEarth$${DS} -losgEarthUtil$${DS} -losgEarthFeatures$${DS} -losgEarthSymbology$${DS} -losgEarthAnnotation$${DS}
osgearthQt:LIBS += -losgEarthQt$${DS}
}
}

View File

@ -54,14 +54,17 @@
#include <osgText/Font>
#include <osgText/Text>
#include <osgText/String>
#ifdef USE_OSG_QT
#include <osgQt/QFontImplementation>
#endif // USE_OSG_QT
#ifdef USE_OSGEARTH
#include <osgEarth/Capabilities>
#include <osgEarth/MapNode>
#include <osgEarth/SpatialReference>
#include <osgEarth/ElevationQuery>
#endif
#endif // USE_OSGEARTH
#include <QFont>
#include <QKeyEvent>
@ -152,12 +155,19 @@ osgText::Font *createFont(const std::string &name)
return 0;
}
return new osgText::Font(new osgQt::QFontImplementation(font));
return createFont(font);
}
osgText::Font *createFont(const QFont &font)
{
#ifdef USE_OSG_QT
return new osgText::Font(new osgQt::QFontImplementation(font));
#else
qWarning() << "Cannot create osgText::Font from QFont (osgQt is not available)";
return osgText::Font::getDefaultFont();
#endif // USE_OSG_QT
}
osgText::Text *createText(const osg::Vec3 &pos, const std::string &content, float size, osgText::Font *font)
@ -501,7 +511,7 @@ void capabilitiesInfo(const osgEarth::Capabilities &caps)
qDebug().nospace() << "PreferDisplayListsForStaticGeometry : " << caps.preferDisplayListsForStaticGeometry();
qDebug().nospace() << "FragDepthWrite : " << caps.supportsFragDepthWrite();
}
#endif // ifdef USE_OSGEARTH
#endif // USE_OSGEARTH
void registerTypes()
{
@ -533,6 +543,6 @@ void registerTypes()
#ifdef USE_OSGEARTH
qmlRegisterType<osgQtQuick::OSGModelNode>("OsgQtQuick", maj, min, "OSGModelNode");
qmlRegisterType<osgQtQuick::OSGSkyNode>("OsgQtQuick", maj, min, "OSGSkyNode");
#endif
#endif // USE_OSGEARTH
}
} // namespace osgQtQuick