diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 8026eebbac3..72bad556d0f 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,9 +1,16 @@ - IF (WIN32) SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.pyd) SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.pyd) - SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dll) - SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dll) + IF (NOT MSVC) + SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dll) + SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dll) + ELSE (NOT MSVC) + SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/${CMAKE_CFG_INTDIR}/qgis_core.lib) + SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/${CMAKE_CFG_INTDIR}/qgis_gui.lib) + GET_FILENAME_COMPONENT(GDAL_LIB_PATH ${GDAL_LIBRARY} PATH) + GET_FILENAME_COMPONENT(GDAL_LIB_NAME ${GDAL_LIBRARY} NAME_WE) + SET(GDAL_LIB_PATHNAME ${GDAL_LIB_PATH}/${GDAL_LIB_NAME}) + ENDIF (NOT MSVC) ELSE (WIN32) SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.so) SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.so) @@ -35,6 +42,12 @@ FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip") # create file configure.py from configure.py.in CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in ${CMAKE_CURRENT_BINARY_DIR}/configure.py) + +IF (MSVC) + SET(EXPORT "__declspec(dllimport)") +ELSE (MSVC) + SET(EXPORT "") +ENDIF (MSVC) # Step 2: during make # run python configure.py @@ -42,7 +55,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in # should be run everytime core or gui library has been changed ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_MAKEFILE} ${BINDINGS_GUI_MAKEFILE} PRE_BUILD COMMAND ${PYTHON_EXECUTABLE} - ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py + ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py ${CMAKE_CFG_INTDIR} ${EXPORT} DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB} ${CMAKE_CURRENT_BINARY_DIR}/configure.py ${CORE_SIP_FILES} ${GUI_SIP_FILES}) diff --git a/python/configure.py.in b/python/configure.py.in index d0aa442c96b..4c3a660aad7 100644 --- a/python/configure.py.in +++ b/python/configure.py.in @@ -9,12 +9,23 @@ build_path = '@CMAKE_BINARY_DIR@' python_path = src_path + '/python' gdal_inc_dir = '@GDAL_INCLUDE_DIR@' geos_inc_dir = '@GEOS_INCLUDE_DIR@' +gdal_library = '@GDAL_LIB_PATHNAME@' qt_libs = ["QtCore","QtGui","QtNetwork","QtSvg","QtXml"] if sys.platform == 'darwin': qt_libs.append("Qt3Support") qt_libs.append("QtSql") +if len(sys.argv)>1: + intdir = "/" + sys.argv[1] +else: + intdir = "" + +if len(sys.argv)>2: + export = sys.argv[2] +else: + export = "" + # create paths for temporary files if don't exist if not os.path.isdir("./core"): os.mkdir("./core") @@ -99,7 +110,9 @@ makefile_gui = sipconfig.ModuleMakefile( # common settings for both core and gui libs for mk in [ makefile_core, makefile_gui ]: mk.extra_libs = ["qgis_core"] - mk.extra_lib_dirs = [build_path+"/src/core"] + if gdal_library!="": + mk.extra_libs.append(gdal_library) + mk.extra_lib_dirs = [build_path+"/src/core"+intdir] mk.extra_include_dirs = [src_path+"/src/core", src_path+"/src/core/raster", src_path+"/src/core/renderer", @@ -108,16 +121,16 @@ for mk in [ makefile_core, makefile_gui ]: build_path, # qgsconfig.h, qgssvnversion.h gdal_inc_dir, geos_inc_dir] - mk.extra_cxxflags = ["-DCORE_EXPORT="] + mk.extra_cxxflags = ["-DCORE_EXPORT="+export] # more settings for gui lib makefile_gui.extra_libs.append("qgis_gui") -makefile_gui.extra_lib_dirs.append(build_path+"/src/gui") +makefile_gui.extra_lib_dirs.append(build_path+"/src/gui"+intdir) makefile_gui.extra_include_dirs.append(src_path+"/src/gui") makefile_gui.extra_include_dirs.append(build_path+"/src/gui") makefile_gui.extra_include_dirs.append(build_path+"/src/ui") makefile_gui.extra_include_dirs.append(src_path+"/src/plugins") # because of qgisplugin.h TODO: sort out -makefile_gui.extra_cxxflags.append("-DGUI_EXPORT=") +makefile_gui.extra_cxxflags.append("-DGUI_EXPORT="+export) # Generate the Makefile itself. makefile_core.generate() diff --git a/src/app/composer/qgscomposition.cpp b/src/app/composer/qgscomposition.cpp index 16107ccd8d2..4d790cd75fa 100644 --- a/src/app/composer/qgscomposition.cpp +++ b/src/app/composer/qgscomposition.cpp @@ -600,6 +600,7 @@ void QgsComposition::paperSizeChanged ( void ) } catch (std::bad_alloc& ba) { + UNUSED(ba); // A better solution here would be to set the canvas back to the // original size and carry on, but for the moment this will // prevent a crash due to an uncaught exception. diff --git a/src/app/legend/qgslegend.cpp b/src/app/legend/qgslegend.cpp index b1669d736e2..d6b9d3ab56a 100755 --- a/src/app/legend/qgslegend.cpp +++ b/src/app/legend/qgslegend.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include #include diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 079acc9edd1..9e48f92cedf 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -3020,6 +3020,7 @@ void QgisApp::openProject(const QString & fileName) } catch ( QgsIOException & io_exception ) { + UNUSED(io_exception); QMessageBox::critical( this, tr("QGIS: Unable to load project"), tr("Unable to load project ") + fileName ); diff --git a/src/app/qgsbookmarks.h b/src/app/qgsbookmarks.h index 666a129bf3d..d126ac4abd0 100644 --- a/src/app/qgsbookmarks.h +++ b/src/app/qgsbookmarks.h @@ -23,7 +23,7 @@ class QString; class QWidget; class Q3ListViewItem; -class sqlite3; +struct sqlite3; class QgsBookmarks : public QDialog, private Ui::QgsBookmarksBase { Q_OBJECT diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp index 56bc24f21b0..8a103e105a4 100644 --- a/src/app/qgsmaptooladdfeature.cpp +++ b/src/app/qgsmaptooladdfeature.cpp @@ -112,6 +112,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent(QMouseEvent * e) } catch(QgsCsException &cse) { + UNUSED(cse); QMessageBox::information(0, QObject::tr("Coordinate transform error"), \ QObject::tr("Cannot transform the point to the layers coordinate system")); return; diff --git a/src/app/qgsmaptoolcapture.cpp b/src/app/qgsmaptoolcapture.cpp index b07c7ddc0f2..3ef155e927d 100644 --- a/src/app/qgsmaptoolcapture.cpp +++ b/src/app/qgsmaptoolcapture.cpp @@ -113,6 +113,7 @@ int QgsMapToolCapture::addVertex(const QPoint& p) } catch(QgsCsException &cse) { + UNUSED(cse); // unused return 2; //cannot reproject point to layer coordinate system } diff --git a/src/app/qgsvectorlayerproperties.cpp b/src/app/qgsvectorlayerproperties.cpp index c3d287ec170..e05ceb38c99 100644 --- a/src/app/qgsvectorlayerproperties.cpp +++ b/src/app/qgsvectorlayerproperties.cpp @@ -500,6 +500,7 @@ QString QgsVectorLayerProperties::getMetadata() } catch(QgsCsException &cse) { + UNUSED(cse); QgsDebugMsg( cse.what() ); myMetadataQString += ""; diff --git a/src/core/qgis.h b/src/core/qgis.h index 1161ac2864e..7306c4ecb86 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -130,5 +130,24 @@ public: * or user (~/.qgis.qgis.db) defined projection. */ const int USER_PROJECTION_START_ID=100000; +#ifdef WIN32 +// fake use to make unused variable warnings go away in Visual C++ +#define UNUSED(symbol) symbol +#else +# define UNUSED(symbol) +#endif + +// FIXME: also in qgisinterface.h +#ifndef QGISEXTERN +#ifdef WIN32 +# define QGISEXTERN extern "C" __declspec( dllexport ) +# ifdef _MSC_VER +// do not warn about C bindings returing QString +# pragma warning(disable:4190) +# endif +#else +# define QGISEXTERN extern "C" +#endif +#endif #endif diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 706bd25bce4..1dcf05de858 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -282,6 +282,7 @@ double QgsDistanceArea::measureLine(const QList& points) } catch (QgsCsException &cse) { + UNUSED(cse); QgsLogger::warning(QObject::tr("Caught a coordinate system exception while trying to transform a point. Unable to calculate line length.")); return 0.0; } @@ -306,6 +307,7 @@ double QgsDistanceArea::measureLine(const QgsPoint& p1, const QgsPoint& p2) } catch (QgsCsException &cse) { + UNUSED(cse); QgsLogger::warning(QObject::tr("Caught a coordinate system exception while trying to transform a point. Unable to calculate line length.")); return 0.0; } @@ -365,6 +367,7 @@ unsigned char* QgsDistanceArea::measurePolygon(unsigned char* feature, double* a } catch (QgsCsException &cse) { + UNUSED(cse); QgsLogger::warning(QObject::tr("Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area.")); } @@ -393,6 +396,7 @@ double QgsDistanceArea::measurePolygon(const QList& points) } catch (QgsCsException &cse) { + UNUSED(cse); QgsLogger::warning(QObject::tr("Caught a coordinate system exception while trying to transform a point. Unable to calculate polygon area.")); return 0.0; } diff --git a/src/core/qgslabel.cpp b/src/core/qgslabel.cpp index 7873ef312a1..cfd2e1252f7 100644 --- a/src/core/qgslabel.cpp +++ b/src/core/qgslabel.cpp @@ -352,9 +352,10 @@ void QgsLabel::renderLabel(QPainter* painter, QgsPoint point, } catch(QgsCsException &cse) { - QgsDebugMsg("Caught transform error in QgsLabel::renderLabel(). " - "Skipping rendering this label"); - return; + UNUSED(cse); // unused otherwise + QgsDebugMsg("Caught transform error in QgsLabel::renderLabel(). " + "Skipping rendering this label"); + return; } } diff --git a/src/core/qgsmaprender.cpp b/src/core/qgsmaprender.cpp index 424205f7c5b..2c11c873240 100644 --- a/src/core/qgsmaprender.cpp +++ b/src/core/qgsmaprender.cpp @@ -454,6 +454,7 @@ bool QgsMapRender::splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRec } catch (QgsCsException &cse) { + UNUSED(cse); QgsLogger::warning("Transform error caught in " + QString(__FILE__) + ", line " + QString::number(__LINE__)); extent = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX); r2 = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX); diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 5892d978d19..65ce6c238fd 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -316,6 +316,7 @@ void QgsVectorLayer::drawLabels(QPainter * p, QgsRect & viewExtent, QgsMapToPixe } catch (QgsCsException &e) { + UNUSED(e); QgsLogger::critical("Error projecting label locations, caught in " + QString(__FILE__) + ", line " +QString(__LINE__)); } diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index 9c504e8b95d..18ac3b76b6b 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -59,8 +59,8 @@ email : tim at linfiniti.com // workaround for MSVC compiler which already has defined macro max // that interferes with calling std::numeric_limits::max #ifdef _MSC_VER -# ifdef max(x,y) -# undef max(x,y) +# ifdef max +# undef max # endif #endif diff --git a/src/core/spatialindex/rtree/BulkLoader.cc b/src/core/spatialindex/rtree/BulkLoader.cc index 9f82d2a1958..7140845dea1 100644 --- a/src/core/spatialindex/rtree/BulkLoader.cc +++ b/src/core/spatialindex/rtree/BulkLoader.cc @@ -30,6 +30,14 @@ #include "BulkLoader.h" +#ifdef _MSC_VER +// tell MSVC not to complain about exception declarations +#pragma warning(disable:4290) +#define UNUSED(symbol) symbol +#else +#define UNUSED(symbol) +#endif + using namespace SpatialIndex::RTree; BulkLoadSource::BulkLoadSource( @@ -179,6 +187,7 @@ IData* BulkLoader::TmpFile::getNext() } catch (Tools::EndOfStreamException& e) { + UNUSED(e); m_pNext = 0; } catch (...) @@ -220,6 +229,7 @@ void BulkLoader::TmpFile::rewind() } catch (Tools::EndOfStreamException& e) { + UNUSED(e); } } diff --git a/src/core/spatialindex/rtree/BulkLoader.h b/src/core/spatialindex/rtree/BulkLoader.h index 6546e701ec1..e067b806418 100644 --- a/src/core/spatialindex/rtree/BulkLoader.h +++ b/src/core/spatialindex/rtree/BulkLoader.h @@ -22,6 +22,12 @@ #ifndef __spatialindex_rtree_bulk_loader_h #define __spatialindex_rtree_bulk_loader_h +#ifdef _MSC_VER +// tell MSVC not to complain about exception declarations +#pragma warning(push) +#pragma warning(disable:4290) +#endif + namespace SpatialIndex { namespace RTree @@ -108,5 +114,10 @@ namespace SpatialIndex } } +#ifdef _MSC_VER +#pragma warning(pop) +#endif + + #endif /* __spatialindex_rtree_bulk_loader_h */ diff --git a/src/core/spatialindex/rtree/RTree.cc b/src/core/spatialindex/rtree/RTree.cc index 98c73a2e46c..c6afa2a14d5 100644 --- a/src/core/spatialindex/rtree/RTree.cc +++ b/src/core/spatialindex/rtree/RTree.cc @@ -1065,7 +1065,7 @@ void SpatialIndex::RTree::RTree::loadHeader() ptr += sizeof(unsigned long); char c; memcpy(&c, ptr, sizeof(char)); - m_bTightMBRs = (bool) c; + m_bTightMBRs = c!=0; ptr += sizeof(char); memcpy(&(m_stats.m_nodes), ptr, sizeof(unsigned long)); ptr += sizeof(unsigned long); diff --git a/src/core/spatialindex/tools/ExternalSort.cc b/src/core/spatialindex/tools/ExternalSort.cc index b8896bf821b..d80af1c6b2a 100644 --- a/src/core/spatialindex/tools/ExternalSort.cc +++ b/src/core/spatialindex/tools/ExternalSort.cc @@ -26,6 +26,12 @@ #include "ExternalSort.h" +#ifdef _MSC_VER +#define UNUSED(symbol) symbol +#else +#define UNUSED(symbol) +#endif + using namespace std; Tools::ExternalSort::PQEntry::PQEntry( @@ -202,6 +208,7 @@ void Tools::ExternalSort::mergeRuns() } catch (EndOfStreamException& e) { + UNUSED(e); // if there are no more records in the file, do nothing. } @@ -222,6 +229,7 @@ void Tools::ExternalSort::mergeRuns() } catch (EndOfStreamException& e) { + UNUSED(e); // if there are no more records in the file, do nothing. delete pqe; } diff --git a/src/core/spatialindex/tools/Tools.cc b/src/core/spatialindex/tools/Tools.cc index a99d75374e7..afe409a465a 100644 --- a/src/core/spatialindex/tools/Tools.cc +++ b/src/core/spatialindex/tools/Tools.cc @@ -205,7 +205,7 @@ void Tools::PropertySet::loadFromByteArray(const byte* ptr) byte bl; memcpy(&bl, ptr, sizeof(byte)); ptr += sizeof(byte); - v.m_val.blVal = static_cast(bl); + v.m_val.blVal = bl!=0; break; default: throw IllegalStateException( diff --git a/src/gui/qgisinterface.h b/src/gui/qgisinterface.h index 3ee61ab2a31..c713ee5a89e 100644 --- a/src/gui/qgisinterface.h +++ b/src/gui/qgisinterface.h @@ -124,4 +124,17 @@ class GUI_EXPORT QgisInterface : public QObject }; +// FIXME: also in core/qgis.h +#ifndef QGISEXTERN +#ifdef WIN32 +# define QGISEXTERN extern "C" __declspec( dllexport ) +# ifdef _MSC_VER +// do not warn about C bindings returing QString +# pragma warning(disable:4190) +# endif +#else +# define QGISEXTERN extern "C" +#endif +#endif + #endif //#ifndef QGISINTERFACE_H diff --git a/src/helpviewer/qgshelpviewer.h b/src/helpviewer/qgshelpviewer.h index 884a31f5422..09a618824b5 100644 --- a/src/helpviewer/qgshelpviewer.h +++ b/src/helpviewer/qgshelpviewer.h @@ -21,7 +21,7 @@ #define QGSHELPVIEWER_H # include "ui_qgshelpviewerbase.h" class QString; -class sqlite3; +struct sqlite3; class QgsHelpViewer : public QDialog, private Ui::QgsHelpViewerBase { Q_OBJECT diff --git a/src/plugins/copyright_label/plugin.cpp b/src/plugins/copyright_label/plugin.cpp index c3ab17e1179..4896fb5df0d 100644 --- a/src/plugins/copyright_label/plugin.cpp +++ b/src/plugins/copyright_label/plugin.cpp @@ -46,12 +46,6 @@ email : tim@linfiniti.com // xpm for creating the toolbar icon #include "icon.xpm" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const char * const ident_ = "$Id$"; static const QString name_ = QObject::tr("CopyrightLabel"); diff --git a/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp b/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp index 11184d68a66..3284afc6b59 100644 --- a/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp +++ b/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp @@ -40,11 +40,6 @@ Functions: // xpm for creating the toolbar icon #include "icon.xpm" // -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif static const QString pluginVersion = QObject::tr("Version 0.2"); static const QString description_ = QObject::tr("Loads and displays delimited text files containing x,y coordinates"); diff --git a/src/plugins/georeferencer/plugin.cpp b/src/plugins/georeferencer/plugin.cpp index d555b078582..8dbe8c0f9e6 100644 --- a/src/plugins/georeferencer/plugin.cpp +++ b/src/plugins/georeferencer/plugin.cpp @@ -53,12 +53,6 @@ #include "plugingui.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const char * const sIdent = "$Id$"; static const QString sName = QObject::tr("Georeferencer"); static const QString sDescription = QObject::tr("Adding projection info to rasters"); diff --git a/src/plugins/gps_importer/qgsgpsplugin.cpp b/src/plugins/gps_importer/qgsgpsplugin.cpp index 15cf6727aa2..735eeff6e1e 100644 --- a/src/plugins/gps_importer/qgsgpsplugin.cpp +++ b/src/plugins/gps_importer/qgsgpsplugin.cpp @@ -48,12 +48,6 @@ // xpm for creating the toolbar icon #include "icon.xpm" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const char * const ident_ = "$Id$"; diff --git a/src/plugins/grass/CMakeLists.txt b/src/plugins/grass/CMakeLists.txt index 613a036f7b4..a51e1f6c235 100644 --- a/src/plugins/grass/CMakeLists.txt +++ b/src/plugins/grass/CMakeLists.txt @@ -4,14 +4,23 @@ SUBDIRS(config modules themes) ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\") ADD_DEFINITIONS(-DHAVE_OPENPTY=${HAVE_OPENPTY}) -IF (PEDANTIC) -MESSAGE("providers/grass : -Werror removed for qgsgrassplugin.cpp for now - please get rid of any compiler warnings!") -ENDIF (PEDANTIC) -# The warnings are caused by multiple definitions of NDEBUG in grass sources -# I have submitted a bug to teh grass folks in the meantime we need to -# disable treating warnings as errors for the affected files -FILE (GLOB files *.cpp) -SET_SOURCE_FILES_PROPERTIES(${files} PROPERTIES COMPILE_FLAGS -Wno-error ) +IF (NOT MSVC) + IF (PEDANTIC) + MESSAGE("providers/grass : -Werror removed for qgsgrassplugin.cpp for now - please get rid of any compiler warnings!") + ENDIF (PEDANTIC) + # The warnings are caused by multiple definitions of NDEBUG in grass sources + # I have submitted a bug to teh grass folks in the meantime we need to + # disable treating warnings as errors for the affected files + FILE (GLOB files *.cpp) + SET_SOURCE_FILES_PROPERTIES(${files} PROPERTIES COMPILE_FLAGS -Wno-error ) +ENDIF (NOT MSVC) + +IF (WIN32) + ADD_DEFINITIONS("-DGRASS_EXPORT=__declspec(dllimport)") +ELSE (WIN32) + ADD_DEFINITIONS("-DGRASS_EXPORT=") +ENDIF (WIN32) + ######################################################## # Files @@ -74,16 +83,17 @@ QT4_WRAP_CPP (GRASS_PLUGIN_MOC_SRCS ${GRASS_PLUGIN_MOC_HDRS}) ######################################################## # deal with warnings -IF (PEDANTIC) -MESSAGE("providers/grass : -Werror removed for qgsgrassplugin.cpp for now - please get rid of any compiler warnings!") -ENDIF (PEDANTIC) -# The warnings are caused by multiple definitions of NDEBUG in grass sources -# I have submitted a bug to teh grass folks in the meantime we need to -# disable treating warnings as errors for the affected files -FILE (GLOB files *.cpp) -SET_SOURCE_FILES_PROPERTIES(${files} PROPERTIES COMPILE_FLAGS -Wno-error ) -SET_SOURCE_FILES_PROPERTIES(${GRASS_PLUGIN_MOC_SRCS} PROPERTIES COMPILE_FLAGS -Wno-error ) - +IF (NOT MSVC) + IF (PEDANTIC) + MESSAGE("providers/grass : -Werror removed for qgsgrassplugin.cpp for now - please get rid of any compiler warnings!") + ENDIF (PEDANTIC) + # The warnings are caused by multiple definitions of NDEBUG in grass sources + # I have submitted a bug to teh grass folks in the meantime we need to + # disable treating warnings as errors for the affected files + FILE (GLOB files *.cpp) + SET_SOURCE_FILES_PROPERTIES(${files} PROPERTIES COMPILE_FLAGS -Wno-error ) + SET_SOURCE_FILES_PROPERTIES(${GRASS_PLUGIN_MOC_SRCS} PROPERTIES COMPILE_FLAGS -Wno-error ) +ENDIF (NOT MSVC) ######################################################## # build lib diff --git a/src/plugins/grass/qgsgrassedit.cpp b/src/plugins/grass/qgsgrassedit.cpp index 840b8b07bd9..053641cad0a 100644 --- a/src/plugins/grass/qgsgrassedit.cpp +++ b/src/plugins/grass/qgsgrassedit.cpp @@ -1149,6 +1149,7 @@ double QgsGrassEdit::threshold ( void ) } catch(QgsCsException& cse) { + UNUSED(cse); //error } } diff --git a/src/plugins/grass/qgsgrassmodule.cpp b/src/plugins/grass/qgsgrassmodule.cpp index e735b4cc0af..9baefbfa837 100644 --- a/src/plugins/grass/qgsgrassmodule.cpp +++ b/src/plugins/grass/qgsgrassmodule.cpp @@ -1185,7 +1185,7 @@ void QgsGrassModule::run() QStringList outsideRegion = mOptions->checkRegion(); if ( outsideRegion.size() > 0 ) { - QMessageBox::QMessageBox questionBox( QMessageBox::Question, "Warning", + QMessageBox questionBox( QMessageBox::Question, "Warning", "Input " + outsideRegion.join(",") + " outside current region!", QMessageBox::Ok | QMessageBox::Cancel ); QPushButton *resetButton = NULL; diff --git a/src/plugins/grass/qgsgrassnewmapset.cpp b/src/plugins/grass/qgsgrassnewmapset.cpp index 7730c696d97..de68d6dc2f2 100644 --- a/src/plugins/grass/qgsgrassnewmapset.cpp +++ b/src/plugins/grass/qgsgrassnewmapset.cpp @@ -597,7 +597,8 @@ void QgsGrassNewMapset::setRegionPage() } catch(QgsCsException &cse) { - std::cerr << "Cannot transform point" << std::endl; + UNUSED(cse); + std::cerr << "Cannot transform point" << std::endl; ok = false; break; } @@ -942,7 +943,8 @@ void QgsGrassNewMapset::setSelectedRegion() } catch(QgsCsException &cse) { - std::cerr << "Cannot transform point" << std::endl; + UNUSED(cse); + std::cerr << "Cannot transform point" << std::endl; ok = false; break; } @@ -1031,6 +1033,7 @@ void QgsGrassNewMapset::setCurrentRegion() } catch(QgsCsException &cse) { + UNUSED(cse); std::cerr << "Cannot transform point" << std::endl; ok = false; break; @@ -1176,7 +1179,8 @@ void QgsGrassNewMapset::drawRegion() } catch(QgsCsException &cse) { - std::cerr << "Cannot transform point" << std::endl; + UNUSED(cse); + std::cerr << "Cannot transform point" << std::endl; ok = false; break; } diff --git a/src/plugins/grass/qgsgrassshell.cpp b/src/plugins/grass/qgsgrassshell.cpp index 7c9363d3ed3..91c3f6d00cd 100644 --- a/src/plugins/grass/qgsgrassshell.cpp +++ b/src/plugins/grass/qgsgrassshell.cpp @@ -50,7 +50,11 @@ extern "C" { #include #include +#ifndef _MSC_VER #include +#else +#include +#endif #ifndef WIN32 #ifdef Q_OS_MACX diff --git a/src/plugins/grid_maker/plugin.cpp b/src/plugins/grid_maker/plugin.cpp index 6cf493e2b5a..a75d676f8d9 100644 --- a/src/plugins/grid_maker/plugin.cpp +++ b/src/plugins/grid_maker/plugin.cpp @@ -37,13 +37,6 @@ email : tim@linfiniti.com // xpm for creating the toolbar icon #include "icon.xpm" -// -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const char * const ident_ = "$Id$"; diff --git a/src/plugins/north_arrow/plugin.cpp b/src/plugins/north_arrow/plugin.cpp index a0bdf0806aa..7966e1193f6 100644 --- a/src/plugins/north_arrow/plugin.cpp +++ b/src/plugins/north_arrow/plugin.cpp @@ -47,11 +47,6 @@ email : tim@linfiniti.com // xpm for creating the toolbar icon #include "icon.xpm" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif #ifdef _MSC_VER #define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5)) @@ -324,6 +319,7 @@ bool QgsNorthArrowPlugin::calculateNorthDirection() } catch (QgsException &e) { + UNUSED(e); // just give up return false; } diff --git a/src/plugins/plugin_template/plugin.cpp b/src/plugins/plugin_template/plugin.cpp index 554f21e32ec..f5c280d1579 100644 --- a/src/plugins/plugin_template/plugin.cpp +++ b/src/plugins/plugin_template/plugin.cpp @@ -34,13 +34,6 @@ #include - -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const char * const sIdent = "$Id$"; static const QString sName = QObject::tr("[menuitemname]"); static const QString sDescription = QObject::tr("[plugindescription]"); diff --git a/src/plugins/scale_bar/plugin.cpp b/src/plugins/scale_bar/plugin.cpp index 903db0e461d..6d0772e5260 100644 --- a/src/plugins/scale_bar/plugin.cpp +++ b/src/plugins/scale_bar/plugin.cpp @@ -52,11 +52,6 @@ email : sbr00pwb@users.sourceforge.net // xpm for creating the toolbar icon #include "icon.xpm" // -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif #ifdef _MSC_VER #define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5)) diff --git a/src/plugins/spit/qgsshapefile.cpp b/src/plugins/spit/qgsshapefile.cpp index 09e9f99559b..b307b464cee 100644 --- a/src/plugins/spit/qgsshapefile.cpp +++ b/src/plugins/spit/qgsshapefile.cpp @@ -92,7 +92,7 @@ bool QgsShapeFile::scanGeometries() qApp->processEvents(); OGRFeature *feat; - unsigned int currentType = 0; + OGRwkbGeometryType currentType = wkbUnknown; bool multi = false; while((feat = ogrLayer->GetNextFeature())) { @@ -127,10 +127,10 @@ bool QgsShapeFile::scanGeometries() // a hack to support 2.5D geometries (their wkb is equivalent to 2D variants // except that the highest bit is set also). For now we will ignore 3rd coordinate. hasMoreDimensions = false; - if (currentType & 0x80000000) + if (currentType & wkb25DBit) { QgsDebugMsg("Got a shapefile with 2.5D geometry."); - currentType &= ~0x80000000; + currentType = wkbFlatten(currentType); hasMoreDimensions = true; } diff --git a/src/plugins/spit/qgsspitplugin.cpp b/src/plugins/spit/qgsspitplugin.cpp index 82fe106d76a..4149aa75cae 100644 --- a/src/plugins/spit/qgsspitplugin.cpp +++ b/src/plugins/spit/qgsspitplugin.cpp @@ -31,11 +31,6 @@ // xpm for creating the toolbar icon #include "spiticon.xpm" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif static const char * const ident_ = "$Id$"; diff --git a/src/plugins/wfs/qgswfsplugin.cpp b/src/plugins/wfs/qgswfsplugin.cpp index f09feae2dd3..e08a6673175 100644 --- a/src/plugins/wfs/qgswfsplugin.cpp +++ b/src/plugins/wfs/qgswfsplugin.cpp @@ -24,11 +24,6 @@ #include "mIconAddWfsLayer.xpm" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif static const QString name_ = QObject::tr("WFS plugin"); static const QString description_ = QObject::tr("Adds WFS layers to the QGIS canvas"); diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index 250ebc4d761..684a469c4e4 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -40,13 +40,6 @@ #include "qgsspatialrefsys.h" #include "qgis.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - - static const QString TEXT_PROVIDER_KEY = "delimitedtext"; static const QString TEXT_PROVIDER_DESCRIPTION = "Delimited text data provider"; diff --git a/src/providers/gpx/gpsdata.h b/src/providers/gpx/gpsdata.h index 780797a14dd..19514c3cbc2 100644 --- a/src/providers/gpx/gpsdata.h +++ b/src/providers/gpx/gpsdata.h @@ -35,8 +35,8 @@ // workaround for MSVC compiler which already has defined macro max // that interferes with calling std::numeric_limits::max #ifdef _MSC_VER -# ifdef max(x,y) -# undef max(x,y) +# ifdef max +# undef max # endif #endif diff --git a/src/providers/gpx/qgsgpxprovider.cpp b/src/providers/gpx/qgsgpxprovider.cpp index 4543bc98fc0..072e4dca3ec 100644 --- a/src/providers/gpx/qgsgpxprovider.cpp +++ b/src/providers/gpx/qgsgpxprovider.cpp @@ -43,13 +43,6 @@ #include "gpsdata.h" #include "qgslogger.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - - const char* QgsGPXProvider::attr[] = { "name", "elevation", "symbol", "number", "comment", "description", "source", "url", "url name" }; diff --git a/src/providers/grass/CMakeLists.txt b/src/providers/grass/CMakeLists.txt index 5e798859485..d9e800e5039 100644 --- a/src/providers/grass/CMakeLists.txt +++ b/src/providers/grass/CMakeLists.txt @@ -1,4 +1,3 @@ - ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\") ######################################################## @@ -8,15 +7,17 @@ SET(GRASS_PROVIDER_SRCS provider.cpp) SET(GRASS_LIB_SRCS qgsgrassprovider.cpp qgsgrass.cpp) -IF (PEDANTIC) - MESSAGE("providers/grass : -Werror removed for qgsgrassprovider.cpp for now - please get rid of any compiler warnings!") -ENDIF (PEDANTIC) -# The warnings are caused by multiple definitions of NDEBUG in grass sources -# I have submitted a bug to teh grass folks in the meantime we need to -# disable treating warnings as errors for the affected files -SET_SOURCE_FILES_PROPERTIES(qgsgrassprovider.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) -SET_SOURCE_FILES_PROPERTIES(qgsgrass.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) -SET_SOURCE_FILES_PROPERTIES(provider.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) +IF (NOT MSVC) + IF (PEDANTIC) + MESSAGE("providers/grass : -Werror removed for qgsgrassprovider.cpp for now - please get rid of any compiler warnings!") + ENDIF (PEDANTIC) + # The warnings are caused by multiple definitions of NDEBUG in grass sources + # I have submitted a bug to the grass folks in the meantime we need to + # disable treating warnings as errors for the affected files + SET_SOURCE_FILES_PROPERTIES(qgsgrassprovider.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) + SET_SOURCE_FILES_PROPERTIES(qgsgrass.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) + SET_SOURCE_FILES_PROPERTIES(provider.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) +ENDIF (NOT MSVC) ######################################################## # Build @@ -28,8 +29,15 @@ INCLUDE_DIRECTORIES ( ${PROJ_INCLUDE_DIR} ) + ADD_LIBRARY (qgisgrass SHARED ${GRASS_LIB_SRCS}) +IF (WIN32) + SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=__declspec(dllexport)" ) +ELSE (WIN32) + SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) +ENDIF (WIN32) + TARGET_LINK_LIBRARIES (qgisgrass ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} @@ -39,6 +47,12 @@ TARGET_LINK_LIBRARIES (qgisgrass ADD_LIBRARY (grassprovider MODULE ${GRASS_PROVIDER_SRCS}) +IF (WIN32) + SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=__declspec(dllimport)" ) +ELSE (WIN32) + SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) +ENDIF (WIN32) + TARGET_LINK_LIBRARIES (grassprovider ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} diff --git a/src/providers/grass/provider.cpp b/src/providers/grass/provider.cpp index 3ebfb3615b2..a83a1989671 100644 --- a/src/providers/grass/provider.cpp +++ b/src/providers/grass/provider.cpp @@ -40,26 +40,25 @@ extern "C" { * Class factory to return a pointer to a newly created * QgsGrassProvider object */ -extern "C" QgsGrassProvider * classFactory(const QString *uri) +QGISEXTERN QgsGrassProvider * classFactory(const QString *uri) { return new QgsGrassProvider(*uri); } /** Required key function (used to map the plugin to a data store type) */ -extern "C" QString providerKey(){ +QGISEXTERN QString providerKey(){ return QString("grass"); } /** * Required description function */ -extern "C" QString description(){ +QGISEXTERN QString description(){ return QString("GRASS data provider"); } /** * Required isProvider function. Used to determine if this shared library * is a data provider plugin */ -extern "C" bool isProvider(){ +QGISEXTERN bool isProvider(){ return true; -} - +} \ No newline at end of file diff --git a/src/providers/grass/qgsgrass.cpp b/src/providers/grass/qgsgrass.cpp index bcf5931d473..9351097ce2b 100644 --- a/src/providers/grass/qgsgrass.cpp +++ b/src/providers/grass/qgsgrass.cpp @@ -33,13 +33,19 @@ #include "qgsgrass.h" extern "C" { +#ifndef _MSC_VER #include +#endif #include #include #include } -void QgsGrass::init( void ) +#if defined(_MSC_VER) +#include // for GetCurrentProcessId() +#endif + +void GRASS_EXPORT QgsGrass::init( void ) { // Warning!!! // G_set_error_routine() once called from plugin @@ -370,25 +376,25 @@ int QgsGrass::error_routine ( const char *msg, int fatal) { return 1; } -void QgsGrass::resetError ( void ) { +void GRASS_EXPORT QgsGrass::resetError ( void ) { error = OK; } -int QgsGrass::getError ( void ) { +int GRASS_EXPORT QgsGrass::getError ( void ) { return error; } -QString QgsGrass::getErrorMessage ( void ) { +QString GRASS_EXPORT QgsGrass::getErrorMessage ( void ) { return error_message; } -jmp_buf& QgsGrass::fatalErrorEnv() +jmp_buf GRASS_EXPORT &QgsGrass::fatalErrorEnv() { return mFatalErrorEnv; } -QString QgsGrass::openMapset ( QString gisdbase, QString location, QString mapset ) +QString GRASS_EXPORT QgsGrass::openMapset ( QString gisdbase, QString location, QString mapset ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::openMapset" << std::endl; @@ -416,7 +422,11 @@ QString QgsGrass::openMapset ( QString gisdbase, QString location, QString mapse process->addArgument ( lock ); // lock file // TODO: getpid() probably is not portable +#ifndef _MSC_VER int pid = getpid(); +#else + int pid = GetCurrentProcessId(); +#endif #ifdef QGISDEBUG std::cerr << "pid = " << pid << std::endl; #endif @@ -594,7 +604,7 @@ QString QgsGrass::closeMapset ( ) return NULL; } -QStringList QgsGrass::locations ( QString gisbase ) +QStringList GRASS_EXPORT QgsGrass::locations ( QString gisbase ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::locations gisbase = " @@ -619,7 +629,7 @@ QStringList QgsGrass::locations ( QString gisbase ) return list; } -QStringList QgsGrass::mapsets ( QString gisbase, QString locationName ) +QStringList GRASS_EXPORT QgsGrass::mapsets ( QString gisbase, QString locationName ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::mapsets gisbase = " << gisbase.ascii() @@ -632,7 +642,7 @@ QStringList QgsGrass::mapsets ( QString gisbase, QString locationName ) return QgsGrass::mapsets ( gisbase + "/" + locationName ); } -QStringList QgsGrass::mapsets ( QString locationPath ) +QStringList GRASS_EXPORT QgsGrass::mapsets ( QString locationPath ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::mapsets locationPath = " @@ -656,7 +666,7 @@ QStringList QgsGrass::mapsets ( QString locationPath ) return list; } -QStringList QgsGrass::vectors ( QString gisbase, QString locationName, +QStringList GRASS_EXPORT QgsGrass::vectors ( QString gisbase, QString locationName, QString mapsetName) { std::cerr << "QgsGrass::vectors()" << std::endl; @@ -693,7 +703,7 @@ QStringList QgsGrass::vectors ( QString gisbase, QString locationName, return QgsGrass::vectors ( gisbase + "/" + locationName + "/" + mapsetName ); } -QStringList QgsGrass::vectors ( QString mapsetPath ) +QStringList GRASS_EXPORT QgsGrass::vectors ( QString mapsetPath ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::vectors mapsetPath = " @@ -720,7 +730,7 @@ QStringList QgsGrass::vectors ( QString mapsetPath ) return list; } -QStringList QgsGrass::rasters ( QString gisbase, QString locationName, +QStringList GRASS_EXPORT QgsGrass::rasters ( QString gisbase, QString locationName, QString mapsetName) { std::cerr << "QgsGrass::rasters()" << std::endl; @@ -758,7 +768,7 @@ QStringList QgsGrass::rasters ( QString gisbase, QString locationName, return QgsGrass::rasters ( gisbase + "/" + locationName + "/" + mapsetName ); } -QStringList QgsGrass::rasters ( QString mapsetPath ) +QStringList GRASS_EXPORT QgsGrass::rasters ( QString mapsetPath ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::rasters mapsetPath = " @@ -779,7 +789,7 @@ QStringList QgsGrass::rasters ( QString mapsetPath ) return list; } -QStringList QgsGrass::elements ( QString gisbase, QString locationName, +QStringList GRASS_EXPORT QgsGrass::elements ( QString gisbase, QString locationName, QString mapsetName, QString element) { if ( gisbase.isEmpty() || locationName.isEmpty() || mapsetName.isEmpty() ) @@ -789,7 +799,7 @@ QStringList QgsGrass::elements ( QString gisbase, QString locationName, element ); } -QStringList QgsGrass::elements ( QString mapsetPath, QString element ) +QStringList GRASS_EXPORT QgsGrass::elements ( QString mapsetPath, QString element ) { #ifdef QGISDEBUG std::cerr << "QgsGrass::elements mapsetPath = " @@ -810,7 +820,7 @@ QStringList QgsGrass::elements ( QString mapsetPath, QString element ) return list; } -QString QgsGrass::regionString( struct Cell_head *window ) +QString GRASS_EXPORT QgsGrass::regionString( struct Cell_head *window ) { QString reg; int fmt; @@ -847,7 +857,7 @@ QString QgsGrass::regionString( struct Cell_head *window ) return reg; } -bool QgsGrass::region( QString gisbase, +bool GRASS_EXPORT QgsGrass::region( QString gisbase, QString location, QString mapset, struct Cell_head *window ) { @@ -860,7 +870,7 @@ bool QgsGrass::region( QString gisbase, return true; } -bool QgsGrass::writeRegion( QString gisbase, +bool GRASS_EXPORT QgsGrass::writeRegion( QString gisbase, QString location, QString mapset, struct Cell_head *window ) { @@ -877,7 +887,7 @@ bool QgsGrass::writeRegion( QString gisbase, return true; } -void QgsGrass::copyRegionExtent( struct Cell_head *source, +void GRASS_EXPORT QgsGrass::copyRegionExtent( struct Cell_head *source, struct Cell_head *target ) { target->north = source->north; @@ -888,7 +898,7 @@ void QgsGrass::copyRegionExtent( struct Cell_head *source, target->bottom = source->bottom; } -void QgsGrass::copyRegionResolution( struct Cell_head *source, +void GRASS_EXPORT QgsGrass::copyRegionResolution( struct Cell_head *source, struct Cell_head *target ) { target->ns_res = source->ns_res; @@ -898,7 +908,7 @@ void QgsGrass::copyRegionResolution( struct Cell_head *source, target->ew_res3 = source->ew_res3; } -void QgsGrass::extendRegion( struct Cell_head *source, +void GRASS_EXPORT QgsGrass::extendRegion( struct Cell_head *source, struct Cell_head *target ) { if ( source->north > target->north ) @@ -920,7 +930,7 @@ void QgsGrass::extendRegion( struct Cell_head *source, target->bottom = source->bottom; } -bool QgsGrass::mapRegion( int type, QString gisbase, +bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase, QString location, QString mapset, QString map, struct Cell_head *window ) { @@ -1003,7 +1013,7 @@ bool QgsGrass::mapRegion( int type, QString gisbase, // http://freegis.org/cgi-bin/viewcvs.cgi/grass6/include/version.h.in.diff?r1=1.4&r2=1.5 // The following lines workaround this change -int QgsGrass::versionMajor() +int GRASS_EXPORT QgsGrass::versionMajor() { #ifdef GRASS_VERSION_MAJOR return GRASS_VERSION_MAJOR; @@ -1011,7 +1021,7 @@ int QgsGrass::versionMajor() return QString(GRASS_VERSION_MAJOR).toInt(); #endif } -int QgsGrass::versionMinor() +int GRASS_EXPORT QgsGrass::versionMinor() { #ifdef GRASS_VERSION_MINOR return GRASS_VERSION_MINOR; @@ -1019,7 +1029,7 @@ int QgsGrass::versionMinor() return QString(GRASS_VERSION_MINOR).toInt(); #endif } -int QgsGrass::versionRelease() +int GRASS_EXPORT QgsGrass::versionRelease() { #ifdef GRASS_VERSION_RELEASE #define QUOTE(x) #x @@ -1028,12 +1038,12 @@ int QgsGrass::versionRelease() return QString(GRASS_VERSION_RELEASE).toInt(); #endif } -QString QgsGrass::versionString() +QString GRASS_EXPORT QgsGrass::versionString() { return QString(GRASS_VERSION_STRING); } -bool QgsGrass::isMapset ( QString path ) +bool GRASS_EXPORT QgsGrass::isMapset ( QString path ) { /* TODO: G_is_mapset() was added to GRASS 6.1 06-05-24, enable its use after some period (others do update) */ diff --git a/src/providers/grass/qgsgrass.h b/src/providers/grass/qgsgrass.h index a08549cfda5..d84ff684e5b 100644 --- a/src/providers/grass/qgsgrass.h +++ b/src/providers/grass/qgsgrass.h @@ -35,23 +35,23 @@ public: * Active mode means that GISRC is set up and GISRC file is available, * in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions. * Passive mode means, that GISRC is not available. */ - static bool activeMode ( void ); + static GRASS_EXPORT bool activeMode ( void ); //! Get default GISDBASE, returns GISDBASE name or empty string if not in active mode - static QString getDefaultGisdbase ( void ); + static GRASS_EXPORT QString getDefaultGisdbase ( void ); //! Get default LOCATION_NAME, returns LOCATION_NAME name or empty string if not in active mode - static QString getDefaultLocation ( void ); + static GRASS_EXPORT QString getDefaultLocation ( void ); //! Get default MAPSET, returns MAPSET name or empty string if not in active mode - static QString getDefaultMapset ( void ); + static GRASS_EXPORT QString getDefaultMapset ( void ); //! Init or reset GRASS library /*! \param gisdbase full path to GRASS GISDBASE. \param location location name (not path!). */ - static void setLocation( QString gisdbase, QString location); + static GRASS_EXPORT void setLocation( QString gisdbase, QString location); /*! \param gisdbase full path to GRASS GISDBASE. @@ -59,7 +59,7 @@ public: \param mapset current mupset. Note that some variables depend on mapset and may influence behaviour of some functions (e.g. search path etc.) */ - static void setMapset( QString gisdbase, QString location, QString mapset); + static GRASS_EXPORT void setMapset( QString gisdbase, QString location, QString mapset); //! Error codes returned by GetError() enum GERROR { OK, /*!< OK. No error. */ @@ -71,90 +71,90 @@ public: enum MapType { Raster, Vector, Region }; //! Reset error code (to OK). Call this before a piece of code where an error is expected - static void resetError ( void ); // reset error status + static GRASS_EXPORT void resetError ( void ); // reset error status //! Check if any error occured in lately called functions. Returns value from ERROR. - static int getError ( void ); + static GRASS_EXPORT int getError ( void ); //! Get last error message - static QString getErrorMessage ( void ); + static GRASS_EXPORT QString getErrorMessage ( void ); /** \brief Open existing GRASS mapset * \return NULL string or error message */ - static QString openMapset ( QString gisdbase, + static GRASS_EXPORT QString openMapset ( QString gisdbase, QString location, QString mapset ); /** \brief Close mapset if it was opened from QGIS. * Delete GISRC, lock and temporary directory * \return NULL string or error message */ - static QString closeMapset (); + static GRASS_EXPORT QString closeMapset (); //! Check if given directory contains a GRASS installation - static bool isValidGrassBaseDir(QString const gisBase); + static GRASS_EXPORT bool isValidGrassBaseDir(QString const gisBase); //! Returns list of locations in given gisbase - static QStringList locations(QString gisbase); + static QStringList GRASS_EXPORT locations(QString gisbase); //! Returns list of mapsets in location - static QStringList mapsets(QString gisbase, QString locationName); - static QStringList mapsets(QString locationPath); + static GRASS_EXPORT QStringList mapsets(QString gisbase, QString locationName); + static GRASS_EXPORT QStringList mapsets(QString locationPath); //! List of vectors and rasters - static QStringList vectors(QString gisbase, QString locationName, + static GRASS_EXPORT QStringList vectors(QString gisbase, QString locationName, QString mapsetName); - static QStringList vectors(QString mapsetPath); + static GRASS_EXPORT QStringList vectors(QString mapsetPath); - static QStringList rasters(QString gisbase, QString locationName, + static GRASS_EXPORT QStringList rasters(QString gisbase, QString locationName, QString mapsetName); - static QStringList rasters(QString mapsetPath); + static GRASS_EXPORT QStringList rasters(QString mapsetPath); //! List of elements - static QStringList elements(QString gisbase, QString locationName, + static GRASS_EXPORT QStringList elements(QString gisbase, QString locationName, QString mapsetName, QString element); - static QStringList elements(QString mapsetPath, QString element); + static GRASS_EXPORT QStringList elements(QString mapsetPath, QString element); // ! Get map region - static bool mapRegion( int type, QString gisbase, + static GRASS_EXPORT bool mapRegion( int type, QString gisbase, QString location, QString mapset, QString map, struct Cell_head *window ); // ! String representation of region - static QString regionString( struct Cell_head *window ); + static GRASS_EXPORT QString regionString( struct Cell_head *window ); // ! Read current mapset region - static bool region( QString gisbase, QString location, QString mapset, + static GRASS_EXPORT bool region( QString gisbase, QString location, QString mapset, struct Cell_head *window ); // ! Write current mapset region - static bool writeRegion( QString gisbase, QString location, QString mapset, + static GRASS_EXPORT bool writeRegion( QString gisbase, QString location, QString mapset, struct Cell_head *window ); // ! Set (copy) region extent, resolution is not changed - static void copyRegionExtent( struct Cell_head *source, + static GRASS_EXPORT void copyRegionExtent( struct Cell_head *source, struct Cell_head *target ); // ! Set (copy) region resolution, extent is not changed - static void copyRegionResolution( struct Cell_head *source, + static GRASS_EXPORT void copyRegionResolution( struct Cell_head *source, struct Cell_head *target ); // ! Extend region in target to source - static void extendRegion( struct Cell_head *source, + static GRASS_EXPORT void extendRegion( struct Cell_head *source, struct Cell_head *target ); - static void init (void); + static GRASS_EXPORT void init (void); // ! test if the directory is mapset - static bool isMapset ( QString path ); + static GRASS_EXPORT bool isMapset ( QString path ); //! Library version - static int versionMajor(); - static int versionMinor(); - static int versionRelease(); - static QString versionString(); + static GRASS_EXPORT int versionMajor(); + static GRASS_EXPORT int versionMinor(); + static GRASS_EXPORT int versionRelease(); + static GRASS_EXPORT QString versionString(); - static jmp_buf& fatalErrorEnv(); + static GRASS_EXPORT jmp_buf& fatalErrorEnv(); private: diff --git a/src/providers/grass/qgsgrassprovider.h b/src/providers/grass/qgsgrassprovider.h index 31c8023920b..352b1b053b0 100644 --- a/src/providers/grass/qgsgrassprovider.h +++ b/src/providers/grass/qgsgrassprovider.h @@ -108,7 +108,7 @@ struct GMAP \class QgsGrassProvider \brief Data provider for GRASS vectors */ -class QgsGrassProvider : public QgsVectorDataProvider +class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider { public: diff --git a/src/providers/mysql/qgsmysqlprovider.cpp b/src/providers/mysql/qgsmysqlprovider.cpp index f971c8ad5d6..7c1703f3eaf 100644 --- a/src/providers/mysql/qgsmysqlprovider.cpp +++ b/src/providers/mysql/qgsmysqlprovider.cpp @@ -39,11 +39,6 @@ #include "../../src/qgsfield.h" #include "../../src/qgsrect.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif static const QString TEXT_PROVIDER_KEY = "mysql"; diff --git a/src/providers/ogr/qgsogrfactory.cpp b/src/providers/ogr/qgsogrfactory.cpp index 6e8f1717706..760848dd47e 100644 --- a/src/providers/ogr/qgsogrfactory.cpp +++ b/src/providers/ogr/qgsogrfactory.cpp @@ -16,14 +16,9 @@ #include #include +#include "qgis.h" #include "qgsogrfactory.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - QgsOGRFactory::QgsOGRFactory() { } diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index 8d7f76791aa..394e0798c6e 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -53,14 +53,6 @@ email : sherman at mrcc.com #include "qgsgeometry.h" #include "qgslogger.h" #include "qgsspatialrefsys.h" -#include "qgis.h" - - -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif static const QString TEXT_PROVIDER_KEY = "ogr"; static const QString TEXT_PROVIDER_DESCRIPTION = diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index 6d5cfaffa87..db4a91a659c 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -55,12 +55,6 @@ #include "qgspostgisbox3d.h" #include "qgslogger.h" -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - const QString POSTGRES_KEY = "postgres"; const QString POSTGRES_DESCRIPTION = "PostgreSQL/PostGIS data provider"; diff --git a/src/providers/wfs/CMakeLists.txt b/src/providers/wfs/CMakeLists.txt index 826f40fdbbf..815add9a206 100644 --- a/src/providers/wfs/CMakeLists.txt +++ b/src/providers/wfs/CMakeLists.txt @@ -8,12 +8,12 @@ SET (WFS_MOC_HDRS qgswfsdata.h ) -IF (PEDANTIC) - MESSAGE("providers/wfs : -Werror removed for qgswfsprovider.cpp for now - please get rid of any compiler warnings!") -ENDIF (PEDANTIC) IF(NOT MSVC) + IF (PEDANTIC) + MESSAGE("providers/wfs : -Werror removed for qgswfsprovider.cpp for now - please get rid of any compiler warnings!") + ENDIF (PEDANTIC) SET_SOURCE_FILES_PROPERTIES(qgswfsprovider.cpp PROPERTIES COMPILE_FLAGS -Wno-error ) -ENDIF(NOT MSVC) +ENDIF (NOT MSVC) ######################################################## # Build diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index ad1ba13b2e6..063e4a4cc21 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -29,12 +29,6 @@ #include #include -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - static const QString TEXT_PROVIDER_KEY = "WFS"; static const QString TEXT_PROVIDER_DESCRIPTION = "WFS data provider"; diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index fe2a17aea86..6f4e3510c0e 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -44,13 +44,6 @@ #include #endif -#ifdef WIN32 -#define QGISEXTERN extern "C" __declspec( dllexport ) -#else -#define QGISEXTERN extern "C" -#endif - - static QString WMS_KEY = "wms"; static QString WMS_DESCRIPTION = "OGC Web Map Service version 1.3 data provider"; @@ -1938,6 +1931,7 @@ bool QgsWmsProvider::calculateExtent() } catch(QgsCsException &cse) { + UNUSED(cse); continue; //ignore extents of layers which cannot be transformed info the required CRS } diff --git a/tools/mapserver_export/qgsmapserverexport.cpp b/tools/mapserver_export/qgsmapserverexport.cpp index 3ba5560eb02..e4569f62bae 100644 --- a/tools/mapserver_export/qgsmapserverexport.cpp +++ b/tools/mapserver_export/qgsmapserverexport.cpp @@ -43,7 +43,7 @@ QgsMapserverExport::QgsMapserverExport(QWidget * parent, Qt::WFlags fl) txtQgisFilePath->setSuffixFilter("qgs"); // initialize python initPy(); - qDebug("Reading setttings"); + qDebug("Reading settings"); QSettings mySettings; txtMapFilePath->setText(mySettings.value("mapserverExport/lastMapFile","").toString()); txtQgisFilePath->setText(mySettings.value("mapserverExport/lastQgsFile","").toString()); @@ -104,7 +104,7 @@ void QgsMapserverExport::on_chkExpLayersOnly_clicked(bool isChecked) void QgsMapserverExport::apply() { - qDebug("Writing setttings"); + qDebug("Writing settings"); QSettings mySettings; mySettings.setValue("mapserverExport/lastMapFile",txtMapFilePath->text()); mySettings.setValue("mapserverExport/lastQgsFile",txtQgisFilePath->text());