Fix proj_version on macOS

This commit is contained in:
Artem Pavlenko 2021-03-19 16:37:21 +00:00
parent 9df7afd0a3
commit 5afe22030f

View file

@ -923,20 +923,17 @@ def CheckGdalData(context, silent=False):
def proj_version(context): def proj_version(context):
context.Message('Checking for Proj version >=%s...' % PROJ_MIN_VERSION_STRING) context.Message('Checking for Proj version >=%s...' % PROJ_MIN_VERSION_STRING)
ret, out = context.TryRun(""" ret, out = context.TryRun("""
#include <proj.h> #include "proj.h"
#include <iostream> #include <stdio.h>
#define PROJ_VERSION_ATLEAST(major,minor,micro) \ #define PROJ_VERSION_ATLEAST(major,minor,micro) \
((major)*10000+(minor)*100+(micro) <= \ ((major)*10000+(minor)*100+(micro) <= \
PROJ_VERSION_MAJOR*10000+PROJ_VERSION_MINOR*100+PROJ_VERSION_PATCH) PROJ_VERSION_MAJOR*10000+PROJ_VERSION_MINOR*100+PROJ_VERSION_PATCH)
int main() int main()
{ {
std::cout << PROJ_VERSION_ATLEAST(%s, %s, %s) << ";" printf("%d;%d.%d.%d", PROJ_VERSION_ATLEAST{min-version}, PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH);
<< PROJ_VERSION_MAJOR << "."
<< PROJ_VERSION_MINOR << "."
<< PROJ_VERSION_PATCH;
return 0; return 0;
} }
""" % PROJ_MIN_VERSION,'.cpp') """.replace("{min-version}", str(PROJ_MIN_VERSION)),'.c')
if not ret: if not ret:
context.Result('error (could not get version from proj.h)') context.Result('error (could not get version from proj.h)')
else: else: