Skip to content

Commit

Permalink
[globe] Make OSG_PLUGINS_PATH CMake option functional on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Nov 12, 2013
1 parent e882e47 commit 3d0b286
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -32,6 +32,9 @@
//used by Mac to find system Qt plugins when bundle is run from build directory
#define QTPLUGINSDIR "${QT_PLUGINS_DIR}"

//used by Mac to find system Open Scene Graph plugins when bundle is run from build directory
#define OSG_PLUGINS_PATH "${OSG_PLUGINS_PATH}"

#cmakedefine USING_NMAKE

#cmakedefine HAVE_POSTGRESQL
Expand Down
21 changes: 17 additions & 4 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -38,6 +38,7 @@
#include <qgsdistancearea.h>

#include <QAction>
#include <QDir>
#include <QToolBar>
#include <QMessageBox>

Expand Down Expand Up @@ -96,11 +97,23 @@ GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
setObjectName( "globePlugin" );
setParent( theQgisInterface->mainWindow() );

// add internal osg plugin path if bundled osg on OS X
#ifdef HAVE_MACAPP_BUNDLED_OSG
if ( !QgsApplication::isRunningFromBuildDir() )
// update path to osg plugins on Mac OS X
#ifdef Q_OS_MACX
if ( !getenv( "OSG_LIBRARY_PATH" ) )
{
osgDB::Registry::instance()->setLibraryFilePathList( QDir::cleanPath( QgsApplication::pluginPath() + "/../osgPlugins" ).toStdString() );
// OSG_PLUGINS_PATH value set by CMake option
QString ogsPlugins( OSG_PLUGINS_PATH );
#ifdef HAVE_MACAPP_BUNDLED_OSG
if ( !QgsApplication::isRunningFromBuildDir() )
{
// add internal osg plugin path if bundled osg
ogsPlugins = QgsApplication::pluginPath() + "/../osgPlugins";
}
#endif
if ( QFile::exists( ogsPlugins ) )
{
osgDB::Registry::instance()->setLibraryFilePathList( QDir::cleanPath( ogsPlugins ).toStdString() );
}
}
#endif

Expand Down

0 comments on commit 3d0b286

Please sign in to comment.