Skip to content

Commit

Permalink
Define QGIS_MACAPP_BUNDLE in qgsconfig.h so resources can be found wh…
Browse files Browse the repository at this point in the history
…en QGIS_MACAPP_BUNDLE=0
  • Loading branch information
dakcarto committed Feb 22, 2014
1 parent ececdb7 commit 30fff85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Expand Up @@ -450,10 +450,6 @@ ELSE (WIN32)
SET (CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib)
IF (WITH_GLOBE)
SET (OSG_PLUGINS_PATH "" CACHE PATH "Path to OSG plugins for bundling")
IF (QGIS_MACAPP_BUNDLE GREATER 0)
# ensure OSG plugins bundled path will be used by globe plugin
SET (HAVE_MACAPP_BUNDLED_OSG 1)
ENDIF (QGIS_MACAPP_BUNDLE GREATER 0)
ENDIF (WITH_GLOBE)
# recent cmakes force SDKs, recent SDKs don't have user symlinks
# need to find non-system frameworks
Expand Down
11 changes: 6 additions & 5 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -29,10 +29,13 @@
#define CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}"

#define QSCINTILLA_VERSION_STR "${QSCINTILLA_VERSION_STR}"
//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
#if defined( __APPLE__ )
//used by Mac to find system or bundle resources relative to amount of bundling
#define QGIS_MACAPP_BUNDLE ${QGIS_MACAPP_BUNDLE}
#endif

#define QT_PLUGINS_DIR "${QT_PLUGINS_DIR}"
#define OSG_PLUGINS_PATH "${OSG_PLUGINS_PATH}"

#cmakedefine USING_NMAKE
Expand All @@ -53,7 +56,5 @@

#cmakedefine MAPSERVER_SKIP_ECW

#cmakedefine HAVE_MACAPP_BUNDLED_OSG

#endif

4 changes: 2 additions & 2 deletions src/app/main.cpp
Expand Up @@ -858,9 +858,9 @@ int main( int argc, char *argv[] )
// Now set the paths inside the bundle
myPath += "/Contents/Plugins";
QCoreApplication::addLibraryPath( myPath );
if ( QgsApplication::isRunningFromBuildDir() )
if ( QgsApplication::isRunningFromBuildDir() || QGIS_MACAPP_BUNDLE == 0 )
{
QCoreApplication::addLibraryPath( QTPLUGINSDIR );
QCoreApplication::addLibraryPath( QT_PLUGINS_DIR );
}
//next two lines should not be needed, testing only
#if 0
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -111,13 +111,11 @@ GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
{
// OSG_PLUGINS_PATH value set by CMake option
QString ogsPlugins( OSG_PLUGINS_PATH );
#ifdef HAVE_MACAPP_BUNDLED_OSG
if ( !QgsApplication::isRunningFromBuildDir() )
if ( QGIS_MACAPP_BUNDLE > 0 && !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() );
Expand Down

0 comments on commit 30fff85

Please sign in to comment.