Skip to content

Commit c7dba65

Browse files

File tree

18 files changed

+168
-11
lines changed

18 files changed

+168
-11
lines changed
 

‎CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ IF (WIN32)
145145
SET (QGIS_PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/plugins)
146146
SET (QGIS_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
147147
SET (QGIS_SOURCE_DIR ${CMAKE_SOURCE_DIR})
148+
IF(MSVC)
149+
# Turn on defines for non standard maths stuff
150+
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
151+
152+
# Some file access stuff not defined in native win32
153+
# environment
154+
ADD_DEFINITIONS(-DF_OK=0)
155+
ADD_DEFINITIONS(-DX_OK=1)
156+
ADD_DEFINITIONS(-DW_OK=2)
157+
ADD_DEFINITIONS(-DR_OK=4)
158+
ENDIF(MSVC)
148159

149160
ELSE (WIN32)
150161

‎cmake_templates/svnscript.cmake.in_cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ FIND_PROGRAM(SVNVERSION svnversion)
77

88
# Read the version if installed, else set to "unknown"
99
IF (SVNVERSION)
10-
EXEC_PROGRAM(${SVNVERSION} ARGS @CMAKE_CURRENT_SOURCE_DIR@ OUTPUT_VARIABLE MYVERSION)
10+
EXEC_PROGRAM(${SVNVERSION} ARGS "@CMAKE_CURRENT_SOURCE_DIR@" OUTPUT_VARIABLE MYVERSION)
1111
ELSE (SVNVERSION)
1212
SET(MYVERSION unknown)
1313
ENDIF (SVNVERSION)
1414

1515
# Configure the qgssvnversion.h
16-
CONFIGURE_FILE(@CMAKE_CURRENT_SOURCE_DIR@/cmake_templates/qgssvnversion.h.in_cmake
17-
@CMAKE_CURRENT_BINARY_DIR@/qgssvnversion.h)
16+
CONFIGURE_FILE("@CMAKE_CURRENT_SOURCE_DIR@/cmake_templates/qgssvnversion.h.in_cmake"
17+
"@CMAKE_CURRENT_BINARY_DIR@/qgssvnversion.h")

‎src/app/composer/qgscomposermap.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#include <QPainter>
3131
#include <iostream>
3232
#include <cmath>
33+
// round isn't defined by default in msvc
34+
#ifdef _MSC_VER
35+
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
36+
#endif
3337

3438
QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id, int x, int y, int width, int height )
3539
: QWidget(), QGraphicsRectItem(0,0,width,height,0)

‎src/app/legend/qgslegend.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ class QTreeWidgetItem;
8383
class QgsLegend : public QTreeWidget
8484
{
8585
Q_OBJECT;
86-
86+
private:
87+
// Moved here to match access of declaration later in file.
88+
// Previous location raised a warning in msvc as the forward
89+
// declaration was public while the definition was private
90+
class QgsLegendPixmaps;
91+
92+
8793
public:
8894
/*! Constructor.
8995
* @param qgis_app link to qgisapp
@@ -169,7 +175,6 @@ class QgsLegend : public QTreeWidget
169175
/**Sets the toggle editing action. Usually called from QgisApp*/
170176
void setToggleEditingAction(QAction* editingAction){mToggleEditingAction = editingAction;}
171177

172-
class QgsLegendPixmaps;
173178
/**Returns structure with legend pixmaps*/
174179
QgsLegendPixmaps& pixmaps() { return mPixmaps; }
175180

‎src/app/main.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
#include <fcntl.h> /* _O_BINARY */
4545
#undef _fmode
4646
int _fmode = _O_BINARY;
47+
#ifndef _MSC_VER
48+
// Only do this if we are not building on windows with msvc.
49+
// Recommended method for doing this with msvc is with a call to _set_fmode
50+
// which is the first thing we do in main().
51+
#undef _fmode
52+
int _fmode = _O_BINARY;
53+
#endif//_MSC_VER
4754
#else
4855
#include <getopt.h>
4956
#endif
@@ -216,6 +223,9 @@ void myMessageOutput( QtMsgType type, const char *msg )
216223

217224
int main(int argc, char *argv[])
218225
{
226+
#ifdef _MSC_VER
227+
_set_fmode(_O_BINARY);
228+
#endif
219229

220230
// Set up the custom qWarning/qDebug custom handler
221231
qInstallMsgHandler( myMessageOutput );

‎src/core/qgsapplication.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ class CORE_EXPORT QgsApplication: public QApplication
114114
*/
115115
static QString reportStyleSheet();
116116
private:
117-
CORE_EXPORT static QString mPrefixPath;
118-
CORE_EXPORT static QString mPluginPath;
119-
CORE_EXPORT static QString mPkgDataPath;
120-
CORE_EXPORT static QString mThemePath;
117+
static QString mPrefixPath;
118+
static QString mPluginPath;
119+
static QString mPkgDataPath;
120+
static QString mThemePath;
121121
};
122122

123123
#endif

‎src/core/spatialindex/geometry/LineSegment.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ bool Tools::Geometry::LineSegment::touchesShape(const IShape& s) const
170170

171171
void Tools::Geometry::LineSegment::getCenter(Point& out) const
172172
{
173+
#ifdef _MSC_VER
174+
// MSVC doesn't like non-const array initialisers
175+
double* coords = new double[m_dimension];
176+
#else
173177
double coords[m_dimension];
178+
#endif//_MSC_VER
174179

175180
for (unsigned long cDim = 0; cDim < m_dimension; cDim++)
176181
{
@@ -180,6 +185,10 @@ void Tools::Geometry::LineSegment::getCenter(Point& out) const
180185
}
181186

182187
out = Point(coords, m_dimension);
188+
189+
#ifdef _MSC_VER
190+
delete[] coords;
191+
#endif//_MSC_VER
183192
}
184193

185194
unsigned long Tools::Geometry::LineSegment::getDimension() const
@@ -189,8 +198,14 @@ unsigned long Tools::Geometry::LineSegment::getDimension() const
189198

190199
void Tools::Geometry::LineSegment::getMBR(Region& out) const
191200
{
201+
#ifdef _MSC_VER
202+
// MSVC doesn't like non-const array initialisers
203+
double* low = new double[m_dimension];
204+
double* high = new double[m_dimension];
205+
#else
192206
double low[m_dimension];
193207
double high[m_dimension];
208+
#endif//_MSC_VER
194209

195210
for (unsigned long cDim = 0; cDim < m_dimension; cDim++)
196211
{
@@ -199,6 +214,11 @@ void Tools::Geometry::LineSegment::getMBR(Region& out) const
199214
}
200215

201216
out = Region(low, high, m_dimension);
217+
218+
#ifdef _MSC_VER
219+
delete[] low;
220+
delete[] high;
221+
#endif//_MSC_VER
202222
}
203223

204224
double Tools::Geometry::LineSegment::getArea() const

‎src/core/spatialindex/include/RTree.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ namespace SpatialIndex
7070
unsigned long m_dataLength;
7171
}; // Data
7272

73+
#ifdef _MSC_VER
74+
// MSVC didn't like the difference in parameter names between declaration
75+
// definition
76+
extern ISpatialIndex* returnRTree(IStorageManager& sm, Tools::PropertySet& ps);
77+
#else
7378
extern ISpatialIndex* returnRTree(IStorageManager& in, Tools::PropertySet& in);
79+
#endif//_MSC_VER
7480
extern ISpatialIndex* createNewRTree(
7581
IStorageManager& sm,
7682
double fillFactor,

‎src/core/spatialindex/include/SpatialIndex.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,13 @@ namespace SpatialIndex
183183
extern IStorageManager* createNewDiskStorageManager(std::string& baseName, unsigned long pageSize);
184184
extern IStorageManager* loadDiskStorageManager(std::string& baseName);
185185

186+
#ifdef _MSC_VER
187+
// MSVC didn't like the difference in parameter names between declaration
188+
// definition
189+
extern IBuffer* returnRandomEvictionsBuffer(IStorageManager& sm, Tools::PropertySet& ps);
190+
#else
186191
extern IBuffer* returnRandomEvictionsBuffer(IStorageManager& in, Tools::PropertySet& in);
192+
#endif//_MSC_VER
187193
extern IBuffer* createNewRandomEvictionsBuffer(IStorageManager& in, unsigned int capacity, bool bWriteThrough);
188194
}
189195

‎src/core/spatialindex/include/Tools.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#ifndef __tools_h
2323
#define __tools_h
2424

25+
#ifdef _MSC_VER
26+
#include <locale>
27+
#include <limits>
28+
#endif//_MSC_VER
2529
#include <stdint.h>
2630
#include <assert.h>
2731
#include <iostream>
@@ -402,10 +406,19 @@ namespace Tools
402406
private:
403407
std::map<std::string, Variant> m_propertySet;
404408

409+
#ifdef _MSC_VER
410+
// MSVC's friend function syntax differs slightly from everyone elses:
411+
// don't seem to need to qualify function name.
412+
friend std::ostream& operator<<(
413+
std::ostream& os,
414+
const Tools::PropertySet& p
415+
);
416+
#else
405417
friend std::ostream& Tools::operator<<(
406418
std::ostream& os,
407419
const Tools::PropertySet& p
408420
);
421+
#endif//_MSC_VER
409422
}; // PropertySet
410423

411424
std::ostream& operator<<(std::ostream& os, const Tools::PropertySet& p);
@@ -606,10 +619,19 @@ namespace Tools
606619
unsigned long long* m_a;
607620
unsigned long m_k;
608621

622+
#ifdef _MSC_VER
623+
// MSVC's friend function syntax differs slightly from everyone elses
624+
// don't seem to need to qualify function name.
625+
friend std::ostream& operator<<(
626+
std::ostream& os,
627+
const Tools::UniversalHash& h
628+
);
629+
#else
609630
friend std::ostream& Tools::operator<<(
610631
std::ostream& os,
611632
const Tools::UniversalHash& h
612633
);
634+
#endif//_MSC_VER
613635
}; // UniversalHash
614636

615637
std::ostream& operator<<(std::ostream& os, const Tools::UniversalHash& h);

‎src/core/spatialindex/rtree/BulkLoader.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,12 @@ void BulkLoader::TmpFile::rewind()
224224
}
225225

226226
void BulkLoader::bulkLoadUsingSTR(
227+
#ifdef _MSC_VER
228+
// MSVC seems to find RTree* pTree ambiguous
229+
SpatialIndex::RTree::RTree* pTree,
230+
#else
227231
RTree* pTree,
232+
#endif//_MSC_VER
228233
IDataStream& stream,
229234
unsigned long bindex,
230235
unsigned long bleaf,
@@ -277,7 +282,12 @@ void BulkLoader::bulkLoadUsingSTR(
277282
}
278283

279284
void BulkLoader::createLevel(
285+
#ifdef _MSC_VER
286+
// MSVC seems to find RTree* pTree ambiguous
287+
SpatialIndex::RTree::RTree* pTree,
288+
#else
280289
RTree* pTree,
290+
#endif//_MSC_VER
281291
Tools::IObjectStream& stream,
282292
unsigned long dimension,
283293
unsigned long k,
@@ -340,7 +350,12 @@ void BulkLoader::createLevel(
340350
}
341351
}
342352

353+
#ifdef _MSC_VER
354+
// MSVC seems to find RTree* pTree ambiguous
355+
Node* BulkLoader::createNode(SpatialIndex::RTree::RTree* pTree, std::vector<Tools::SmartPointer<IData> >& e, unsigned long level)
356+
#else
343357
Node* BulkLoader::createNode(RTree* pTree, std::vector<Tools::SmartPointer<IData> >& e, unsigned long level)
358+
#endif//_MSC_VER
344359
{
345360
Node* n;
346361

‎src/core/spatialindex/rtree/Index.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ Index::~Index()
3535
{
3636
}
3737

38+
#ifdef _MSC_VER
39+
// MSVC seems to find RTree* pTree ambiguous
40+
Index::Index(SpatialIndex::RTree::RTree* pTree, long id, unsigned long level) : Node(pTree, id, level, pTree->m_indexCapacity)
41+
#else
3842
Index::Index(RTree* pTree, long id, unsigned long level) : Node(pTree, id, level, pTree->m_indexCapacity)
43+
#endif//_MSC_VER
3944
{
4045
}
4146

‎src/core/spatialindex/rtree/Leaf.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ Leaf::~Leaf()
3535
{
3636
}
3737

38+
#ifdef _MSC_VER
39+
// MSVC seems to find RTree* pTree ambiguous
40+
Leaf::Leaf(SpatialIndex::RTree::RTree* pTree, long id): Node(pTree, id, 0, pTree->m_leafCapacity)
41+
#else
3842
Leaf::Leaf(RTree* pTree, long id): Node(pTree, id, 0, pTree->m_leafCapacity)
43+
#endif//_MSC_VER
3944
{
4045
}
4146

‎src/core/spatialindex/rtree/Node.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ Node::Node() :
217217
{
218218
}
219219

220-
Node::Node(RTree* pTree, long id, unsigned long level, unsigned long capacity) :
220+
#ifdef _MSC_VER
221+
// MSVC seems to find RTree* pTree ambiguous
222+
Node::Node(SpatialIndex::RTree::RTree* pTree, long id, unsigned long level, unsigned long capacity) :
223+
#else
224+
Node::Node(RTree* pTree, long id, unsigned long level, unsigned long capacity) :
225+
#endif//_MSC_VER
221226
m_pTree(pTree),
222227
m_level(level),
223228
m_identifier(id),

‎src/core/spatialindex/storagemanager/DiskStorageManager.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
#ifdef WIN32
3131
#include <io.h>
32+
#ifdef _MSC_VER
33+
#include <basetsd.h>
34+
#endif//_MSC_VER
3235
#define fsync(fd) _commit(fd)
3336
#endif
3437

@@ -39,6 +42,10 @@ using namespace SpatialIndex::StorageManager;
3942
using std::map;
4043
using std::vector;
4144

45+
#ifdef _MSC_VER
46+
typedef SSIZE_T ssize_t;
47+
#endif//_MSC_VER
48+
4249
SpatialIndex::IStorageManager* SpatialIndex::StorageManager::returnDiskStorageManager(Tools::PropertySet& ps)
4350
{
4451
IStorageManager* sm = new DiskStorageManager(ps);

‎src/core/spatialindex/tools/Tools.cc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,13 @@ void Tools::uncompressRLE(
579579
if (lin == 0) { *out = 0; lout = 0; return; }
580580

581581
byte *data = 0, *pdata = 0, *pin;
582+
#ifdef _MSC_VER
583+
// MSVC doesn't like non-const array initialisers
584+
byte* cv = new byte[blockSize];
585+
byte* pv = new byte[blockSize];
586+
#else
582587
byte cv[blockSize], pv[blockSize];
588+
#endif//_MSC_VER
583589
byte rl;
584590
unsigned long bufferLength = 2 * lin;
585591

@@ -610,6 +616,10 @@ void Tools::uncompressRLE(
610616
catch(...)
611617
{
612618
delete[] data;
619+
#ifdef _MSC_VER
620+
delete[] cv;
621+
delete[] pv;
622+
#endif//_MSC_VER
613623
throw;
614624
}
615625

@@ -644,6 +654,10 @@ void Tools::uncompressRLE(
644654
catch(...)
645655
{
646656
delete[] data;
657+
#ifdef _MSC_VER
658+
delete[] cv;
659+
delete[] pv;
660+
#endif//_MSC_VER
647661
throw;
648662
}
649663

@@ -677,11 +691,19 @@ void Tools::uncompressRLE(
677691
catch(...)
678692
{
679693
delete[] data;
694+
#ifdef _MSC_VER
695+
delete[] cv;
696+
delete[] pv;
697+
#endif//_MSC_VER
680698
throw;
681699
}
682700

683701
memcpy(*out, data, lout);
684702
delete[] data;
703+
#ifdef _MSC_VER
704+
delete[] cv;
705+
delete[] pv;
706+
#endif//_MSC_VER
685707
}
686708

687709
#if HAVE_GETTIMEOFDAY
@@ -979,12 +1001,24 @@ std::string Tools::trim(const std::string& source, const std::string& t)
9791001

9801002
char Tools::toLower(char c)
9811003
{
1004+
#ifdef _MSC_VER
1005+
// MSVC doesn't seem to have std::tolower(char)
1006+
std::locale loc;
1007+
return std::tolower(c, loc);
1008+
#else
9821009
return std::tolower(c);
1010+
#endif//_MSC_VER
9831011
}
9841012

9851013
char Tools::toUpper(char c)
9861014
{
1015+
#ifdef _MSC_VER
1016+
// MSVC doesn't seem to have std::toupper(char)
1017+
std::locale loc;
1018+
return std::toupper(c, loc);
1019+
#else
9871020
return std::toupper(c);
1021+
#endif//_MSC_VER
9881022
}
9891023

9901024
std::string Tools::toUpperCase(const std::string& s)

‎src/mac/Contents/Resources/qgis.icns

20.9 KB
Binary file not shown.

‎src/providers/wfs/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ SET (WFS_MOC_HDRS
1111
IF (PEDANTIC)
1212
MESSAGE("providers/wfs : -Werror removed for qgswfsprovider.cpp for now - please get rid of any compiler warnings!")
1313
ENDIF (PEDANTIC)
14-
SET_SOURCE_FILES_PROPERTIES(qgswfsprovider.cpp PROPERTIES COMPILE_FLAGS -Wno-error )
14+
IF(NOT MSVC)
15+
SET_SOURCE_FILES_PROPERTIES(qgswfsprovider.cpp PROPERTIES COMPILE_FLAGS -Wno-error )
16+
ENDIF(NOT MSVC)
1517
########################################################
1618
# Build
1719

0 commit comments

Comments
 (0)
Please sign in to comment.