[Qgis-developer] Patch for compiling qgis-0.8pre2 with geos-3.0.0rc3

Tom Elwertowski telwertowski at comcast.net
Sat Dec 16 03:21:44 EST 2006


Mike Leahy wrote:
> Gary Sherman wrote:
>> Does this mean that it will also compile with GEOS 2.x?
> 
> Sorry, it is 3.x only.  With my very limited understanding of c++ 
> programming, I can only guess if it's even possible to allow compiling 
> against both 2.x and 3.x.

The following seems to be a method for compiling QGIS using either GEOS 
2 or 3.

1. Do not change any includes; retain "#include <geos.h>"

2. After the include of geos.h in qgsgeometry.h and qgsogrprovider.h, add:

#if GEOS_VERSION_MAJOR < 3
#define GEOS_GEOM geos
#define GEOS_IO geos
#define GEOS_UTIL geos
#else
#define GEOS_GEOM geos::geom
#define GEOS_IO geos::io
#define GEOS_UTIL geos::util
#endif

3. Change all "geos::" in cpp files to the appropriate "GEOS_WHATEVER::"

4. Add "#if GEOS_VERSION_MAJOR < 3" code variations for any renamed methods.

I have tried this only for the ogr directory so far. I found one renamed 
  method. It compiles for both GEOS 2 and 3.

The work now is to find the new prefix for each of the geos prefixes in 
core.

Tom



More information about the Qgis-developer mailing list