[gdal] Fix build for non-Windows targets (#17698)

* Remove obsolete GDAL_VERSION_LIB

* Build mingw with configure/make

* Rearrange CONF_OPTS, expose tiff dependency

* Revise linkage configuration

* Rearrange GDAL_PATCHES

* Put optional drivers into non-default feature

* Fix gdal build

* Update vcpkg.json

* Re-enable netcdf support

* Revise cmake wrapper

* Final portfile cleanup

* Remove curl osx system dependencies

* Verify configuration results before building

* Update and revise configure.ac patch

* Fix dllexport for mingw-dynamic

* Fix pc file

* Add dependencies to cmake wrapper

* Increment port-version

* x-add-version

* Fix typo

* Update git-tree

* strega-nil CRs

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
Kai Pastor 2021-07-23 19:38:02 +02:00 committed by GitHub
parent 5ce620b6ba
commit 4990d2b951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 584 additions and 274 deletions

View File

@ -1,222 +1,303 @@
diff --git a/configure.ac b/configure.ac
index bd85e0616..c45b0f74a 100644
index bd85e06..b88676a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1275,10 +1275,10 @@ AC_MSG_CHECKING([for libtiff])
@@ -45,6 +45,8 @@ dnl Compute the canonical host-system (the system we are building for)
dnl type variable $host
AC_CANONICAL_HOST
+PKG_PROG_PKG_CONFIG([0.21])
+
dnl Enable as much warnings as possible
AX_CFLAGS_WARN_ALL(C_WFLAGS)
AX_CXXFLAGS_WARN_ALL(CXX_WFLAGS)
@@ -1274,12 +1276,15 @@ AC_MSG_CHECKING([for libtiff])
if test "x${with_libtiff}" = "xyes" -o "x${with_libtiff}" = "x" ; then
dnl Only automatically pick up the external libtiff if it is >= 4.0.
- dnl Only automatically pick up the external libtiff if it is >= 4.0.
- AC_CHECK_LIB(tiff,TIFFScanlineSize64,TIFF_SETTING=external HAVE_BIGTIFF=yes,TIFF_SETTING=internal HAVE_BIGTIFF=yes,)
+ AC_SEARCH_LIBS(TIFFScanlineSize64,[tiffd tiff],TIFF_SETTING=external HAVE_BIGTIFF=yes,TIFF_SETTING=internal HAVE_BIGTIFF=yes,-ljpeg)
+ PKG_CHECK_MODULES([TIFF],[libtiff-4 > 4.0], [TIFF_SETTING=external], [TIFF_SETTING=internal HAVE_BIGTIFF=yes])
if test "$TIFF_SETTING" = "external" ; then
- LIBS="-ltiff $LIBS"
+ LIBS="-ljpeg $LIBS"
AC_MSG_RESULT([using pre-installed libtiff.])
+ EXTRA_INCLUDES="$TIFF_CFLAGS $EXTRA_INCLUDES"
+ SAVED_LIBS="$LIBS"
+ LIBS="$TIFF_LIBS"
+ AC_SEARCH_LIBS(TIFFScanlineSize64,[],HAVE_BIGTIFF=yes,HAVE_BIGTIFF=no,)
+ LIBS="$TIFF_LIBS $SAVED_LIBS"
else
AC_MSG_RESULT([using internal TIFF code.])
@@ -1338,18 +1338,12 @@ if test "`basename xx/$with_curl`" = "curl-config" ; then
fi
@@ -1333,22 +1338,28 @@ AC_ARG_WITH(curl,
dnl Clear some cache variables
unset ac_cv_path_LIBCURL
+LIBCURL_MODVERSION=
if test "`basename xx/$with_curl`" = "curl-config" ; then
LIBCURL_CONFIG="$with_curl"
elif test "$with_curl" = "no" ; then
LIBCURL_CONFIG=no
+elif test "$with_curl" = "yes" -o "$with_curl" = "" ; then
+ PKG_CHECK_EXISTS([libcurl], [LIBCURL_CONFIG="${PKG_CONFIG} libcurl"], [LIBCURL_CONFIG=false])
+ LIBCURL_MODVERSION=`$LIBCURL_CONFIG --modversion`
else
- AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no)
+ LIBCURL_CONFIG=yes
AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no)
fi
if test "$LIBCURL_CONFIG" != "no" ; then
- CURL_VERNUM=`$LIBCURL_CONFIG --vernum`
- CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'`
-
- AC_MSG_RESULT([ found libcurl version $CURL_VER])
-
+ CURL_VER="`$LIBCURL_CONFIG --version | awk '{print $2}'`$LIBCURL_MODVERSION"
AC_MSG_RESULT([ found libcurl version $CURL_VER])
- AC_CHECK_LIB(curl,curl_global_init,CURL_SETTING=yes,CURL_SETTING=no,`$LIBCURL_CONFIG --libs`)
-
+ AC_SEARCH_LIBS(curl_global_init,[curl-d curl],CURL_SETTING=yes,CURL_SETTING=no,)
+ SAVED_LIBS="$LIBS"
+ LIBS=`$LIBCURL_CONFIG --libs`
+ AC_SEARCH_LIBS(curl_global_init,[],CURL_SETTING=yes,CURL_SETTING=no,)
+ LIBS="$SAVED_LIBS"
fi
AC_SUBST(CURL_SETTING,$CURL_SETTING)
@@ -1512,12 +1506,12 @@ elif test "$with_spatialite" = "yes"; then
AC_CHECK_HEADERS(sqlite3.h)
if test "$ac_cv_header_sqlite3_h" = "yes"; then
AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include])
- if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
+ if test -f "$prefix/../include/spatialite.h" -o -f "$prefix/include/spatialite.h" -o -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
AC_MSG_RESULT(found)
- AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-lsqlite3)
+ AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-lsqlite3 -lrttopo -lfreexl)
if test "$SPATIALITE_INIT_FOUND" = "yes"; then
HAVE_SPATIALITE=yes
- SPATIALITE_LIBS="-lspatialite -lsqlite3"
+ SPATIALITE_LIBS="-lspatialite -lsqlite3 -lrttopo -lfreexl"
LIBS="$LIBS $SPATIALITE_LIBS"
HAVE_SQLITE3=yes
fi
@@ -1570,11 +1564,15 @@ dnl ---------------------------------------------------------------------------
@@ -1362,7 +1373,9 @@ dnl Proj depends on it so it must appear before.
dnl ---------------------------------------------------------------------------
SQLITE3_REQ_VERSION="3.0.0"
-AX_LIB_SQLITE3($SQLITE3_REQ_VERSION)
+AC_CHECK_LIB(sqlite3,sqlite3_open,HAVE_SQLITE3=yes,AC_MSG_ERROR([vcpkg sqlite3 not found]),)
+SQLITE3_CFLAGS=
+SQLITE3_LDFLAGS=-lsqlite3
if test "$HAVE_SQLITE3" = "yes"; then
LIBS="$SQLITE3_LDFLAGS $LIBS"
@@ -1570,6 +1583,19 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH(liblzma,[ --with-liblzma[=ARG] Include liblzma support (ARG=yes/no)],,)
if test "$with_liblzma" = "yes" ; then
- AC_CHECK_LIB(lzma,lzma_code,LIBLZMA_SETTING=yes,LIBLZMA_SETTING=no,)
+ PKG_CHECK_MODULES([LIBLZMA],[liblzma],[HAVE_LIBLZMA_PC=yes],[HAVE_LIBLZMA_PC=no])
+ SAVED_LIBS="$LIBS"
+ LIBS=""
+ AC_SEARCH_LIBS(lzma_code,[lzmad lzma],LIBLZMA_SETTING=yes,LIBLZMA_SETTING=no,)
+ LIBS="$LIBLZMA_LIBS"
+ AC_SEARCH_LIBS(lzma_code,[],LIBLZMA_SETTING=yes,LIBLZMA_SETTING=no,)
+ if test "$LIBLZMA_SETTING" = "yes" ; then
+ LIBS="$LIBLZMA_LIBS $SAVED_LIBS"
+ elif test "$HAVE_LIBLZMA_PC" = "yes" ; then
+ AC_MSG_ERROR([vcpkg liblzma broken])
+ else
+ LIBS="$SAVED_LIBS"
+ fi
+
+elif false; then
AC_CHECK_LIB(lzma,lzma_code,LIBLZMA_SETTING=yes,LIBLZMA_SETTING=no,)
AC_CHECK_HEADERS(lzma.h)
+ LZMA_LIBS="$LIBS"
+ LIBS="$SAVED_LIBS"
if test "$LIBLZMA_SETTING" = "yes" -a "$ac_cv_header_lzma_h" = "yes" ; then
- LIBS="-llzma $LIBS"
+ LIBS="$LZMA_LIBS $LIBS"
else
LIBLZMA_SETTING=no
fi
@@ -1592,11 +1590,9 @@ dnl ---------------------------------------------------------------------------
@@ -1592,6 +1618,19 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH(zstd,[ --with-zstd[=ARG] Include zstd support (ARG=yes/no/installation_prefix)],,)
if test "$with_zstd" = "" -o "$with_zstd" = "yes" ; then
- AC_CHECK_LIB(zstd,ZSTD_decompressStream,ZSTD_SETTING=yes,ZSTD_SETTING=no,)
+ AC_SEARCH_LIBS(ZSTD_decompressStream,[zstdd zstd],ZSTD_SETTING=yes,ZSTD_SETTING=no,)
+ PKG_CHECK_MODULES([ZSTD],[libzstd],[HAVE_LIBZSTD_PC=yes],[HAVE_LIBZSTD_PC=no])
+ SAVED_LIBS="$LIBS"
+ LIBS="$ZSTD_LIBS"
+ AC_SEARCH_LIBS(ZSTD_decompressStream,[],ZSTD_SETTING=yes,ZSTD_SETTING=no,)
+ if test "$ZSTD_SETTING" = "yes" ; then
+ LIBS="$ZSTD_LIBS $SAVED_LIBS"
+ elif test "$HAVE_LIBZSTD_PC" = "yes" ; then
+ AC_MSG_ERROR([vcpkg libzstd broken])
+ else
+ LIBS="$SAVED_LIBS"
+ fi
+
+elif false; then
AC_CHECK_LIB(zstd,ZSTD_decompressStream,ZSTD_SETTING=yes,ZSTD_SETTING=no,)
- if test "$ZSTD_SETTING" = "yes" ; then
- LIBS="-lzstd $LIBS"
- else
+ if test "$ZSTD_SETTING" != "yes" ; then
if test "$with_zstd" = "yes" ; then
AC_MSG_ERROR([libzstd not found])
else
@@ -1820,8 +1816,6 @@ fi
if test "$CURL_SETTING" = "yes" ; then
- CURL_INC=`$LIBCURL_CONFIG --cflags`
- CURL_LIB=`$LIBCURL_CONFIG --libs`
m4_foreach_w([frmt],CURL_FORMATS,[
driver_enabled=m4_join([_],[$INTERNAL_FORMAT],frmt,[ENABLED])
if test "x$driver_enabled" = "xyes"; then
@@ -1888,7 +1882,7 @@ else
PKG_CHECK_MODULES([PQ],[libpq > 9.1], [HAVE_PG=yes], [HAVE_PG=no])
if test "${HAVE_PG}" = "yes" ; then
- PG_LIB="${PQ_LIBS}"
+ PG_LIB="${PQ_LIBS} -lpgcommon -lpgport"
PG_INC="${PQ_CFLAGS}"
if test "$ZSTD_SETTING" = "yes" ; then
@@ -1893,6 +1932,12 @@ else
SAVED_LIBS="${LIBS}"
LIBS="${PG_LIB}"
@@ -4287,13 +4281,13 @@ if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then
AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no)
+ if test "${HAVE_PG}" = "no" ; then
+ unset ac_cv_lib_pq_PQconnectdb
+ PG_LIB="${PG_LIB} -lpgcommon -lpgport"
+ LIBS="${PG_LIB} ${SAVED_LIBS}"
+ AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no,[-lpgcommon -lpgport])
+ fi
LIBS="${SAVED_LIBS}"
if test "${HAVE_PG}" = "yes" ; then
LIBS="${PG_LIB} ${LIBS}"
@@ -2253,6 +2298,15 @@ AC_ARG_WITH(geotiff,[ --with-geotiff=ARG Libgeotiff library to use (ARG=inte
if test "$with_geotiff" = "yes" -o "$with_geotiff" = "" ; then
+ AC_CHECK_LIB(geotiff,GTIFAttachPROJContext,GEOTIFF_SETTING=external,GEOTIFF_SETTING=internal)
+ if test $GEOTIFF_SETTING = "external" ; then
+ LIBS="-lgeotiff $LIBS"
+ else
+ AC_MSG_ERROR([vcpkg geotiff broken])
+ fi
+
+elif false; then
+
if test "$TIFF_SETTING" = "internal" ; then
GEOTIFF_SETTING=internal
else
@@ -3002,7 +3056,7 @@ elif test "$with_hdf5" = "yes" -o "$with_hdf5" = "" ; then
# Test that the package found is for the right architecture
saved_LIBS="$LIBS"
LIBS="$HDF5_LIBS"
- AC_CHECK_LIB(hdf5,H5Fopen, [HAVE_HDF5=yes], [HAVE_HDF5=no])
+ AC_SEARCH_LIBS(H5Fopen,[],[HAVE_HDF5=yes],[HAVE_HDF5=no],)
LIBS="$saved_LIBS"
if test "$HAVE_HDF5" = "yes"; then
@@ -3132,6 +3186,24 @@ if test "$with_netcdf" = "no" ; then
echo "netCDF support disabled."
+elif true ; then
+
+ PKG_CHECK_MODULES([NETCDF],[netcdf],[HAVE_NETCDF_PC=yes],[HAVE_NETCDF_PC=no])
+ SAVED_LIBS="$LIBS"
+ LIBS="$NETCDF_LIBS"
+ AC_SEARCH_LIBS(nc_open,[],NETCDF_SETTING=yes,NETCDF_SETTING=no,)
+ if test "$NETCDF_SETTING" = "yes" ; then
+ LIBS="$NETCDF_LIBS $SAVED_LIBS"
+ EXTRA_INCLUDES="$NETCDF_CFLAGS $EXTRA_INCLUDES"
+ PKG_CHECK_VAR([NETCDF_ROOT],[netcdf],[prefix],,)
+ PKG_CHECK_VAR([NETCDF_INCLUDEDIR],[netcdf],[includedir],,)
+ NETCDF_NCCONFIG=
+ elif test "$HAVE_NETCDF_PC" = "yes" ; then
+ AC_MSG_ERROR([vcpkg netcdf-c broken])
+ else
+ LIBS="$SAVED_LIBS"
+ fi
+
else
dnl find nc-config location
@@ -3352,6 +3424,21 @@ if test "$with_openjpeg" = "no" ; then
AC_MSG_NOTICE([OpenJPEG (JPEG2000) support disabled.])
+elif true ; then
+
+ PKG_CHECK_MODULES([OPENJPEG],[libopenjp2 >= 2.1.0],[HAVE_LIBOPENJP2_PC=yes],[HAVE_LIBOPENJP2_PC=no])
+ SAVED_LIBS="$LIBS"
+ LIBS="$OPENJPEG_LIBS"
+ AC_SEARCH_LIBS(opj_setup_decoder,[],HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
+ if test "$HAVE_OPENJPEG" = "yes" ; then
+ EXTRA_INCLUDES="$OPENJPEG_CFLAGS $EXTRA_INCLUDES"
+ LIBS="$OPENJPEG_LIBS $SAVED_LIBS"
+ elif test "$HAVE_LIBOPENJP2_PC" = "yes" ; then
+ AC_MSG_ERROR([vcpkg libopenjpeg broken])
+ else
+ LIBS="$SAVED_LIBS"
+ fi
+
else
PKG_PROG_PKG_CONFIG([0.21])
@@ -4043,7 +4130,9 @@ dnl ---------------------------------------------------------------------------
dnl Expat 1.95.0 released in 2000-09-28
EXPAT_REQ_VERSION="1.95.0"
-AX_LIB_EXPAT($EXPAT_REQ_VERSION)
+AC_CHECK_LIB(expat,XML_ParserCreate,HAVE_EXPAT=yes,AC_MSG_ERROR([vcpkg expat not found]))
+EXPAT_LDFLAGS="-lexpat"
+EXPAT_INCLUDE=""
if test "$HAVE_EXPAT" = "yes"; then
LIBS="$EXPAT_LDFLAGS $LIBS"
@@ -4066,7 +4155,13 @@ dnl Check for Google libkml support.
dnl ---------------------------------------------------------------------------
LIBKML_REQ_VERSION="1.3.0"
+if test "x${with_libkml}" = "xno"; then
+ echo "libkml support disabled."
+ HAVE_LIBKML="no"
+ LIBKML_CFLAGS=
+else
AX_LIB_LIBKML($LIBKML_REQ_VERSION)
+fi
if test "$HAVE_LIBKML" = "yes"; then
LIBS="$LIBKML_LDFLAGS $LIBS"
@@ -4244,8 +4339,8 @@ else
dnl Add curl to LIBS; it might be local to DODS or generally installed
if test -x $DODS_BIN/curl-config; then
LIBS="$LIBS `$DODS_BIN/curl-config --libs`"
- elif which curl-config > /dev/null 2>&1; then
- LIBS="$LIBS `curl-config --libs`"
+ elif test "$CURL_SETTING" = "yes"; then
+ LIBS="$LIBS $CURL_LIB"
else
AC_MSG_ERROR([You gave a dods root, but I can't find curl!])
fi
@@ -4287,7 +4382,7 @@ if test "x$with_xml2" = "xyes" -o "x$with_xml2" = "x" ; then
if test "${HAVE_LIBXML2}" = "yes"; then
SAVED_LIBS="${LIBS}"
LIBS="${LIBXML2_LIBS}"
- AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no)
+ AC_CHECK_LIB(xml2,xmlParseDoc,HAVE_LIBXML2=yes,HAVE_LIBXML2=no,-lz -lm $LZMA_LIBS)
+ AC_SEARCH_LIBS(xmlParseDoc,[],HAVE_LIBXML2=yes,HAVE_LIBXML2=no,)
LIBS="${SAVED_LIBS}"
fi
if test "${HAVE_LIBXML2}" = "yes"; then
LIBXML2_INC="${LIBXML2_CFLAGS}"
- LIBXML2_LIB="${LIBXML2_LIBS}"
+ LIBXML2_LIB="${LIBXML2_LIBS} -lz -lm $LZMA_LIBS"
else
if test "x$with_xml2" = "xyes"; then
AC_MSG_ERROR([--with-xml2 was requested, but libxml2 is not available])
@@ -4817,8 +4811,7 @@ if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjs
@@ -4536,6 +4631,22 @@ WEBP_SETTING=no
if test "$with_webp" = "yes" -o "$with_webp" = "" ; then
+ PKG_CHECK_MODULES([WEBP],[libwebp],[HAVE_LIBWEBP_PC=yes],[HAVE_LIBWEBP_PC=no])
+ SAVED_LIBS="$LIBS"
+ LIBS="$WEBP_LIBS"
+ AC_SEARCH_LIBS(WebPDecodeRGB,[],WEBP_SETTING=yes,WEBP_SETTING=no,)
+
+ if test "$WEBP_SETTING" = "yes" ; then
+ LIBS="$WEBP_LIBS $SAVED_LIBS"
+ elif test "$HAVE_LIBWEBP_PC" = "yes" ; then
+ AC_MSG_ERROR([vcpkg libwebp broken])
+ else
+ echo "libwebp not found - WEBP support disabled"
+ LIBS="$SAVED_LIBS"
+ fi
+
+elif false ; then
+
AC_CHECK_LIB(webp,WebPDecodeRGB,WEBP_SETTING=yes,WEBP_SETTING=no,)
if test "$WEBP_SETTING" = "yes" ; then
@@ -4567,7 +4678,7 @@ dnl ---------------------------------------------------------------------------
dnl Check if geos library is available.
dnl ---------------------------------------------------------------------------
-GEOS_INIT(3.1.0)
+PKG_CHECK_MODULES(GEOS,geos >= 3.1.0,HAVE_GEOS=yes,AC_MSG_ERROR([vcpkg geos not found]))
HAVE_GEOS_RESULT="no"
if test "${HAVE_GEOS}" = "yes" ; then
@@ -4812,6 +4923,16 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH(libjson-c,[ --with-libjson-c[=ARG] Include libjson-c support (ARG=internal or libjson-c directory)],,)
+PKG_CHECK_MODULES([JSONC],[json-c],[HAVE_JSONC=yes],[HAVE_JSONC=no])
+SAVED_LIBS="$LIBS"
+LIBS="$JSONC_LIBS"
+AC_SEARCH_LIBS(json_object_set_serializer,[],LIBJSONC_SETTING=external,LIBJSONC_SETTING=,)
+if test "$LIBJSONC_SETTING" = "external" ; then
+ LIBS="$JSONC_LIBS $SAVED_LIBS"
+ JSON_INCLUDE="$JSONC_CFLAGS"
+else
+ LIBS="$SAVED_LIBS"
+
if test "$with_libjson_c" = "external" -o "$with_libjson_c" = "" -o "$with_libjson_c" = "yes" ; then
AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,)
elif test "$with_libjson_c" = "internal" ; then
LIBJSONC_SETTING=internal
elif test "$with_libjson_c" != "no"; then
- LIBS="-L$with_libjson_c/lib $LIBS"
- AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,-L$with_libjson_c/lib)
+ AC_CHECK_LIB(json-c,json_object_set_serializer,LIBJSONC_SETTING=external,LIBJSONC_SETTING=internal,)
else
AC_MSG_ERROR([libjson-c (internal or external) is required])
@@ -4840,6 +4961,8 @@ else
AC_MSG_RESULT([using internal libjson-c code])
fi
diff --git a/m4/ax_lib_sqlite3.m4 b/m4/ax_lib_sqlite3.m4
index e53a4a967..440e2c5ed 100644
--- a/m4/ax_lib_sqlite3.m4
+++ b/m4/ax_lib_sqlite3.m4
@@ -76,23 +76,22 @@ AC_DEFUN([AX_LIB_SQLITE3],
unset ac_cv_lib_sqlite3_sqlite3_open
saved_LIBS="$LIBS"
- LIBS=""
AC_CHECK_LIB(sqlite3,sqlite3_open,LIB_SQLITE3_FOUND=yes,LIB_SQLITE3_FOUND=no,-L$ac_sqlite3_path/lib)
LIBS="$saved_LIBS"
if test "$LIB_SQLITE3_FOUND" = "yes"; then
ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib"
fi
+ ac_sqlite3_include_path="$ac_sqlite3_path/include"
ac_sqlite3_cppflags="-I$ac_sqlite3_path/include"
else
- for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do
- if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \
- && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then
+ for ac_sqlite3_path_tmp in $prefix /usr /usr/local /opt; do
+ if (test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \
+ && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header") || (test -f "$ac_sqlite3_path_tmp/../include/$ac_sqlite3_header" && test -r "$ac_sqlite3_path_tmp/../include/$ac_sqlite3_header"); then
ac_sqlite3_path=$ac_sqlite3_path_tmp
unset ac_cv_lib_sqlite3_sqlite3_open
saved_LIBS="$LIBS"
- LIBS=""
AC_CHECK_LIB(sqlite3,sqlite3_open,LIB_SQLITE3_FOUND=yes,LIB_SQLITE3_FOUND=no,)
LIBS="$saved_LIBS"
if test "$LIB_SQLITE3_FOUND" = "yes"; then
@@ -100,7 +99,6 @@ AC_DEFUN([AX_LIB_SQLITE3],
else
unset ac_cv_lib_sqlite3_sqlite3_open
saved_LIBS="$LIBS"
- LIBS=""
AC_CHECK_LIB(sqlite3,sqlite3_open,LIB_SQLITE3_FOUND=yes,LIB_SQLITE3_FOUND=no,-L$ac_sqlite3_path_tmp/lib)
LIBS="$saved_LIBS"
if test "$LIB_SQLITE3_FOUND" = "yes"; then
@@ -108,7 +106,12 @@ AC_DEFUN([AX_LIB_SQLITE3],
fi
fi
- ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include"
+ if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then
+ ac_sqlite3_include_path="$ac_sqlite3_path_tmp/include"
+ else
+ ac_sqlite3_include_path="$ac_sqlite3_path_tmp/../include"
+ fi
+ ac_sqlite3_cppflags="-I$ac_sqlite3_include_path"
break;
fi
done
@@ -122,7 +125,6 @@ AC_DEFUN([AX_LIB_SQLITE3],
AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req])
if test "x$WANT_SQLITE3" = "xyes"; then
-
ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3"
saved_CPPFLAGS="$CPPFLAGS"
@@ -161,7 +163,7 @@ AC_DEFUN([AX_LIB_SQLITE3],
SQLITE3_CFLAGS="$ac_sqlite3_cppflags"
SQLITE3_LDFLAGS="$ac_sqlite3_ldflags"
- ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header"
+ ac_sqlite3_header_path="$ac_sqlite3_include_path/$ac_sqlite3_header"
dnl Retrieve SQLite release version
if test "x$ac_sqlite3_header_path" != "x"; then
@@ -184,5 +186,6 @@ AC_DEFUN([AX_LIB_SQLITE3],
else
AC_MSG_RESULT([disabled])
fi
+ unset ac_sqlite3_include_path
])
diff --git a/m4/geos.m4 b/m4/geos.m4
index a410673b4..c16e1f33a 100644
--- a/m4/geos.m4
+++ b/m4/geos.m4
@@ -60,6 +60,7 @@ AC_DEFUN([GEOS_INIT],[
AC_PATH_PROG(GEOS_CONFIG, geos-config, no)
ac_geos_config_auto=yes
+ HAVE_GEOS="yes"
else
+fi # json-c.pc
+
AC_SUBST(LIBJSONC_SETTING,$LIBJSONC_SETTING)
AC_SUBST(JSON_INCLUDE,$JSON_INCLUDE)

View File

@ -0,0 +1,13 @@
diff --git a/port/cpl_port.h b/port/cpl_port.h
index 9e3ebbb..130af04 100644
--- a/port/cpl_port.h
+++ b/port/cpl_port.h
@@ -343,7 +343,7 @@ typedef unsigned int GUIntptr_t;
#endif
#ifndef CPL_DLL
-#if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)
+#if defined(WIN32) && !defined(CPL_DISABLE_DLL)
# ifdef GDAL_COMPILATION
# define CPL_DLL __declspec(dllexport)
# else

View File

@ -1,12 +1,8 @@
include(${CMAKE_CURRENT_LIST_DIR}/dependency_win.cmake)
#include(${CMAKE_CURRENT_LIST_DIR}/dependency_unix.cmake)
vcpkg_fail_port_install(ON_ARCH "arm")
# NOTE: update the version and checksum for new GDAL release
set(GDAL_VERSION_STR "3.2.2")
set(GDAL_VERSION_PKG "322")
set(GDAL_VERSION_LIB "204")
set(GDAL_PACKAGE_SUM "ce319e06c78bd076228b3710c127cdbd37c7d6fb23966b47df7287eaffe86a05d4ddcc78494c8bfcaf4db98a71f2ed50a01fb3ca2fe1c10cf0d2e812683c8e53")
vcpkg_download_distfile(ARCHIVE
@ -15,51 +11,61 @@ vcpkg_download_distfile(ARCHIVE
SHA512 ${GDAL_PACKAGE_SUM}
)
set(GDAL_PATCHES 0001-Fix-debug-crt-flags.patch 0002-Fix-build.patch 0005-Fix-configure.patch)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(GDAL_PATCHES
0001-Fix-debug-crt-flags.patch
0002-Fix-build.patch
0004-Fix-cfitsio.patch
0005-Fix-configure.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND GDAL_PATCHES 0003-Fix-static-build.patch)
else()
list(APPEND GDAL_PATCHES 0006-Fix-mingw-dllexport.patch)
endif()
list(APPEND GDAL_PATCHES 0004-Fix-cfitsio.patch)
vcpkg_extract_source_archive_ex(
ARCHIVE ${ARCHIVE}
ARCHIVE "${ARCHIVE}"
OUT_SOURCE_PATH SOURCE_PATH
PATCHES ${GDAL_PATCHES}
)
if (VCPKG_TARGET_IS_WINDOWS)
if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(NATIVE_DATA_DIR "${CURRENT_PACKAGES_DIR}/share/gdal")
set(NATIVE_HTML_DIR "${CURRENT_PACKAGES_DIR}/share/gdal/html")
include("${CMAKE_CURRENT_LIST_DIR}/dependency_win.cmake")
find_dependency_win()
set(NMAKE_OPTIONS "")
set(NMAKE_OPTIONS_REL "")
set(NMAKE_OPTIONS_DBG "")
if("mysql-libmysql" IN_LIST FEATURES OR "mysql-libmariadb" IN_LIST FEATURES)
list(APPEND NMAKE_OPTIONS MYSQL_INC_DIR=${MYSQL_INCLUDE_DIR})
list(APPEND NMAKE_OPTIONS_REL MYSQL_LIB=${MYSQL_LIBRARY_REL})
list(APPEND NMAKE_OPTIONS_DBG MYSQL_LIB=${MYSQL_LIBRARY_DBG})
list(APPEND NMAKE_OPTIONS "MYSQL_INC_DIR=${MYSQL_INCLUDE_DIR}")
list(APPEND NMAKE_OPTIONS_REL "MYSQL_LIB=${MYSQL_LIBRARY_REL}")
list(APPEND NMAKE_OPTIONS_DBG "MYSQL_LIB=${MYSQL_LIBRARY_DBG}")
endif()
list(APPEND NMAKE_OPTIONS
# VERSION=${GDAL_VERSION_LIB}
DATADIR=${NATIVE_DATA_DIR}
HTMLDIR=${NATIVE_HTML_DIR}
GEOS_DIR=${GEOS_INCLUDE_DIR}
"DATADIR=${NATIVE_DATA_DIR}"
"HTMLDIR=${NATIVE_HTML_DIR}"
"GEOS_DIR=${GEOS_INCLUDE_DIR}"
"GEOS_CFLAGS=-I${GEOS_INCLUDE_DIR} -DHAVE_GEOS"
PROJ_INCLUDE=-I${PROJ_INCLUDE_DIR}
EXPAT_DIR=${EXPAT_INCLUDE_DIR}
EXPAT_INCLUDE=-I${EXPAT_INCLUDE_DIR}
CURL_INC=-I${CURL_INCLUDE_DIR}
"PROJ_INCLUDE=-I${PROJ_INCLUDE_DIR}"
"EXPAT_DIR=${EXPAT_INCLUDE_DIR}"
"EXPAT_INCLUDE=-I${EXPAT_INCLUDE_DIR}"
"CURL_INC=-I${CURL_INCLUDE_DIR}"
"SQLITE_INC=-I${SQLITE_INCLUDE_DIR} ${HAVE_SPATIALITE}"
PG_INC_DIR=${PGSQL_INCLUDE_DIR}
"PG_INC_DIR=${PGSQL_INCLUDE_DIR}"
OPENJPEG_ENABLED=YES
OPENJPEG_CFLAGS=-I${OPENJPEG_INCLUDE_DIR}
"OPENJPEG_CFLAGS=-I${OPENJPEG_INCLUDE_DIR}"
OPENJPEG_VERSION=20100
WEBP_ENABLED=YES
WEBP_CFLAGS=-I${WEBP_INCLUDE_DIR}
LIBXML2_INC=-I${XML2_INCLUDE_DIR}
"WEBP_CFLAGS=-I${WEBP_INCLUDE_DIR}"
"LIBXML2_INC=-I${XML2_INCLUDE_DIR}"
PNG_EXTERNAL_LIB=1
PNGDIR=${PNG_INCLUDE_DIR}
ZLIB_INC=-I${ZLIB_INCLUDE_DIR}
"PNGDIR=${PNG_INCLUDE_DIR}"
"ZLIB_INC=-I${ZLIB_INCLUDE_DIR}"
ZLIB_EXTERNAL_LIB=1
ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1
MSVC_VER=1900
@ -69,7 +75,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
list(APPEND NMAKE_OPTIONS WIN64=YES)
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND NMAKE_OPTIONS CURL_CFLAGS=-DCURL_STATICLIB)
list(APPEND NMAKE_OPTIONS DLLBUILD=0)
list(APPEND NMAKE_OPTIONS "PROJ_FLAGS=-DPROJ_STATIC -DPROJ_VERSION=5")
@ -79,7 +85,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
list(APPEND NMAKE_OPTIONS DLLBUILD=1)
endif()
if (VCPKG_CRT_LINKAGE STREQUAL static)
if (VCPKG_CRT_LINKAGE STREQUAL "static")
set(LINKAGE_FLAGS "/MT")
else()
set(LINKAGE_FLAGS "/MD")
@ -87,42 +93,42 @@ if (VCPKG_TARGET_IS_WINDOWS)
list(APPEND NMAKE_OPTIONS_REL
${NMAKE_OPTIONS}
GDAL_HOME=${CURRENT_PACKAGES_DIR}
CXX_CRT_FLAGS=${LINKAGE_FLAGS}
PROJ_LIBRARY=${PROJ_LIBRARY_REL}
PNG_LIB=${PNG_LIBRARY_REL}
"GDAL_HOME=${CURRENT_PACKAGES_DIR}"
"CXX_CRT_FLAGS=${LINKAGE_FLAGS}"
"PROJ_LIBRARY=${PROJ_LIBRARY_REL}"
"PNG_LIB=${PNG_LIBRARY_REL}"
"GEOS_LIB=${GEOS_LIBRARY_REL}"
EXPAT_LIB=${EXPAT_LIBRARY_REL}
"EXPAT_LIB=${EXPAT_LIBRARY_REL}"
"CURL_LIB=${CURL_LIBRARY_REL} wsock32.lib wldap32.lib winmm.lib"
"SQLITE_LIB=${SQLITE_LIBRARY_REL} ${SPATIALITE_LIBRARY_REL}"
OPENJPEG_LIB=${OPENJPEG_LIBRARY_REL}
WEBP_LIBS=${WEBP_LIBRARY_REL}
"OPENJPEG_LIB=${OPENJPEG_LIBRARY_REL}"
"WEBP_LIBS=${WEBP_LIBRARY_REL}"
"LIBXML2_LIB=${XML2_LIBRARY_REL} ${ICONV_LIBRARY_REL} ${LZMA_LIBRARY_REL}"
ZLIB_LIB=${ZLIB_LIBRARY_REL}
"ZLIB_LIB=${ZLIB_LIBRARY_REL}"
"PG_LIB=${PGSQL_LIBRARY_REL} Secur32.lib Shell32.lib Advapi32.lib Crypt32.lib Gdi32.lib ${OPENSSL_LIBRARY_REL}"
)
list(APPEND NMAKE_OPTIONS_DBG
${NMAKE_OPTIONS}
GDAL_HOME=${CURRENT_PACKAGES_DIR}/debug
CXX_CRT_FLAGS="${LINKAGE_FLAGS}d"
PROJ_LIBRARY=${PROJ_LIBRARY_DBG}
PNG_LIB=${PNG_LIBRARY_DBG}
"GDAL_HOME=${CURRENT_PACKAGES_DIR}/debug"
"CXX_CRT_FLAGS=${LINKAGE_FLAGS}d"
"PROJ_LIBRARY=${PROJ_LIBRARY_DBG}"
"PNG_LIB=${PNG_LIBRARY_DBG}"
"GEOS_LIB=${GEOS_LIBRARY_DBG}"
EXPAT_LIB=${EXPAT_LIBRARY_DBG}
"EXPAT_LIB=${EXPAT_LIBRARY_DBG}"
"CURL_LIB=${CURL_LIBRARY_DBG} wsock32.lib wldap32.lib winmm.lib"
"SQLITE_LIB=${SQLITE_LIBRARY_DBG} ${SPATIALITE_LIBRARY_DBG}"
OPENJPEG_LIB=${OPENJPEG_LIBRARY_DBG}
WEBP_LIBS=${WEBP_LIBRARY_DBG}
"OPENJPEG_LIB=${OPENJPEG_LIBRARY_DBG}"
"WEBP_LIBS=${WEBP_LIBRARY_DBG}"
"LIBXML2_LIB=${XML2_LIBRARY_DBG} ${ICONV_LIBRARY_DBG} ${LZMA_LIBRARY_DBG}"
ZLIB_LIB=${ZLIB_LIBRARY_DBG}
"ZLIB_LIB=${ZLIB_LIBRARY_DBG}"
"PG_LIB=${PGSQL_LIBRARY_DBG} Secur32.lib Shell32.lib Advapi32.lib Crypt32.lib Gdi32.lib ${OPENSSL_LIBRARY_DBG}"
DEBUG=1
)
# Begin build process
vcpkg_install_nmake(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
TARGET devinstall
OPTIONS_RELEASE
"${NMAKE_OPTIONS_REL}"
@ -131,11 +137,11 @@ if (VCPKG_TARGET_IS_WINDOWS)
)
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/gdal/html)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/gdal/html")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND GDAL_EXES
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(GDAL_EXES
gdal_contour
gdal_create
gdal_grid
@ -166,81 +172,193 @@ if (VCPKG_TARGET_IS_WINDOWS)
)
vcpkg_copy_tools(TOOL_NAMES ${GDAL_EXES} AUTO_CLEAN)
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/share/gdal/html)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/share/gdal/html")
vcpkg_copy_pdbs()
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/gdal204.pdb)
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/gdal204.pdb")
endif()
else()
# See https://github.com/microsoft/vcpkg/issues/16990
vcpkg_execute_required_process(
COMMAND touch config.rpath
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME touch-${TARGET_TRIPLET}
)
file(TOUCH "${SOURCE_PATH}/config.rpath")
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BUILD_DYNAMIC yes)
set(BUILD_STATIC no)
else()
set(BUILD_DYNAMIC no)
set(BUILD_STATIC yes)
set(CONF_OPTS
--with-hide-internal-symbols=yes
--with-perl=no
--with-python=no
--with-java=no
)
set(CONF_CHECKS "")
function(add_config option check)
list(APPEND CONF_OPTS "${option}")
set(CONF_OPTS "${CONF_OPTS}" PARENT_SCOPE)
list(APPEND CONF_CHECKS "${check}")
set(CONF_CHECKS "${CONF_CHECKS}" PARENT_SCOPE)
endfunction()
# parameters in the same order as the dependencies in vcpkg.json
add_config("--with-cfitsio=yes" "CFITSIO support: external")
add_config("--with-curl=yes" "cURL support .wms/wcs/....:yes")
add_config("--with-expat=yes" "Expat support: yes")
add_config("--with-geos=yes" "GEOS support: yes")
add_config("--with-gif=yes" "LIBGIF support: external")
add_config("--with-hdf5=yes" "HDF5 support: yes")
add_config("--with-libjson=yes" "checking for JSONC... yes")
add_config("--with-geotiff=yes" "LIBGEOTIFF support: external")
add_config("--with-jpeg=yes" "LIBJPEG support: external")
add_config("--with-liblzma=yes" "LIBLZMA support: yes")
add_config("--with-png=yes" "LIBPNG support: external")
add_config("--with-pg=yes" "PostgreSQL support: yes")
add_config("--with-webp=yes" "WebP support: yes")
add_config("--with-xml2=yes" "libxml2 support: yes")
add_config("--with-netcdf=yes" "NetCDF support: yes")
add_config("--with-openjpeg=yes" "OpenJPEG support: yes")
add_config("--with-proj=yes" "PROJ >= 6: yes")
add_config("--with-sqlite3=yes" "SQLite support: yes")
add_config("--with-libtiff=yes" "LIBTIFF support: external")
add_config("--with-libz=yes" "LIBZ support: external")
add_config("--with-zstd=yes" "ZSTD support: yes")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND CONF_OPTS --without-libtool --without-ld-shared)
endif()
set(CONF_OPTS --enable-shared=${BUILD_DYNAMIC} --enable-static=${BUILD_STATIC})
list(APPEND CONF_OPTS --with-proj=yes --with-libjson-c=${CURRENT_INSTALLED_DIR})
list(APPEND CONF_OPTS --with-libtiff=yes --with-geotiff=yes)
list(APPEND CONF_OPTS --with-pg=yes --with-liblzma=yes)
if("system-libraries" IN_LIST FEATURES)
set(DISABLE_SYSTEM_LIBRARIES OFF)
else()
set(DISABLE_SYSTEM_LIBRARIES ON)
endif()
if ("libspatialite" IN_LIST FEATURES)
list(APPEND CONF_OPTS --with-spatialite=yes)
else()
list(APPEND CONF_OPTS --with-spatialite=no)
add_config("--with-spatialite=yes" "SpatiaLite support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-spatialite=no" "SpatiaLite support: no")
endif()
if(VCPKG_TARGET_IS_LINUX)
set(DEPENDLIBS "-lstdc++")
else()
set(DEPENDLIBS "-lc++ -liconv -llber -lldap -framework CoreFoundation -framework Security")
if ("mysql-libmariadb" IN_LIST FEATURES)
add_config("--with-mysql=yes" "MySQL support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-mysql=no" "MySQL support: no")
endif()
list(APPEND OPTIONS_RELEASE
"LIBS=-pthread ${DEPENDLIBS} -lssl -lcrypto -lgeos_c -lgeos -llzma -lszip"
)
list(APPEND OPTIONS_DEBUG
"LIBS=-pthread ${DEPENDLIBS} -lssl -lcrypto -lgeos_cd -lgeosd -llzmad -lszip_debug"
)
if(DISABLE_SYSTEM_LIBRARIES)
list(APPEND CONF_OPTS
# Too much: --disable-all-optional-drivers
# alphabetical order
--with-armadillo=no
--with-charls=no
--with-crypto=no
--with-cryptopp=no
--with-dds=no
--with-dods-root=no
--with-ecw=no
--with-epsilon=no
--with-exr=no
--with-fgdb=no
--with-fme=no
--with-freexl=no
--with-grass=no
--with-gta=no
--with-hdf4=no
--with-hdfs=no
--with-heif=no
--with-idb=no
--with-ingres=no
--with-jasper=no
--with-jp2lura=no
--with-kakadu=no
--with-kea=no
--with-libdeflate=no
--with-libgrass=no
--with-libkml=no
--with-mdb=no
--with-mrsid=no
--with-mrsid_lidar=no
--with-msg=no
--with-mongocxx=no
--with-mongocxxv3=no
--with-oci=no
--with-odbc=no
--with-ogdi=no
--with-opencl=no
--with-pcidsk=no
--with-pcraster=no
--with-pcre=no
--with-pdfium=no
--with-podofo=no
--with-poppler=no
--with-qhull=no
--with-rasdaman=no
--with-rasterlite2=no
--with-rdb=no
--with-sfcgal=no
--with-sosi=no
--with-teigha=no
--with-tiledb=no
--with-xerces=no
)
endif()
# proj needs a C++ runtime library
if(VCPKG_TARGET_IS_OSX)
list(APPEND CONF_OPTS "--with-proj-extra-lib-for-test=-lc++")
else()
list(APPEND CONF_OPTS "--with-proj-extra-lib-for-test=-lstdc++")
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
COPY_SOURCE
OPTIONS
${CONF_OPTS}
"GEOS_VERSION=3.9.0"
OPTIONS_RELEASE
${OPTIONS_RELEASE}
OPTIONS_DEBUG
--enable-debug
${OPTIONS_DEBUG}
)
# Verify configuration results (tightly coupled to vcpkg_configure_make)
function(check_config logfile)
set(failed_checks "")
file(READ "${logfile}" log)
foreach(check IN LISTS CONF_CHECKS)
if(NOT log MATCHES "${check}")
string(APPEND failed_checks "\n ${check}")
endif()
endforeach()
if(failed_checks)
get_filename_component(file "${logfile}" NAME_WE)
message(FATAL_ERROR "${file}: Configuration failed for ${failed_checks}")
endif()
endfunction()
foreach(suffix IN ITEMS rel dbg)
set(log "${CURRENT_BUILDTREES_DIR}/config-${TARGET_TRIPLET}-${suffix}-out.log")
if(EXISTS "${log}")
check_config("${log}")
endif()
endforeach()
vcpkg_install_make(MAKEFILE GNUmakefile)
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/lib/gdalplugins
${CURRENT_PACKAGES_DIR}/debug/lib/gdalplugins
${CURRENT_PACKAGES_DIR}/debug/share
"${CURRENT_PACKAGES_DIR}/lib/gdalplugins"
"${CURRENT_PACKAGES_DIR}/debug/lib/gdalplugins"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
vcpkg_fixup_pkgconfig()
set(pc_file_debug "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gdal.pc")
if(EXISTS "${pc_file_debug}")
vcpkg_replace_string("${pc_file_debug}" "${prefix}/../../include" "${prefix}/../include")
vcpkg_replace_string("${pc_file_debug}" "${exec_prefix}/include" "${prefix}/../include")
endif()
endif()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,12 +1,98 @@
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
find_path(GDAL_INCLUDE_DIR NAMES gdal.h HINTS ${CURRENT_INSTALLED_DIR})
find_library(GDAL_LIBRARY_DEBUG NAMES gdal_d gdal_i_d gdal NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
find_library(GDAL_LIBRARY_RELEASE NAMES gdal_i gdal NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
find_path(GDAL_INCLUDE_DIR
NAMES gdal.h
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../include"
NO_DEFAULT_PATH
)
find_library(GDAL_LIBRARY_DEBUG
NAMES gdal_d gdal_i_d gdal
NAMES_PER_DIR
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib"
NO_DEFAULT_PATH
)
find_library(GDAL_LIBRARY_RELEASE
NAMES gdal_i gdal
NAMES_PER_DIR
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib"
NO_DEFAULT_PATH
)
select_library_configurations(GDAL)
set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR})
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
if(NOT GDAL_INCLUDE_DIR OR NOT GDAL_LIBRARY)
message(FATAL_ERROR "Installation of vcpkg port gdal is broken.")
endif()
set(FindGDAL_SKIP_GDAL_CONFIG TRUE)
_find_package(${ARGS})
set(_gdal_dep_find_args "")
if(";${ARGS};" MATCHES ";REQUIRED;")
list(APPEND _gdal_dep_find_args "REQUIRED")
endif()
function(_gdal_add_dependency target package)
find_package(${package} ${ARGN} ${_gdal_dep_find_args})
if(${package}_FOUND)
foreach(suffix IN ITEMS "" "-shared" "_shared" "-static" "_static" "-NOTFOUND")
set(dependency "${target}${suffix}")
if(TARGET ${dependency})
break()
endif()
endforeach()
if(NOT TARGET ${dependency})
string(TOUPPER ${package} _gdal_deps_package)
if(DEFINED ${_gdal_deps_package}_LIBRARIES)
set(dependency ${${_gdal_deps_package}_LIBRARIES})
elseif(DEFINED ${package}_LIBRARIES)
set(dependency ${${package}_LIBRARIES})
elseif(DEFINED ${_gdal_deps_package}_LIBRARY)
set(dependency ${${_gdal_deps_package}_LIBRARY})
elseif(DEFINED ${package}_LIBRARY)
set(dependency ${${package}_LIBRARY})
endif()
endif()
if(dependency)
if(TARGET GDAL::GDAL) # CMake 3.14
target_link_libraries(GDAL::GDAL INTERFACE ${dependency})
endif()
if(NOT GDAL_LIBRARIES STREQUAL "GDAL::GDAL")
set(GDAL_LIBRARIES "${GDAL_LIBRARIES};${dependency}" PARENT_SCOPE)
endif()
else()
message(WARNING "Did not find which libraries are exported by ${package}")
set(GDAL_FOUND false PARENT_SCOPE)
endif()
else()
set(GDAL_FOUND false PARENT_SCOPE)
endif()
endfunction()
if(GDAL_FOUND)
_gdal_add_dependency(cfitsio unofficial-cfitsio CONFIG)
_gdal_add_dependency(CURL::libcurl CURL CONFIG)
_gdal_add_dependency(expat::expat expat CONFIG)
_gdal_add_dependency(GEOS::geos_c geos CONFIG)
_gdal_add_dependency(GIF::GIF GIF)
_gdal_add_dependency(hdf5::hdf5 hdf5 CONFIG)
if(NOT WIN32)
_gdal_add_dependency(json-c::json-c json-c CONFIG)
endif()
_gdal_add_dependency(geotiff_library geotiff CONFIG)
_gdal_add_dependency(JPEG::JPEG JPEG)
_gdal_add_dependency(liblzma::liblzma liblzma CONFIG)
_gdal_add_dependency(png libpng CONFIG)
_gdal_add_dependency(PostgreSQL::PostgreSQL PostgreSQL)
_gdal_add_dependency(WebP::webp WebP CONFIG)
_gdal_add_dependency(LibXml2::LibXml2 LibXml2)
_gdal_add_dependency(netCDF::netcdf netCDF CONFIG)
_gdal_add_dependency(openjp2 OpenJPEG CONFIG)
_gdal_add_dependency(PROJ::proj PROJ4 CONFIG)
_gdal_add_dependency(unofficial::sqlite3::sqlite3 unofficial-sqlite3 CONFIG)
_gdal_add_dependency(TIFF::TIFF TIFF)
_gdal_add_dependency(ZLIB::ZLIB ZLIB)
_gdal_add_dependency(zstd::libzstd zstd CONFIG)
list(FIND ARGS "REQUIRED" required)
if(NOT required EQUAL "-1")
message(FATAL_ERROR "Failed to find dependencies of GDAL")
endif()
endif()

View File

@ -1,6 +1,7 @@
{
"name": "gdal",
"version-semver": "3.2.2",
"port-version": 1,
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"supports": "!arm",
@ -16,6 +17,7 @@
"platform": "!windows"
},
"libgeotiff",
"libjpeg-turbo",
"liblzma",
"libpng",
"libpq",
@ -25,6 +27,7 @@
"openjpeg",
"proj4",
"sqlite3",
"tiff",
"zlib",
"zstd"
],
@ -40,6 +43,10 @@
"dependencies": [
"libmariadb"
]
},
"system-libraries": {
"$supports": "!windows",
"description": "Include drivers which need additional libraries"
}
}
}

View File

@ -2218,7 +2218,7 @@
},
"gdal": {
"baseline": "3.2.2",
"port-version": 0
"port-version": 1
},
"gdcm": {
"baseline": "3.0.7",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f95d14f55c0bbc629a07da68147324ab4fd0bd58",
"version-semver": "3.2.2",
"port-version": 1
},
{
"git-tree": "bb182d21db781421272dccf7c43273c746480c05",
"version-semver": "3.2.2",