Skip to content

Commit

Permalink
Add support for building against GEOS development versions
Browse files Browse the repository at this point in the history
In these cases the GEOS_VERSION_PATCH ends with a non-numeric
element, like "2dev". This patch extract an integer from it.
  • Loading branch information
strk committed Apr 14, 2021
1 parent 436e642 commit 100d2d1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/qgis.cpp
Expand Up @@ -33,6 +33,9 @@
#include <geos_c.h>
#include <ogr_api.h>

#define xstr(x) str(x)
#define str(x) #x

// Version constants
//

Expand Down Expand Up @@ -306,7 +309,12 @@ QString Qgis::geosVersion()

int Qgis::geosVersionInt()
{
return QStringLiteral( "%1%2%3" ).arg( GEOS_VERSION_MAJOR, 2, 10, QChar( '0' ) ).arg( GEOS_VERSION_MINOR, 2, 10, QChar( '0' ) ).arg( GEOS_VERSION_PATCH, 2, 10, QChar( '0' ) ).toInt();
static const int version = QStringLiteral( "%1%2%3" )
.arg( GEOS_VERSION_MAJOR, 2, 10, QChar( '0' ) )
.arg( GEOS_VERSION_MINOR, 2, 10, QChar( '0' ) )
.arg( geosVersionPatch(), 2, 10, QChar( '0' ) ).toInt()
;
return version;
}

int Qgis::geosVersionMajor()
Expand All @@ -321,7 +329,8 @@ int Qgis::geosVersionMinor()

int Qgis::geosVersionPatch()
{
return GEOS_VERSION_PATCH;
static const int version = atoi( xstr( GEOS_VERSION_PATCH ) );
return version;
}

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Expand Down

0 comments on commit 100d2d1

Please sign in to comment.