diff --git a/ground/gcs/src/libs/osgearth/copydata.pro b/ground/gcs/src/libs/osgearth/copydata.pro index 9c7432af2..7c20f24d2 100644 --- a/ground/gcs/src/libs/osgearth/copydata.pro +++ b/ground/gcs/src/libs/osgearth/copydata.pro @@ -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}) } diff --git a/ground/gcs/src/libs/osgearth/osgearth.pro b/ground/gcs/src/libs/osgearth/osgearth.pro index 6496a6d56..baa32911c 100644 --- a/ground/gcs/src/libs/osgearth/osgearth.pro +++ b/ground/gcs/src/libs/osgearth/osgearth.pro @@ -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 diff --git a/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri b/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri index a94b05350..c3d55285c 100644 --- a/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri +++ b/ground/gcs/src/libs/osgearth/osgearth_dependencies.pri @@ -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} } } diff --git a/ground/gcs/src/libs/osgearth/utility.cpp b/ground/gcs/src/libs/osgearth/utility.cpp index 43482ffbf..aa2e4e73a 100644 --- a/ground/gcs/src/libs/osgearth/utility.cpp +++ b/ground/gcs/src/libs/osgearth/utility.cpp @@ -54,14 +54,17 @@ #include #include #include + +#ifdef USE_OSG_QT #include +#endif // USE_OSG_QT #ifdef USE_OSGEARTH #include #include #include #include -#endif +#endif // USE_OSGEARTH #include #include @@ -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", maj, min, "OSGModelNode"); qmlRegisterType("OsgQtQuick", maj, min, "OSGSkyNode"); -#endif +#endif // USE_OSGEARTH } } // namespace osgQtQuick