Skip to content
Permalink
Browse files

Applied Jürgens patch with improvements for MSVC build and initial at…

…tempts at GRASS under MSVC

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7322 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Nov 5, 2007
1 parent 37233b6 commit 4c3fea21b97dbf200700f566dc86e1941c78f3a7
Showing with 274 additions and 238 deletions.
  1. +17 −4 python/CMakeLists.txt
  2. +17 −4 python/configure.py.in
  3. +1 −0 src/app/composer/qgscomposition.cpp
  4. +1 −0 src/app/legend/qgslegend.cpp
  5. +1 −0 src/app/qgisapp.cpp
  6. +1 −1 src/app/qgsbookmarks.h
  7. +1 −0 src/app/qgsmaptooladdfeature.cpp
  8. +1 −0 src/app/qgsmaptoolcapture.cpp
  9. +1 −0 src/app/qgsvectorlayerproperties.cpp
  10. +19 −0 src/core/qgis.h
  11. +4 −0 src/core/qgsdistancearea.cpp
  12. +4 −3 src/core/qgslabel.cpp
  13. +1 −0 src/core/qgsmaprender.cpp
  14. +1 −0 src/core/qgsvectorlayer.cpp
  15. +2 −2 src/core/raster/qgsrasterlayer.cpp
  16. +10 −0 src/core/spatialindex/rtree/BulkLoader.cc
  17. +11 −0 src/core/spatialindex/rtree/BulkLoader.h
  18. +1 −1 src/core/spatialindex/rtree/RTree.cc
  19. +8 −0 src/core/spatialindex/tools/ExternalSort.cc
  20. +1 −1 src/core/spatialindex/tools/Tools.cc
  21. +13 −0 src/gui/qgisinterface.h
  22. +1 −1 src/helpviewer/qgshelpviewer.h
  23. +0 −6 src/plugins/copyright_label/plugin.cpp
  24. +0 −5 src/plugins/delimited_text/qgsdelimitedtextplugin.cpp
  25. +0 −6 src/plugins/georeferencer/plugin.cpp
  26. +0 −6 src/plugins/gps_importer/qgsgpsplugin.cpp
  27. +28 −18 src/plugins/grass/CMakeLists.txt
  28. +1 −0 src/plugins/grass/qgsgrassedit.cpp
  29. +1 −1 src/plugins/grass/qgsgrassmodule.cpp
  30. +7 −3 src/plugins/grass/qgsgrassnewmapset.cpp
  31. +4 −0 src/plugins/grass/qgsgrassshell.cpp
  32. +0 −7 src/plugins/grid_maker/plugin.cpp
  33. +1 −5 src/plugins/north_arrow/plugin.cpp
  34. +0 −7 src/plugins/plugin_template/plugin.cpp
  35. +0 −5 src/plugins/scale_bar/plugin.cpp
  36. +3 −3 src/plugins/spit/qgsshapefile.cpp
  37. +0 −5 src/plugins/spit/qgsspitplugin.cpp
  38. +0 −5 src/plugins/wfs/qgswfsplugin.cpp
  39. +0 −7 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  40. +2 −2 src/providers/gpx/gpsdata.h
  41. +0 −7 src/providers/gpx/qgsgpxprovider.cpp
  42. +24 −10 src/providers/grass/CMakeLists.txt
  43. +5 −6 src/providers/grass/provider.cpp
  44. +37 −27 src/providers/grass/qgsgrass.cpp
  45. +35 −35 src/providers/grass/qgsgrass.h
  46. +1 −1 src/providers/grass/qgsgrassprovider.h
  47. +0 −5 src/providers/mysql/qgsmysqlprovider.cpp
  48. +1 −6 src/providers/ogr/qgsogrfactory.cpp
  49. +0 −8 src/providers/ogr/qgsogrprovider.cpp
  50. +0 −6 src/providers/postgres/qgspostgresprovider.cpp
  51. +4 −4 src/providers/wfs/CMakeLists.txt
  52. +0 −6 src/providers/wfs/qgswfsprovider.cpp
  53. +1 −7 src/providers/wms/qgswmsprovider.cpp
  54. +2 −2 tools/mapserver_export/qgsmapserverexport.cpp
@@ -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,14 +42,20 @@ 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
# it will run SIP utility to generate sources and will prepare makefiles
# 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})
@@ -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()
@@ -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.
@@ -42,6 +42,7 @@
#include <iostream>

#include <QFont>
#include <QDomDocument>
#include <QHeaderView>
#include <QMenu>
#include <QMessageBox>
@@ -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 );
@@ -23,7 +23,7 @@
class QString;
class QWidget;
class Q3ListViewItem;
class sqlite3;
struct sqlite3;
class QgsBookmarks : public QDialog, private Ui::QgsBookmarksBase
{
Q_OBJECT
@@ -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;
@@ -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
}

@@ -500,6 +500,7 @@ QString QgsVectorLayerProperties::getMetadata()
}
catch(QgsCsException &cse)
{
UNUSED(cse);
QgsDebugMsg( cse.what() );

myMetadataQString += "<tr><td bgcolor=\"white\">";
@@ -130,5 +130,24 @@ class CORE_EXPORT QGis
* 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
@@ -282,6 +282,7 @@ double QgsDistanceArea::measureLine(const QList<QgsPoint>& 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<QgsPoint>& 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;
}
@@ -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;
}
}

@@ -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);
@@ -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__));
}

@@ -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<int>::max
#ifdef _MSC_VER
# ifdef max(x,y)
# undef max(x,y)
# ifdef max
# undef max
# endif
#endif

@@ -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);
}
}

@@ -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 */

@@ -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);
@@ -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;
}
@@ -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<bool>(bl);
v.m_val.blVal = bl!=0;
break;
default:
throw IllegalStateException(
@@ -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
@@ -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
@@ -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");

0 comments on commit 4c3fea2

Please sign in to comment.
You can’t perform that action at this time.