From 861ae257f4f640dacc71528079ab6d56c8d39e80 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 17 Mar 2021 13:47:38 +0100 Subject: proj.h: add PROJ_COMPUTE_VERSION, PROJ_VERSION_NUMBER, PROJ_AT_LEAST_VERSION macros Makes it easier for users to test if they build against a PROJ version later than a given x.y.z version. --- src/proj.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/proj.h b/src/proj.h index 4b417dc4..f609f9f8 100644 --- a/src/proj.h +++ b/src/proj.h @@ -174,6 +174,18 @@ extern "C" { #define PROJ_VERSION_MINOR 0 #define PROJ_VERSION_PATCH 0 +/* Note: the following 3 defines have been introduced in PROJ 8.0.1 */ +/* Macro to compute a PROJ version number from its components */ +#define PROJ_COMPUTE_VERSION(maj,min,patch) ((maj)*10000+(min)*100+(patch)) + +/* Current PROJ version from the above version numbers */ +#define PROJ_VERSION_NUMBER \ + PROJ_COMPUTE_VERSION(PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH) + +/* Macro that returns true if the current PROJ version is at least the version specified by (maj,min,patch) */ +#define PROJ_AT_LEAST_VERSION(maj,min,patch) \ + (PROJ_VERSION_NUMBER >= PROJ_COMPUTE_VERSION(maj,min,patch)) + extern char const PROJ_DLL pj_release[]; /* global release id string */ /* first forward declare everything needed */ -- cgit v1.2.3