diff --git a/CMakeLists.txt b/CMakeLists.txt index f2cd3a5d0d7..f7bf4972719 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -399,6 +399,12 @@ IF (WIN32) SET(DLLIMPORT "__declspec(dllimport)") SET(DLLEXPORT "__declspec(dllexport)") ELSE (WIN32) + IF(PEDANTIC) + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined") + ENDIF(PEDANTIC) + SET(DLLIMPORT "") SET(DLLEXPORT "") ENDIF(WIN32) diff --git a/cmake/FindProj.cmake b/cmake/FindProj.cmake index 2fe0fa63c70..03dad923234 100644 --- a/cmake/FindProj.cmake +++ b/cmake/FindProj.cmake @@ -45,7 +45,7 @@ FIND_PATH(PROJ_INCLUDE_DIR proj_api.h ) FIND_PATH(PROJ_INCLUDE_DIR proj_api.h) -FIND_LIBRARY(PROJ_LIBRARY NAMES proj PATHS +FIND_LIBRARY(PROJ_LIBRARY NAMES proj proj_i PATHS "$ENV{LIB_DIR}/lib" #mingw c:/msys/local/lib diff --git a/src/plugins/grass/CMakeLists.txt b/src/plugins/grass/CMakeLists.txt index beff2e73b1b..dd2e42ee377 100644 --- a/src/plugins/grass/CMakeLists.txt +++ b/src/plugins/grass/CMakeLists.txt @@ -143,17 +143,6 @@ TARGET_LINK_LIBRARIES(grassplugin ${OPENPTY_LIBRARY} ) -# provider must be built as module on OS X so it gets loaded, -# lookup symbols dynamically instead of linking at compile time -IF (APPLE) - SET_TARGET_PROPERTIES(grassplugin PROPERTIES - LINK_FLAGS "-undefined dynamic_lookup") -ELSE (APPLE) - TARGET_LINK_LIBRARIES(grassplugin - grassprovider - ) -ENDIF (APPLE) - # override default path where built files are put to allow running qgis without installing # the binary goes under libexec subdir SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIBEXEC_SUBDIR}/grass/bin) diff --git a/src/providers/grass/CMakeLists.txt b/src/providers/grass/CMakeLists.txt index bb3805afd34..5bdfae3d9fe 100644 --- a/src/providers/grass/CMakeLists.txt +++ b/src/providers/grass/CMakeLists.txt @@ -16,7 +16,8 @@ INCLUDE_DIRECTORIES( # GRASS library # -ADD_LIBRARY(qgisgrass SHARED qgsgrass.cpp) +QT4_WRAP_CPP(GRASS_PROVIDER_MOC_SRCS qgsgrassprovider.h) +ADD_LIBRARY(qgisgrass SHARED qgsgrass.cpp qgsgrassprovider.cpp ${GRASS_PROVIDER_MOC_SRCS}) SET_TARGET_PROPERTIES(qgisgrass PROPERTIES CLEAN_DIRECT_OUTPUT 1 @@ -52,14 +53,7 @@ ENDIF (APPLE) # GRASS vector provider # -QT4_WRAP_CPP(GRASS_PROVIDER_MOC_SRCS qgsgrassprovider.h) -# provider must be built as module on OS X so it gets loaded, -# other modules that need provider symbols must dynamically lookup them -IF (APPLE) - ADD_LIBRARY(grassprovider MODULE qgsgrassprovider.cpp ${GRASS_PROVIDER_MOC_SRCS}) -ELSE (APPLE) - ADD_LIBRARY(grassprovider SHARED qgsgrassprovider.cpp ${GRASS_PROVIDER_MOC_SRCS}) -ENDIF (APPLE) +ADD_LIBRARY(grassprovider MODULE qgsgrassprovidermodule.cpp) SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\"" ) TARGET_LINK_LIBRARIES(grassprovider qgisgrass) diff --git a/src/providers/grass/qgsgrassprovider.cpp b/src/providers/grass/qgsgrassprovider.cpp index 850146915c9..4fd4a51be08 100644 --- a/src/providers/grass/qgsgrassprovider.cpp +++ b/src/providers/grass/qgsgrassprovider.cpp @@ -30,10 +30,6 @@ #include "qgsgrass.h" #include "qgsgrassprovider.h" - -#include "qgsgrassprovider.h" -#include "qgsgrass.h" - #include "qgsapplication.h" #include "qgscoordinatereferencesystem.h" #include "qgsfield.h" @@ -45,9 +41,6 @@ #include #include #include -//#include -//#include -//#include #ifdef _MSC_VER // enable grass prototypes @@ -2421,179 +2414,13 @@ int QgsGrassProvider::cidxGetMaxCat( int idx ) return ( cat ); } - - QString QgsGrassProvider::name() const { return GRASS_KEY; } // QgsGrassProvider::name() - - QString QgsGrassProvider::description() const { return GRASS_DESCRIPTION; } // QgsGrassProvider::description() - -QgsGrassLocationItem::QgsGrassLocationItem( QgsDataItem* parent, QString path ) - : QgsDataCollectionItem( parent, "", path ) -{ - QFileInfo fi( path ); - mName = fi.baseName(); - mIcon = QIcon( getThemePixmap( "grass_location.png" ) ); -} -QgsGrassLocationItem::~QgsGrassLocationItem() {} - -bool QgsGrassLocationItem::isLocation( QString path ) -{ - //QgsDebugMsg( "path = " + path ); - return QFile::exists( path + QDir::separator() + "PERMANENT" + QDir::separator() + "DEFAULT_WIND" ); -} - -QVectorQgsGrassLocationItem::createChildren() -{ - QVector mapsets; - - QDir dir( mPath ); - - QStringList entries = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name ); - foreach( QString name, entries ) - { - QString path = dir.absoluteFilePath( name ); - - if ( QgsGrassMapsetItem::isMapset( path ) ) - { - QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem( this, path ); - mapsets.append( mapset ); - } - } - return mapsets; -} - -QgsGrassMapsetItem::QgsGrassMapsetItem( QgsDataItem* parent, QString path ) - : QgsDataCollectionItem( parent, "", path ) -{ - QDir dir( path ); - mName = dir.dirName(); - dir.cdUp(); - mLocation = dir.dirName(); - dir.cdUp(); - mGisdbase = dir.path(); - - mIcon = QIcon( getThemePixmap( "grass_mapset.png" ) ); -} - -QgsGrassMapsetItem::~QgsGrassMapsetItem() {} - -bool QgsGrassMapsetItem::isMapset( QString path ) -{ - return QFile::exists( path + QDir::separator() + "WIND" ); -} - -QVector QgsGrassMapsetItem::createChildren() -{ - QVector items; - - QStringList vectorNames = QgsGrass::vectors( mPath ); - - foreach( QString name, vectorNames ) - { - QStringList layerNames = QgsGrass::vectorLayers( mGisdbase , mLocation, mName, name ); - - QString path = mPath + QDir::separator() + "vector" + QDir::separator() + name; - - QgsDataCollectionItem *map = 0; - if ( layerNames.size() != 1 ) - map = new QgsDataCollectionItem( this, name ); - foreach( QString layerName, layerNames ) - { - QString uri = mPath + QDir::separator() + name + QDir::separator() + layerName; - QgsLayerItem::LayerType layerType = QgsLayerItem::Vector; - QString typeName = layerName.split( "_" )[1]; - QString baseLayerName = layerName.split( "_" )[0]; - - if ( typeName == "point" ) - layerType = QgsLayerItem::Point; - else if ( typeName == "line" ) - layerType = QgsLayerItem::Line; - else if ( typeName == "polygon" ) - layerType = QgsLayerItem::Polygon; - - if ( layerNames.size() == 1 ) - { - QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, path, uri, layerType, "grass" ); - items.append( layer ); - } - else - { - QgsLayerItem *layer = new QgsLayerItem( map, baseLayerName, path, uri, layerType, "grass" ); - map->addChild( layer ); - } - } - if ( layerNames.size() != 1 ) - items.append( map ); - } - - QStringList rasterNames = QgsGrass::rasters( mPath ); - - foreach( QString name, rasterNames ) - { - QString uri = mPath + QDir::separator() + "cellhd" + QDir::separator() + name; - QgsDebugMsg( "uri = " + uri ); - - QgsLayerItem *layer = new QgsLayerItem( this, name, uri, uri, QgsLayerItem::Raster, "grassraster" ); - - items.append( layer ); - } - - return items; -} - -QGISEXTERN int dataCapabilities() -{ - return QgsDataProvider::Dir; -} - -QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) -{ - if ( QgsGrassLocationItem::isLocation( thePath ) ) - { - QgsGrassLocationItem * location = new QgsGrassLocationItem( parentItem, thePath ); - return location; - } - return 0; -} - -/** -* Class factory to return a pointer to a newly created -* QgsGrassProvider object -*/ -QGISEXTERN QgsGrassProvider * classFactory( const QString *uri ) -{ - return new QgsGrassProvider( *uri ); -} - -/** Required key function (used to map the plugin to a data store type) -*/ -QGISEXTERN QString providerKey() -{ - return QString( "grass" ); -} - -/** -* Required description function -*/ -QGISEXTERN QString description() -{ - return QString( "GRASS data provider" ); -} - -/** -* Required isProvider function. Used to determine if this shared library -* is a data provider plugin -*/ -QGISEXTERN bool isProvider() -{ - return true; -} diff --git a/src/providers/grass/qgsgrassprovider.h b/src/providers/grass/qgsgrassprovider.h index d7c9466a717..a4b7364cf6a 100644 --- a/src/providers/grass/qgsgrassprovider.h +++ b/src/providers/grass/qgsgrassprovider.h @@ -20,7 +20,6 @@ class QgsFeature; class QgsField; #include -#include "qgsdataitem.h" #include "qgsvectordataprovider.h" #include @@ -110,7 +109,7 @@ struct GMAP \class QgsGrassProvider \brief Data provider for GRASS vectors */ -class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider +class GRASS_LIB_EXPORT QgsGrassProvider : public QgsVectorDataProvider { Q_OBJECT @@ -687,30 +686,4 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider static std::vector mMaps; // Map }; - -class QgsGrassLocationItem : public QgsDataCollectionItem -{ - public: - QgsGrassLocationItem( QgsDataItem* parent, QString path ); - ~QgsGrassLocationItem(); - - static bool isLocation( QString path ); - QVector createChildren(); -}; - -class QgsGrassMapsetItem : public QgsDataCollectionItem -{ - public: - QgsGrassMapsetItem( QgsDataItem* parent, QString path ); - ~QgsGrassMapsetItem(); - - static bool isMapset( QString path ); - QVector createChildren(); - - QString mLocation; - QString mGisdbase; -}; - - - #endif // QGSGRASSPROVIDER_H diff --git a/src/providers/grass/qgsgrassprovidermodule.cpp b/src/providers/grass/qgsgrassprovidermodule.cpp new file mode 100644 index 00000000000..eb11147a9d1 --- /dev/null +++ b/src/providers/grass/qgsgrassprovidermodule.cpp @@ -0,0 +1,185 @@ +/*************************************************************************** + qgsgrassprovidermodule.cpp - Data provider for GRASS format + ------------------- + begin : March, 2004 + copyright : (C) 2004 by Gary E.Sherman, Radim Blazek + email : sherman@mrcc.com, blazek@itc.it + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qgsgrassprovidermodule.h" +#include "qgsgrassprovider.h" +#include "qgsgrass.h" +#include "qgslogger.h" + +#include +#include + +QgsGrassLocationItem::QgsGrassLocationItem( QgsDataItem* parent, QString path ) + : QgsDataCollectionItem( parent, "", path ) +{ + QFileInfo fi( path ); + mName = fi.baseName(); + mIcon = QIcon( getThemePixmap( "grass_location.png" ) ); +} +QgsGrassLocationItem::~QgsGrassLocationItem() {} + +bool QgsGrassLocationItem::isLocation( QString path ) +{ + //QgsDebugMsg( "path = " + path ); + return QFile::exists( path + QDir::separator() + "PERMANENT" + QDir::separator() + "DEFAULT_WIND" ); +} + +QVectorQgsGrassLocationItem::createChildren() +{ + QVector mapsets; + + QDir dir( mPath ); + + QStringList entries = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name ); + foreach( QString name, entries ) + { + QString path = dir.absoluteFilePath( name ); + + if ( QgsGrassMapsetItem::isMapset( path ) ) + { + QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem( this, path ); + mapsets.append( mapset ); + } + } + return mapsets; +} + +QgsGrassMapsetItem::QgsGrassMapsetItem( QgsDataItem* parent, QString path ) + : QgsDataCollectionItem( parent, "", path ) +{ + QDir dir( path ); + mName = dir.dirName(); + dir.cdUp(); + mLocation = dir.dirName(); + dir.cdUp(); + mGisdbase = dir.path(); + + mIcon = QIcon( getThemePixmap( "grass_mapset.png" ) ); +} + +QgsGrassMapsetItem::~QgsGrassMapsetItem() {} + +bool QgsGrassMapsetItem::isMapset( QString path ) +{ + return QFile::exists( path + QDir::separator() + "WIND" ); +} + +QVector QgsGrassMapsetItem::createChildren() +{ + QVector items; + + QStringList vectorNames = QgsGrass::vectors( mPath ); + + foreach( QString name, vectorNames ) + { + QStringList layerNames = QgsGrass::vectorLayers( mGisdbase , mLocation, mName, name ); + + QString path = mPath + QDir::separator() + "vector" + QDir::separator() + name; + + QgsDataCollectionItem *map = 0; + if ( layerNames.size() != 1 ) + map = new QgsDataCollectionItem( this, name ); + foreach( QString layerName, layerNames ) + { + QString uri = mPath + QDir::separator() + name + QDir::separator() + layerName; + QgsLayerItem::LayerType layerType = QgsLayerItem::Vector; + QString typeName = layerName.split( "_" )[1]; + QString baseLayerName = layerName.split( "_" )[0]; + + if ( typeName == "point" ) + layerType = QgsLayerItem::Point; + else if ( typeName == "line" ) + layerType = QgsLayerItem::Line; + else if ( typeName == "polygon" ) + layerType = QgsLayerItem::Polygon; + + if ( layerNames.size() == 1 ) + { + QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, path, uri, layerType, "grass" ); + items.append( layer ); + } + else + { + QgsLayerItem *layer = new QgsLayerItem( map, baseLayerName, path, uri, layerType, "grass" ); + map->addChild( layer ); + } + } + if ( layerNames.size() != 1 ) + items.append( map ); + } + + QStringList rasterNames = QgsGrass::rasters( mPath ); + + foreach( QString name, rasterNames ) + { + QString uri = mPath + QDir::separator() + "cellhd" + QDir::separator() + name; + QgsDebugMsg( "uri = " + uri ); + + QgsLayerItem *layer = new QgsLayerItem( this, name, uri, uri, QgsLayerItem::Raster, "grassraster" ); + + items.append( layer ); + } + + return items; +} + +QGISEXTERN int dataCapabilities() +{ + return QgsDataProvider::Dir; +} + +QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) +{ + if ( QgsGrassLocationItem::isLocation( thePath ) ) + { + QgsGrassLocationItem * location = new QgsGrassLocationItem( parentItem, thePath ); + return location; + } + return 0; +} + +/** +* Class factory to return a pointer to a newly created +* QgsGrassProvider object +*/ +QGISEXTERN QgsGrassProvider * classFactory( const QString *uri ) +{ + return new QgsGrassProvider( *uri ); +} + +/** Required key function (used to map the plugin to a data store type) +*/ +QGISEXTERN QString providerKey() +{ + return QString( "grass" ); +} + +/** +* Required description function +*/ +QGISEXTERN QString description() +{ + return QString( "GRASS data provider" ); +} + +/** +* Required isProvider function. Used to determine if this shared library +* is a data provider plugin +*/ +QGISEXTERN bool isProvider() +{ + return true; +} diff --git a/src/providers/grass/qgsgrassprovidermodule.h b/src/providers/grass/qgsgrassprovidermodule.h new file mode 100644 index 00000000000..299ea4e21f5 --- /dev/null +++ b/src/providers/grass/qgsgrassprovidermodule.h @@ -0,0 +1,44 @@ +/*************************************************************************** + qgsgrassprovidermodule.h - Data provider for GRASS format + ------------------- + begin : March, 2004 + copyright : (C) 2004 by Gary E.Sherman, Radim Blazek + email : sherman@mrcc.com, blazek@itc.it + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef QGSGRASSPROVIDERMODULE_H +#define QGSGRASSPROVIDERMODULE_H + +#include "qgsdataitem.h" + +class QgsGrassLocationItem : public QgsDataCollectionItem +{ + public: + QgsGrassLocationItem( QgsDataItem* parent, QString path ); + ~QgsGrassLocationItem(); + + static bool isLocation( QString path ); + QVector createChildren(); +}; + +class QgsGrassMapsetItem : public QgsDataCollectionItem +{ + public: + QgsGrassMapsetItem( QgsDataItem* parent, QString path ); + ~QgsGrassMapsetItem(); + + static bool isMapset( QString path ); + QVector createChildren(); + + QString mLocation; + QString mGisdbase; +}; + +#endif // QGSGRASSPROVIDERMODULE_H diff --git a/src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt b/src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt index 344879cfb3d..8e91c4018cf 100644 --- a/src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt +++ b/src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt @@ -47,6 +47,10 @@ TARGET_LINK_LIBRARIES(qgissqlanyconnection qgis_core ) +IF(UNIX AND NOT ANDROID) + TARGET_LINK_LIBRARIES(qgissqlanyconnection ${CMAKE_DL_LIBS}) +ENDIF(UNIX AND NOT ANDROID) + IF (APPLE) SET_TARGET_PROPERTIES(qgissqlanyconnection PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE ) ENDIF (APPLE)