[gdal] Update to 3.5.1, build with CMake (#22392)

* Build with CMake [skip actions]

* Update to 3.5.0 RC1 [skip actions]

* Update to 3.5.0RC2

* Use GDAL_USE_INTERNAL_LIBS=OFF

* Use lower-case config path

* Add LERC support

* Fix tiff linkage in libgeotiff

* uwp is unsupported

* core doesn't imply lerc

* Drop legacy build

* Feature and portfile cleanup [skip actions]

* Cleanup wrapper

* Pass on libspatialite usage requirements

* Update versions

* Remove hfd5/netcdf from default for android

* Update versions

* Fix wrapper

* Update versions

* Fix libgeotiff config

* The wrapper needs pkgconf for libspatialite

* Update versions

* Remove obsolete patch

* Update to v3.5.1-RC1

* Burn host triplet into config, require pkg-config

* Fix libspatialite link libraries [skip actions]

* Update versions in manifests

* Update versions

* Remove obsolete wrapper code [skip actions]

Complements 5c4f512.

* Update to 3.5.1RC2 [skip actions]

* Handle additional link dependencies using pkg-config [skip actions]

* GDAL's find modules rely on PkgConfig

* Update to 3.5.1

* Update versions
This commit is contained in:
Kai Pastor 2022-07-08 00:05:52 +02:00 committed by GitHub
parent 39b548c8e5
commit e6c8c2bc05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 439 additions and 1180 deletions

View File

@ -1,43 +0,0 @@
diff --git a/gdal/nmake.opt b/gdal/nmake.opt
index 8253ae2..9456b79 100644
--- a/gdal/nmake.opt
+++ b/gdal/nmake.opt
@@ -148,16 +148,26 @@ GDAL_PDB = $(GDAL_ROOT)\gdal$(VERSION)$(POSTFIX).pdb
!ENDIF
!IFDEF WITH_PDB
-CXX_PDB_FLAGS=/Zi /Fd$(GDAL_PDB)
+CXX_PDB_FLAGS=/Z7 /Fd$(GDAL_PDB)
!ELSE
CXX_PDB_FLAGS=
!ENDIF
+# Flags to choose CRT variant to link against (e.g. static: /MT, /MTd, dynamic: /MD, /MDd)
+# Ensure MRSID_CONFIG in mrsid/nmake.opt is set appropriately as well
+!IFNDEF CXX_CRT_FLAGS
+!IFNDEF DEBUG
+CXX_CRT_FLAGS=/MD
+!ELSE
+CXX_CRT_FLAGS=/MDd
+!ENDIF
+!ENDIF
+
!IFNDEF OPTFLAGS
!IF "$(DEBUG)" == "0"
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP$(CPU_COUNT) /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
+OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP$(CPU_COUNT) $(CXX_CRT_FLAGS) /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
!ELSE
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP$(CPU_COUNT) /MDd /EHsc /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
+OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP$(CPU_COUNT) $(CXX_CRT_FLAGS) /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
!ENDIF
!ENDIF # OPTFLAGS
@@ -175,7 +185,7 @@ OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP$(CPU_COUNT) /MDd /EH
# 4351: new behavior: elements of array 'array' will be default initialized (needed for https://trac.osgeo.org/gdal/changeset/35593)
# 4611: interaction between '_setjmp' and C++ object destruction is non-portable
#
-WARNFLAGS = /W4 /wd4127 /wd4251 /wd4275 /wd4786 /wd4100 /wd4245 /wd4206 /wd4351 /wd4611
+WARNFLAGS = /W3 /wd4127 /wd4251 /wd4275 /wd4786 /wd4100 /wd4245 /wd4206 /wd4351 /wd4611
!ENDIF

View File

@ -1,38 +0,0 @@
diff --git a/gdal/makefile.vc b/gdal/makefile.vc
index 9e0bd44..8559f79 100644
--- a/gdal/makefile.vc
+++ b/gdal/makefile.vc
@@ -84,7 +84,7 @@ staticlib: $(LIB_DEPENDS)
call <<clean_main_build_output.bat
$(CLEAN_MAIN_BUILD_OUTPUT_CMDS)
<<
- lib /nologo /out:$(GDAL_LIB_NAME) $(LIBOBJ) $(EXTERNAL_LIBS)
+ lib /nologo /LTCG /out:$(GDAL_LIB_NAME) $(LIBOBJ) $(EXTERNAL_LIBS)
appslib-target:
cd apps
@@ -204,9 +204,6 @@ dll: $(GDAL_DLL)
# build using cygwin
docs:
-!IFDEF HTMLDIR
- make PYTHONHOME= -C doc html
-!ENDIF
bindings:
-for %d in ( $(BINDINGS) ) do \
@@ -236,12 +233,8 @@ install: default docs
cd ..\apps
$(MAKE) /f makefile.vc install
cd ..
- $(INSTALL) data\*.* $(DATADIR)
- $(INSTALL) LICENSE.TXT $(DATADIR)
-!IFDEF HTMLDIR
- -mkdir $(HTMLDIR)
- xcopy /S /Y doc\build\html $(HTMLDIR)
-!ENDIF
+ $(INSTALL) data\*.* "$(DATADIR)"
+ $(INSTALL) LICENSE.TXT "$(DATADIR)"
!IFDEF INCLUDE_OGR_FRMTS
cd ogr\ogrsf_frmts
$(MAKE) /f makefile.vc plugins-install

View File

@ -1,13 +0,0 @@
diff --git a/gdal/frmts/fits/fitsdataset.cpp b/gdal/frmts/fits/fitsdataset.cpp
index d6587d3..f913b08 100644
--- a/gdal/frmts/fits/fitsdataset.cpp
+++ b/gdal/frmts/fits/fitsdataset.cpp
@@ -38,7 +38,7 @@
#include "ogrsf_frmts.h"
#include <string.h>
-#include <fitsio.h>
+#include <cfitsio/fitsio.h>
#include <algorithm>
#include <string>

View File

@ -1,334 +0,0 @@
diff --git a/gdal/configure.ac b/gdal/configure.ac
index 30cd613..43f1daf 100644
--- a/gdal/configure.ac
+++ b/gdal/configure.ac
@@ -48,6 +48,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
AC_LANG_PUSH([C])
AX_COMPILER_VENDOR
@@ -1111,6 +1111,8 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH(libz,[ --with-libz[=ARG] Include libz support (ARG=internal or libz directory)],,)
if test "$with_libz" = "external" -o "$with_libz" = "" -o "$with_libz" = "yes" ; then
+ PKG_CHECK_MODULES([ZLIB], [zlib], [LIBZ_SETTING=external], [LIBZ_SETTING=internal])
+elif false ; then
AC_CHECK_LIB(z,deflateInit_,LIBZ_SETTING=external,LIBZ_SETTING=internal,)
@@ -1144,7 +1146,8 @@ elif test "$with_libz" != "no" -a "$with_libz" != "internal" ; then
fi
if test "$LIBZ_SETTING" = "external" ; then
- LIBS="-lz $LIBS"
+ LIBS="${ZLIB_LIBS} $LIBS"
+ EXTRA_INCLUDES="${ZLIB_CFLAGS} $EXTRA_INCLUDES"
if test "$with_libz" != "" -a "$with_libz" != "yes" -a "$with_libz" != "external" ; then
EXTRA_INCLUDES="-I$with_libz -I$with_libz/include $EXTRA_INCLUDES"
fi
@@ -1336,12 +1338,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.
- AC_CHECK_LIB(tiff,TIFFScanlineSize64,TIFF_SETTING=external HAVE_BIGTIFF=yes,TIFF_SETTING=internal HAVE_BIGTIFF=yes,)
+ 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"
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.])
fi
@@ -1402,22 +1407,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)
fi
if test "$LIBCURL_CONFIG" != "no" ; then
- CURL_VERNUM=`$LIBCURL_CONFIG --vernum`
- CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'`
+ 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`)
+ SAVED_LIBS="$LIBS"
+ LIBS=`$LIBCURL_CONFIG --libs`
+ AC_SEARCH_LIBS(curl_global_init,[],CURL_SETTING=yes,CURL_SETTING=no,)
+ LIBS="$SAVED_LIBS"
fi
@@ -1431,7 +1442,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"
@@ -1571,6 +1584,11 @@ HAVE_SPATIALITE=no
if test -z "$with_spatialite" -o "$with_spatialite" = "no"; then
AC_MSG_RESULT(disabled)
elif test "$with_spatialite" = "yes"; then
+ PKG_CHECK_MODULES([SPATIALITE],[spatialite >= 5],[HAVE_SPATIALITE=yes],AC_MSG_ERROR([vcpkg libspatialite not found]))
+ SPATIALITE_INC="$SPATIALITE_CFLAGS"
+ LIBS="$LIBS $SPATIALITE_LIBS"
+ ac_cv_lib_spatialite_spatialite_target_cpu=yes
+elif false; 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])
@@ -1639,6 +1652,19 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH(liblzma,[ --with-liblzma[=ARG] Include liblzma support (ARG=yes/no)],,)
if test "$with_liblzma" = "yes" ; then
+ PKG_CHECK_MODULES([LIBLZMA],[liblzma],[HAVE_LIBLZMA_PC=yes],[HAVE_LIBLZMA_PC=no])
+ SAVED_LIBS="$LIBS"
+ 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)
@@ -1661,6 +1687,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
+ 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
@@ -1962,6 +2001,12 @@ else
SAVED_LIBS="${LIBS}"
LIBS="${PG_LIB}"
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}"
@@ -2322,6 +2367,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
@@ -3005,7 +3059,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
@@ -3135,6 +3189,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
@@ -3355,6 +3427,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])
@@ -4046,7 +4133,9 @@ dnl ---------------------------------------------------------------------------
dnl Expat 1.95.0 released in 2000-09-28
EXPAT_REQ_VERSION="1.95.0"
-AX_LIB_EXPAT($EXPAT_REQ_VERSION)
+PKG_CHECK_MODULES([EXPAT],[expat],[HAVE_EXPAT=yes],[AC_MSG_ERROR([vcpkg expat not found])])
+EXPAT_LDFLAGS="$EXPAT_LIBS"
+EXPAT_INCLUDE=""
if test "$HAVE_EXPAT" = "yes"; then
LIBS="$EXPAT_LDFLAGS $LIBS"
@@ -4069,7 +4158,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"
@@ -4252,8 +4347,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
@@ -4295,7 +4390,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_SEARCH_LIBS(xmlParseDoc,[],HAVE_LIBXML2=yes,HAVE_LIBXML2=no,)
LIBS="${SAVED_LIBS}"
fi
@@ -4509,6 +4604,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
@@ -4540,7 +4651,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]))
if test "${HAVE_GEOS}" = "yes" ; then
AC_MSG_NOTICE([Using C API from GEOS $GEOS_VERSION])
STRIP_SYSTEM_LIBRARY_PATHS("${GEOS_LIBS}")
@@ -4779,6 +4890,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
@@ -4807,6 +4928,8 @@ else
AC_MSG_RESULT([using internal libjson-c code])
fi
+fi # json-c.pc
+
AC_SUBST(LIBJSONC_SETTING,$LIBJSONC_SETTING)
AC_SUBST(JSON_INCLUDE,$JSON_INCLUDE)

View File

@ -1,13 +0,0 @@
diff --git a/gdal/port/cpl_port.h b/gdal/port/cpl_port.h
index 98805cf..a6a1846 100644
--- a/gdal/port/cpl_port.h
+++ b/gdal/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) || defined(DLL_EXPORT))
# ifdef GDAL_COMPILATION
# define CPL_DLL __declspec(dllexport)
# else

View File

@ -1,83 +0,0 @@
diff --git a/gdal/GDALmake.opt.in b/gdal/GDALmake.opt.in
index e8d2b05..1f19a4b 100644
--- a/gdal/GDALmake.opt.in
+++ b/gdal/GDALmake.opt.in
@@ -662,3 +662,6 @@ O_OBJ = $(foreach file,$(OBJ),../o/$(file))
%-clean:
$(MAKE) -C $* clean
+
+
+BUILD_TOOLS = @BUILD_TOOLS@
\ No newline at end of file
diff --git a/gdal/apps/GNUmakefile b/gdal/apps/GNUmakefile
index 9624cf7..f91403d 100644
--- a/gdal/apps/GNUmakefile
+++ b/gdal/apps/GNUmakefile
@@ -43,6 +43,11 @@ NON_DEFAULT_LIST = multireadtest$(EXE) dumpoverviews$(EXE) \
gdaltorture$(EXE) gdal2ogr$(EXE) test_ogrsf$(EXE) \
gdalasyncread$(EXE) testreprojmulti$(EXE)
+ifeq ($(BUILD_TOOLS),no)
+BIN_LIST =
+NON_DEFAULT_LIST =
+endif
+
default: gdal-config-inst gdal-config $(BIN_LIST)
all: default $(NON_DEFAULT_LIST)
diff --git a/gdal/apps/makefile.vc b/gdal/apps/makefile.vc
index 6e1fc9b..66f9b29 100644
--- a/gdal/apps/makefile.vc
+++ b/gdal/apps/makefile.vc
@@ -20,6 +20,7 @@ GNM_PROGRAMS = gnmmanage.exe gnmanalyse.exe
!ENDIF
+!IF "$(BUILD_TOOLS)" == "1"
default: gdal_translate.exe gdalinfo.exe gdaladdo.exe gdalwarp.exe \
nearblack.exe gdalmanage.exe gdalenhance.exe gdaltransform.exe\
gdaldem.exe gdallocationinfo.exe gdalsrsinfo.exe gdalmdiminfo.exe \
@@ -28,6 +29,10 @@ default: gdal_translate.exe gdalinfo.exe gdaladdo.exe gdalwarp.exe \
all: default multireadtest.exe \
dumpoverviews.exe gdalwarpsimple.exe gdalflattenmask.exe \
gdaltorture.exe gdal2ogr.exe test_ogrsf.exe
+!ELSE
+default:
+all:
+!ENDIF
OBJ = commonutils.obj gdalinfo_lib.obj gdal_translate_lib.obj gdalwarp_lib.obj ogr2ogr_lib.obj \
gdaldem_lib.obj nearblack_lib.obj gdal_grid_lib.obj gdal_rasterize_lib.obj gdalbuildvrt_lib.obj \
gdalmdiminfo_lib.obj gdalmdimtranslate_lib.obj
@@ -223,5 +228,9 @@ clean:
-del *.manifest
-del *.exp
+!IF "$(BUILD_TOOLS)" == "1"
install: default
copy *.exe $(BINDIR)
+!ELSE
+install:
+!ENDIF
\ No newline at end of file
diff --git a/gdal/configure.ac b/gdal/configure.ac
index 1098b39..e4d985e 100644
--- a/gdal/configure.ac
+++ b/gdal/configure.ac
@@ -6165,6 +6165,16 @@ case "${host_os}" in
;;
esac
+BUILD_TOOLS=yes
+AC_ARG_WITH([tools], AS_HELP_STRING([--with-tools], [Build the tools]),,)
+if test "$with_tools" = "yes"; then
+ AC_MSG_RESULT([enabled])
+else
+ BUILD_TOOLS=no
+ AC_MSG_RESULT([disabled by user])
+fi
+AC_SUBST(BUILD_TOOLS,$BUILD_TOOLS)
+
AC_CONFIG_FILES([GDALmake.opt])
AC_OUTPUT

View File

@ -1,13 +0,0 @@
diff --git a/gdal/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h b/gdal/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h
index 9557380..17edcf8 100644
--- a/gdal/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h
+++ b/gdal/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h
@@ -213,7 +213,7 @@ namespace flatbuffers {
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
// Check for absl::string_view
- #elif __has_include("absl/strings/string_view.h")
+ #elif __has_include("absl/strings/string_view.h") && 0
#include "absl/strings/string_view.h"
namespace flatbuffers {
typedef absl::string_view string_view;

View File

@ -1,72 +0,0 @@
diff --git a/gdal/nmake.opt b/gdal/nmake.opt
index 7e7871e..ac01bf2 100644
--- a/gdal/nmake.opt
+++ b/gdal/nmake.opt
@@ -239,6 +239,11 @@ STDCALL=YES
VERSION = 304
!ENDIF
+# Set HAVE_ATLBASE_H=NO if atlbase.h header is not available
+!IFNDEF HAVE_ATLBASE_H
+HAVE_ATLBASE_H=YES
+!ENDIF
+
# Comment the following out if you want PAM supported disabled
# by default.
!IFNDEF PAM_SETTING
diff --git a/gdal/port/cpl_aws.cpp b/gdal/port/cpl_aws.cpp
index eed23f9..e3a1578 100644
--- a/gdal/port/cpl_aws.cpp
+++ b/gdal/port/cpl_aws.cpp
@@ -43,7 +43,7 @@ CPL_CVSID("$Id$")
// #define DEBUG_VERBOSE 1
#ifdef WIN32
-#if defined(_MSC_VER)
+#if defined(HAVE_ATLBASE_H)
bool CPLFetchWindowsProductUUID(CPLString &osStr); // defined in cpl_aws_win32.cpp
#endif
const char* CPLGetWineVersion(); // defined in cpl_vsil_win32.cpp
@@ -688,7 +688,7 @@ static bool IsMachinePotentiallyEC2Instance()
}
else
{
-#if defined(_MSC_VER)
+#if defined(HAVE_ATLBASE_H)
CPLString osMachineUUID;
if( CPLFetchWindowsProductUUID(osMachineUUID) )
{
diff --git a/gdal/port/cpl_aws_win32.cpp b/gdal/port/cpl_aws_win32.cpp
index 7742a35..98be522 100644
--- a/gdal/port/cpl_aws_win32.cpp
+++ b/gdal/port/cpl_aws_win32.cpp
@@ -28,7 +28,7 @@
#include "cpl_port.h"
-#if defined(WIN32) && defined(_MSC_VER)
+#if defined(HAVE_ATLBASE_H)
#define _WIN32_DCOM
#include <iostream>
@@ -140,4 +140,4 @@ bool CPLFetchWindowsProductUUID(CPLString &osStr)
return !osWindowsProductUUID.empty();
}
-#endif /* defined(WIN32) && defined(_MSC_VER) */
+#endif /* defined(HAVE_ATLBASE_H) */
diff --git a/gdal/port/makefile.vc b/gdal/port/makefile.vc
index a8b0e02..68da2dd 100644
--- a/gdal/port/makefile.vc
+++ b/gdal/port/makefile.vc
@@ -141,6 +141,10 @@ EXTRAFLAGS = $(EXTRAFLAGS) $(LZ4_CFLAGS) -DHAVE_LZ4
ODBC_OBJ = cpl_odbc.obj
!ENDIF
+!IF "$(HAVE_ATLBASE_H)" == "YES"
+EXTRAFLAGS = $(EXTRAFLAGS) -DHAVE_ATLBASE_H
+!ENDIF
+
default: prev_dllbuild cpl_config.h $(LIB)
$(LIB): $(OBJ)

View File

@ -1,13 +0,0 @@
diff --git a/gdal/makefile.vc b/gdal/makefile.vc
index 9de546c..56f617d 100644
--- a/gdal/makefile.vc
+++ b/gdal/makefile.vc
@@ -27,7 +27,7 @@ OGR_INCLUDE = $(OGR_BASE_INCLUDE) \
CPPFLAGS = $(CPPFLAGS) -DGNM_ENABLED
!ENDIF
-!IF DEFINED(STDCALL) && !DEFINED(WIN64)
+!IF DEFINED(STDCALL) && !DEFINED(WIN64) && "$(SYM_PREFIX)" == "_"
BASE_INCLUDE = /INCLUDE:_GDALSimpleImageWarp@36 \
/INCLUDE:_GDALReprojectImage@48 \

View File

@ -0,0 +1,109 @@
diff --git a/cmake/modules/packages/FindFreeXL.cmake b/cmake/modules/packages/FindFreeXL.cmake
index 6c86fb8..0634412 100644
--- a/cmake/modules/packages/FindFreeXL.cmake
+++ b/cmake/modules/packages/FindFreeXL.cmake
@@ -37,7 +37,15 @@ include(SelectLibraryConfigurations)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_FREEXL QUIET freexl)
+ pkg_check_modules(PC_FREEXL QUIET IMPORTED_TARGET freexl)
+endif()
+if(PC_FREEXL_FOUND)
+ set(FREEXL_INCLUDE_DIR "${PC_FREEXL_INCLUDE_DIRS}" CACHE STRING "")
+ set(FREEXL_LIBRARY "${PC_FREEXL_LIBRARIES}" CACHE STRING "")
+ if(NOT TARGET FREEXL::freexl)
+ add_library(FREEXL::freexl INTERFACE IMPORTED)
+ set_target_properties(FREEXL::freexl PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_FREEXL)
+ endif()
endif()
find_path(FREEXL_INCLUDE_DIR
diff --git a/cmake/modules/packages/FindOpenJPEG.cmake b/cmake/modules/packages/FindOpenJPEG.cmake
index c697484..6e83222 100644
--- a/cmake/modules/packages/FindOpenJPEG.cmake
+++ b/cmake/modules/packages/FindOpenJPEG.cmake
@@ -32,9 +32,18 @@ endfunction()
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_OPENJPEG QUIET libopenjp2)
+ pkg_check_modules(PC_OPENJPEG QUIET IMPORTED_TARGET libopenjp2)
set(OPENJPEG_VERSION_STRING ${PC_OPENJPEG_VERSION})
endif()
+if(PC_OPENJPEG_FOUND)
+ set(OPENJPEG_INCLUDE_DIR "${PC_OPENJPEG_INCLUDE_DIRS}" CACHE STRING "")
+ set(OPENJPEG_LIBRARY "${PC_OPENJPEG_LIBRARIES}" CACHE STRING "")
+ if(NOT TARGET OPENJPEG::OpenJPEG)
+ add_library(OPENJPEG::OpenJPEG INTERFACE IMPORTED)
+ set_target_properties(OPENJPEG::OpenJPEG PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PC_OPENJPEG_INCLUDE_DIRS}")
+ set_target_properties(OPENJPEG::OpenJPEG PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_OPENJPEG)
+ endif()
+endif()
find_path(OPENJPEG_INCLUDE_DIR opj_config.h
diff --git a/cmake/modules/packages/FindPoppler.cmake b/cmake/modules/packages/FindPoppler.cmake
index 3807ec0..8059eb4 100644
--- a/cmake/modules/packages/FindPoppler.cmake
+++ b/cmake/modules/packages/FindPoppler.cmake
@@ -42,11 +42,19 @@ This module defines the following variables:
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_Poppler QUIET poppler)
+ pkg_check_modules(PC_Poppler QUIET IMPORTED_TARGET poppler)
if(PC_Poppler_VERSION)
set(Poppler_VERSION_STRING ${PC_Poppler_VERSION})
endif()
endif()
+if(PC_Poppler_FOUND)
+ set(Poppler_INCLUDE_DIR "${PC_Poppler_INCLUDE_DIRS}" CACHE STRING "")
+ set(Poppler_LIBRARY "${PC_Poppler_LIBRARIES}" CACHE STRING "")
+ if(NOT TARGET Poppler::Poppler)
+ add_library(Poppler::Poppler INTERFACE IMPORTED)
+ set_target_properties(Poppler::Poppler PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_Poppler)
+ endif()
+endif()
find_path(Poppler_INCLUDE_DIR NAMES "poppler-config.h" "cpp/poppler-version.h" "qt5/poppler-qt5.h" "qt4/poppler-qt4.h"
"glib/poppler.h"
HINTS ${PC_Poppler_INCLUDE_DIRS}
@@ -77,6 +85,15 @@ endforeach()
foreach(_comp IN LISTS Poppler_known_components)
list(FIND Poppler_FIND_COMPONENTS "${_comp}" _nextcomp)
if(_nextcomp GREATER -1)
+ pkg_check_modules(PC_Poppler_${_comp} QUIET IMPORTED_TARGET ${Poppler_${_comp}_pkg_config})
+ if(PC_Poppler_${_comp}_FOUND)
+ set(Poppler_${_comp}_INCLUDE_DIR "${PC_Poppler_${_comp}_INCLUDE_DIRS}" CACHE STRING "")
+ set(Poppler_${_comp}_LIBRARY "${PC_Poppler_${_comp}_LIBRARIES}" CACHE STRING "")
+ if(NOT TARGET Poppler::Poppler_${_comp})
+ add_library(Poppler::${_comp} INTERFACE IMPORTED)
+ set_target_properties(Poppler::${_comp} PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_Poppler_${_comp})
+ endif()
+ endif()
find_path(Poppler_${_comp}_INCLUDE_DIR
NAMES ${Poppler_${_comp}_header}
PATH_SUFFIXES poppler
diff --git a/cmake/modules/packages/FindSPATIALITE.cmake b/cmake/modules/packages/FindSPATIALITE.cmake
index 00612b0..6388719 100644
--- a/cmake/modules/packages/FindSPATIALITE.cmake
+++ b/cmake/modules/packages/FindSPATIALITE.cmake
@@ -38,9 +38,17 @@ endif()
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
- pkg_check_modules(PC_SPATIALITE QUIET spatialite)
+ pkg_check_modules(PC_SPATIALITE QUIET IMPORTED_TARGET spatialite)
set(SPATIALITE_VERSION_STRING ${PC_SPATIALITE_VERSION})
endif()
+if(PC_SPATIALITE_FOUND)
+ set(SPATIALITE_INCLUDE_DIR "${PC_SPATIALITE_INCLUDE_DIRS}" CACHE STRING "")
+ set(SPATIALITE_LIBRARY "${PC_SPATIALITE_LIBRARIES}" CACHE STRING "")
+ if(NOT TARGET SPATIALITE::SPATIALITE)
+ add_library(SPATIALITE::SPATIALITE INTERFACE IMPORTED)
+ set_target_properties(SPATIALITE::SPATIALITE PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::PC_SPATIALITE)
+ endif()
+endif()
find_path(SPATIALITE_INCLUDE_DIR
NAMES spatialite.h

View File

@ -1,375 +1,147 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OSGeo/gdal
REF v3.4.3
SHA512 702bcb220abc7cf978e8f70a1b2835a20ce5abe405014b9690cab311c00837e57555bb371ff5e2655f9eed63cfd461d6cec5e654001b276dd79a6d2ec0c21f0b
REF v3.5.1
SHA512 658e515a16ed2b45a0b3dffa6bb23f28d6454a902d8d9efbed320e353112463ff8e9c3efd5b6c98cf61cf187dc88a0dd13f4989041acc836de2b9c07e8da32e9
HEAD_REF master
PATCHES
0001-Fix-debug-crt-flags.patch
0002-Fix-build.patch
0004-Fix-cfitsio.patch
0005-Fix-configure.patch
0006-Fix-mingw-dllexport.patch
0007-Control-tools.patch
0008-Fix-absl-string_view.patch
0009-atlbase.patch
0010-symprefix.patch
find-link-libraries.patch
)
# `vcpkg clean` stumbles over one subdir
file(REMOVE_RECURSE "${SOURCE_PATH}/autotest")
set(extra_exports "")
if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if (VCPKG_CRT_LINKAGE STREQUAL "static")
set(LINKAGE_FLAGS "/MT")
else()
set(LINKAGE_FLAGS "/MD")
endif()
set(NMAKE_OPTIONS
"DATADIR=${CURRENT_PACKAGES_DIR}/share/gdal"
"HTMLDIR=${CURRENT_PACKAGES_DIR}/share/gdal/html"
"MSVC_VER=1900"
)
set(NMAKE_OPTIONS_REL
"GDAL_HOME=${CURRENT_PACKAGES_DIR}"
"CXX_CRT_FLAGS=${LINKAGE_FLAGS}"
)
set(NMAKE_OPTIONS_DBG
"GDAL_HOME=${CURRENT_PACKAGES_DIR}/debug"
"CXX_CRT_FLAGS=${LINKAGE_FLAGS}d"
DEBUG=1
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
list(APPEND NMAKE_OPTIONS "WIN64=YES")
endif()
if(VCPKG_TARGET_IS_UWP)
list(APPEND NMAKE_OPTIONS "SYM_PREFIX=" "EXTRA_LINKER_FLAGS=/APPCONTAINER WindowsApp.lib")
endif()
if(NOT "aws-ec2-windows" IN_LIST FEATURES)
list(APPEND NMAKE_OPTIONS "HAVE_ATLBASE_H=NO")
endif()
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
list(APPEND NMAKE_OPTIONS "SSEFLAGS=/DNO_SSSE" "AVXFLAGS=/DNO_AVX")
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND NMAKE_OPTIONS "DLLBUILD=0")
else()
list(APPEND NMAKE_OPTIONS "DLLBUILD=1" "WITH_PDB=1")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/dependency_win.cmake")
find_dependency_win()
if("tools" IN_LIST FEATURES)
list(APPEND NMAKE_OPTIONS_REL "BUILD_TOOLS=1")
else()
list(APPEND NMAKE_OPTIONS_REL "BUILD_TOOLS=0")
endif()
list(APPEND NMAKE_OPTIONS_DBG "BUILD_TOOLS=0")
# Begin build process
vcpkg_install_nmake(
SOURCE_PATH "${SOURCE_PATH}/gdal"
TARGET devinstall
OPTIONS
${NMAKE_OPTIONS}
OPTIONS_RELEASE
${NMAKE_OPTIONS_REL}
OPTIONS_DEBUG
${NMAKE_OPTIONS_DBG}
)
if("tools" IN_LIST FEATURES)
set(GDAL_EXES
gdal_contour
gdal_create
gdal_grid
gdal_rasterize
gdal_translate
gdal_viewshed
gdaladdo
gdalbuildvrt
gdaldem
gdalenhance
gdalinfo
gdallocationinfo
gdalmanage
gdalmdiminfo
gdalmdimtranslate
gdalsrsinfo
gdaltindex
gdaltransform
gdalwarp
gnmanalyse
gnmmanage
nearblack
ogr2ogr
ogrinfo
ogrlineref
ogrtindex
)
# vcpkg_copy_tools removes the bin directories for us so no need to remove again
vcpkg_copy_tools(TOOL_NAMES ${GDAL_EXES} AUTO_CLEAN)
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
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")
vcpkg_copy_pdbs()
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/gdal304_d.pdb" "${CURRENT_PACKAGES_DIR}/lib/gdal304.pdb")
endif()
else()
# See https://github.com/microsoft/vcpkg/issues/16990
file(TOUCH "${SOURCE_PATH}/gdal/config.rpath")
set(CONF_OPTS
--with-gnm=yes
--with-hide-internal-symbols=yes
--with-java=no
--with-perl=no
--with-python=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-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-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-webp=yes" "WebP support: yes")
add_config("--with-xml2=yes" "libxml2 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()
if("system-libraries" IN_LIST FEATURES)
set(DISABLE_SYSTEM_LIBRARIES OFF)
else()
set(DISABLE_SYSTEM_LIBRARIES ON)
endif()
if ("libspatialite" IN_LIST FEATURES)
add_config("--with-spatialite=yes" "SpatiaLite support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-spatialite=no" "SpatiaLite support: no")
endif()
if ("poppler" IN_LIST FEATURES)
add_config("--with-poppler=yes" "Poppler support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-poppler=no" "Poppler support: no")
endif()
if ("postgresql" IN_LIST FEATURES)
add_config("--with-pg=yes" "PostgreSQL support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-pg=no" "PostgreSQL support: no")
endif()
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()
if ("cfitsio" IN_LIST FEATURES)
add_config("--with-cfitsio=yes" "CFITSIO support: external")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-cfitsio=no" "CFITSIO support: no")
endif()
if ("hdf5" IN_LIST FEATURES)
add_config("--with-hdf5=yes" "HDF5 support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-hdf5=no" "HDF5 support: no")
endif()
if ("netcdf" IN_LIST FEATURES)
add_config("--with-netcdf=yes" "NetCDF support: yes")
elseif(DISABLE_SYSTEM_LIBRARIES)
add_config("--with-netcdf=no" "NetCDF support: no")
endif()
if(DISABLE_SYSTEM_LIBRARIES)
list(APPEND CONF_OPTS
# Too much: --disable-all-optional-drivers
# alphabetical order
--with-armadillo=no
--with-blosc=no
--with-brunsli=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-jp2lura=no
--with-jp2mrsid=no
--with-jasper=no
--with-jxl=no
--with-kakadu=no
--with-kea=no
--with-lerc=no
--with-libdeflate=no
--with-libgrass=no
--with-libkml=no
--with-lz4=no
--with-mdb=no
--with-mongocxx=no
--with-mongocxxv3=no
--with-mrsid=no
--with-mrsid_lidar=no
--with-msg=no
--with-null=no
--with-oci=no
--with-odbc=no
--with-ogdi=no
--with-opencl=no
--with-pcidsk=no
--with-pcraster=no
--with-pcre=no
--with-pcre2=no
--with-pdfium=no
--with-podofo=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()
x_vcpkg_pkgconfig_get_modules(PREFIX PROJ MODULES proj LIBS)
if("tools" IN_LIST FEATURES)
list(APPEND CONF_OPTS "--with-tools=yes")
else()
list(APPEND CONF_OPTS "--with-tools=no")
endif()
if(VCPKG_TARGET_IS_ANDROID AND (VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR VCPKG_TARGET_ARCHITECTURE MATCHES "arm"))
list(APPEND CONF_OPTS --with-unix-stdio-64=no)
endif()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}/gdal"
AUTOCONFIG
COPY_SOURCE
OPTIONS
${CONF_OPTS}
OPTIONS_RELEASE
"--with-proj-extra-lib-for-test=${PROJ_LIBS_RELEASE}"
OPTIONS_DEBUG
--enable-debug
--with-tools=no
"--with-proj-extra-lib-for-test=${PROJ_LIBS_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"
)
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()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/gdal/bin/gdal-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../..")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/gdal/debug/bin/gdal-config" "${CURRENT_INSTALLED_DIR}" "`dirname $0`/../../../..")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cpl_config.h" "#define GDAL_PREFIX \"${CURRENT_INSTALLED_DIR}\"" "")
if("libspatialite" IN_LIST FEATURES)
list(APPEND extra_exports SPATIALITE)
x_vcpkg_pkgconfig_get_modules(
PREFIX SPATIALITE
MODULES spatialite
LIBS
)
endif()
# Cf. cmake/helpers/CheckDependentLibraries.cmake
# The default for all `GDAL_USE_<PKG>` dependencies is `OFF`.
# Here, we explicitly control dependencies provided via vpcpkg.
# "core" is used for a dependency which must be enabled to avoid vendored lib.
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cfitsio GDAL_USE_CFITSIO
curl GDAL_USE_CURL
recommended-features GDAL_USE_EXPAT
freexl GDAL_USE_FREEXL
geos GDAL_USE_GEOS
core GDAL_USE_GEOTIFF
default-features GDAL_USE_GIF
hdf5 GDAL_USE_HDF5
default-features GDAL_USE_ICONV
default-features GDAL_USE_JPEG
core GDAL_USE_JSONC
lerc GDAL_USE_LERC
libkml GDAL_USE_LIBKML # TODO, needs policy patches to FindLibKML.cmake
default-features GDAL_USE_LIBLZMA
default-features GDAL_USE_LIBXML2
mysql-libmariadb GDAL_USE_MYSQL
netcdf GDAL_USE_NETCDF
odbc GDAL_USE_ODBC
default-features GDAL_USE_OPENJPEG
default-features GDAL_USE_OPENSSL
default-features GDAL_USE_PCRE2
default-features GDAL_USE_PNG
poppler GDAL_USE_POPPLER
postgresql GDAL_USE_POSTGRESQL
default-features GDAL_USE_QHULL
#core GDAL_USE_SHAPELIB # https://github.com/OSGeo/gdal/issues/5711, https://github.com/microsoft/vcpkg/issues/16041
core GDAL_USE_SHAPELIB_INTERNAL
libspatialite GDAL_USE_SPATIALITE
recommended-features GDAL_USE_SQLITE3
core GDAL_USE_TIFF
default-features GDAL_USE_WEBP
core GDAL_USE_ZLIB
default-features GDAL_USE_ZSTD
)
if(GDAL_USE_ICONV AND VCPKG_TARGET_IS_WINDOWS)
list(APPEND FEATURE_OPTIONS -D_ICONV_SECOND_ARGUMENT_IS_NOT_CONST=ON)
endif()
string(COMPARE NOTEQUAL "${NMAKE_OPTIONS}" "" NMAKE_BUILD)
set(GDAL_EXTRA_LIBS_DEBUG "")
set(GDAL_EXTRA_LIBS_RELEASE "")
foreach(prefix IN LISTS extra_exports)
string(REPLACE "${CURRENT_INSTALLED_DIR}/" "\${CMAKE_CURRENT_LIST_DIR}/../../" libs "${${prefix}_LIBS_DEBUG}")
string(APPEND GDAL_EXTRA_LIBS_DEBUG " ${libs}")
string(REPLACE "${CURRENT_INSTALLED_DIR}/" "\${CMAKE_CURRENT_LIST_DIR}/../../" libs "${${prefix}_LIBS_RELEASE}")
string(APPEND GDAL_EXTRA_LIBS_RELEASE " ${libs}")
endforeach()
string(REPLACE "/lib/pkgconfig/../.." "" GDAL_EXTRA_LIBS_DEBUG "${GDAL_EXTRA_LIBS_DEBUG}")
string(REPLACE "/lib/pkgconfig/../.." "" GDAL_EXTRA_LIBS_RELEASE "${GDAL_EXTRA_LIBS_RELEASE}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS_RELEASE
FEATURES
tools BUILD_APPS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_DOCS=OFF
-DBUILD_PYTHON_BINDINGS=OFF
-DBUILD_TESTING=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_CSharp=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Java=ON
-DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON
-DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
-DCMAKE_DISABLE_FIND_PACKAGE_SWIG=ON
-DGDAL_USE_INTERNAL_LIBS=OFF
-DGDAL_USE_EXTERNAL_LIBS=OFF
-DGDAL_BUILD_OPTIONAL_DRIVERS=ON
-DOGR_BUILD_OPTIONAL_DRIVERS=ON
-DGDAL_CHECK_PACKAGE_NetCDF_NAMES=netCDF
-DGDAL_CHECK_PACKAGE_NetCDF_TARGETS=netCDF::netcdf
OPTIONS_RELEASE
${FEATURE_OPTIONS_RELEASE}
OPTIONS_DEBUG
-DBUILD_APPS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/gdal)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/gdal/GDALConfig.cmake"
"include(CMakeFindDependencyMacro)"
"include(CMakeFindDependencyMacro)
# gdal needs a pkg-config tool. A host dependency provides pkgconf.
get_filename_component(vcpkg_host_prefix \"\${CMAKE_CURRENT_LIST_DIR}/../../../${HOST_TRIPLET}\" ABSOLUTE)
list(APPEND CMAKE_PROGRAM_PATH \"\${vcpkg_host_prefix}/tools/pkgconf\")"
)
if (BUILD_APPS)
vcpkg_copy_tools(
TOOL_NAMES
gdalinfo
gdalbuildvrt
gdaladdo
gdal_grid
gdal_translate
gdal_rasterize
gdalsrsinfo
gdalenhance
gdalmanage
gdaltransform
gdaltindex
gdaldem
gdal_create
gdal_viewshed
nearblack
ogrlineref
ogrtindex
gdalwarp
gdal_contour
gdallocationinfo
ogrinfo
ogr2ogr
ogrlineref
nearblack
gdalmdiminfo
gdalmdimtranslate
gnmanalyse
gnmmanage
AUTO_CLEAN
)
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
file(GLOB bin_files "${CURRENT_PACKAGES_DIR}/bin/*")
list(REMOVE_ITEM bin_files "${CURRENT_PACKAGES_DIR}/bin/gdal-config")
if(NOT bin_files)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/bin"
"${CURRENT_PACKAGES_DIR}/debug/bin"
)
endif()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/gdal/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,5 +1,4 @@
The package GDAL provides CMake targets:
find_package(GDAL REQUIRED)
target_include_directories(main PRIVATE ${GDAL_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${GDAL_LIBRARIES})
find_package(GDAL CONFIG REQUIRED)
target_link_libraries(main PRIVATE GDAL::GDAL)

View File

@ -1,151 +1,23 @@
include(SelectLibraryConfigurations)
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
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)
if(NOT GDAL_INCLUDE_DIR OR NOT GDAL_LIBRARY)
message(FATAL_ERROR "Installation of vcpkg port gdal is broken.")
list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE")
list(APPEND ARGS "CONFIG")
# The current port version should satisfy GDAL 3.0 ... 3.5
list(GET ARGS 1 vcpkg_gdal_maybe_version)
if(vcpkg_gdal_maybe_version MATCHES "(^3\$|^3[.][0-5])")
list(REMOVE_AT ARGS "1")
endif()
set(GDAL_LIBRARY "${GDAL_LIBRARY}" CACHE STRING "")
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
set_property(TARGET GDAL::GDAL APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${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()
message(WARNING "Could not find package ${package}")
set(GDAL_FOUND false PARENT_SCOPE)
endif()
endfunction()
function(z_vcpkg_gdal_add_libs keyword config)
set(gdal_deps_target "unofficial::gdal::deps::${keyword}")
if(NOT TARGET "${gdal_deps_target}")
add_library("${gdal_deps_target}" INTERFACE IMPORTED)
if(TARGET GDAL::GDAL) # CMake 3.14
set_property(TARGET GDAL::GDAL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<CONFIG:${config}>:${gdal_deps_target}>")
endif()
if(NOT GDAL_LIBRARIES STREQUAL "GDAL::GDAL")
set(GDAL_LIBRARIES "${GDAL_LIBRARIES};${keyword};${gdal_deps_target}" PARENT_SCOPE)
endif()
endif()
# The Ninja build system stumbles over '/libpath:` in INTERFACE_LINK_LIBRARIES.
set(lib_paths "${ARGN}")
list(REMOVE_DUPLICATES lib_paths) # For lib paths, late duplicates are redundant.
foreach(item IN LISTS lib_paths)
# INTERFACE_LINK_OPTIONS needs CMake 3.13. There is no direct alternative for older versions.
if(item MATCHES "^/libpath:(.*)|^-L")
set_property(TARGET "${gdal_deps_target}" APPEND PROPERTY INTERFACE_LINK_OPTIONS "${item}")
list(REMOVE_ITEM ARGN "${item}")
endif()
endforeach()
foreach(item IN LISTS ARGN)
get_property(libs TARGET "${gdal_deps_target}" PROPERTY INTERFACE_LINK_LIBRARIES)
if(item MATCHES "^-l|-pthread")
list(REMOVE_ITEM libs "${item}") # For libs, early duplicates are normally redundant.
endif()
list(APPEND libs "${item}")
set_property(TARGET "${gdal_deps_target}" PROPERTY INTERFACE_LINK_LIBRARIES "${libs}")
endforeach()
endfunction()
unset(vcpkg_gdal_maybe_version)
_find_package(${ARGS} CONFIG)
if(GDAL_FOUND)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
set(Z_VCPKG_PORT_FEATURES "@FEATURES@")
if("cfitsio" IN_LIST Z_VCPKG_PORT_FEATURES)
_gdal_add_dependency(cfitsio unofficial-cfitsio CONFIG)
endif()
_gdal_add_dependency(CURL::libcurl CURL CONFIG)
_gdal_add_dependency(expat::expat expat CONFIG)
_gdal_add_dependency(GEOS::geos_c geos CONFIG)
if(NOT "@NMAKE_BUILD@")
_gdal_add_dependency(GIF::GIF GIF)
endif()
if("hdf5" IN_LIST Z_VCPKG_PORT_FEATURES)
_gdal_add_dependency(hdf5::hdf5 hdf5 CONFIG)
endif()
if(NOT "@NMAKE_BUILD@")
_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)
_gdal_add_dependency(png libpng CONFIG)
if("poppler" IN_LIST Z_VCPKG_PORT_FEATURES)
_gdal_add_dependency(unofficial::poppler::poppler-private unofficial-poppler)
endif()
if("postgresql" IN_LIST Z_VCPKG_PORT_FEATURES)
_gdal_add_dependency(PostgreSQL::PostgreSQL PostgreSQL)
endif()
_gdal_add_dependency(WebP::webp WebP CONFIG)
_gdal_add_dependency(LibXml2::LibXml2 LibXml2)
if("netcdf" IN_LIST Z_VCPKG_PORT_FEATURES)
_gdal_add_dependency(netCDF::netcdf netCDF CONFIG)
endif()
_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)
z_vcpkg_gdal_add_libs(optimized Release @GDAL_EXTRA_LIBS_RELEASE@)
z_vcpkg_gdal_add_libs(debug Debug @GDAL_EXTRA_LIBS_DEBUG@)
list(FIND ARGS "REQUIRED" required)
if(NOT GDAL_FOUND AND NOT required EQUAL "-1")
message(FATAL_ERROR "Failed to find dependencies of GDAL")
endif()
unset(Z_VCPKG_PORT_FEATURES)
cmake_policy(POP)
get_filename_component(vcpkg_gdal_prefix "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
set(GDAL_INCLUDE_DIR "${vcpkg_gdal_prefix}/include" CACHE INTERNAL "")
set(GDAL_INCLUDE_DIRS "${GDAL_INCLUDE_DIR}")
set(GDAL_LIBRARY GDAL::GDAL CACHE INTERNAL "")
set(GDAL_LIBRARIES "${GDAL_LIBRARY}")
unset(vcpkg_gdal_prefix)
endif()
cmake_policy(POP)

View File

@ -1,45 +1,35 @@
{
"name": "gdal",
"version-semver": "3.4.3",
"port-version": 3,
"version-semver": "3.5.1",
"description": "The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data",
"homepage": "https://gdal.org",
"license": null,
"supports": "!uwp",
"dependencies": [
"curl",
"expat",
"geos",
{
"name": "giflib",
"platform": "!windows | mingw"
},
{
"name": "json-c",
"platform": "!windows | mingw"
},
"json-c",
"libgeotiff",
{
"name": "libiconv",
"platform": "windows & !mingw"
"name": "pkgconf",
"host": true
},
"libjpeg-turbo",
"liblzma",
"libpng",
"libwebp",
"libxml2",
"openjpeg",
"proj",
"sqlite3",
"tiff",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
},
"zlib",
"zstd"
"zlib"
],
"default-features": [
"supported-default-features"
"default-features"
],
"features": {
"aws-ec2-windows": {
@ -54,10 +44,85 @@
"cfitsio"
]
},
"curl": {
"description": "Enable CURL network support",
"dependencies": [
{
"name": "curl",
"default-features": false
}
]
},
"default-features": {
"description": "Default set of features, including recommended features",
"dependencies": [
"expat",
{
"name": "gdal",
"default-features": false,
"features": [
"curl",
"geos",
"libspatialite",
"recommended-features"
]
},
{
"name": "gdal",
"default-features": false,
"features": [
"postgresql"
],
"platform": "!uwp"
},
{
"name": "gdal",
"default-features": false,
"features": [
"hdf5",
"netcdf"
],
"platform": "!uwp & !(windows & arm64) & !android"
},
"giflib",
"libiconv",
"libjpeg-turbo",
"liblzma",
"libpng",
"libwebp",
"libxml2",
"openjpeg",
"openssl",
"pcre2",
"qhull",
"zstd"
]
},
"freexl": {
"description": "Enable FREEXL support",
"dependencies": [
"freexl"
]
},
"geos": {
"description": "Enable GEOS support",
"dependencies": [
"geos"
]
},
"hdf5": {
"description": "Enable HDF5 support",
"dependencies": [
"hdf5"
{
"name": "hdf5",
"default-features": false
}
]
},
"lerc": {
"description": "Enable LERC support",
"dependencies": [
"lerc"
]
},
"libspatialite": {
@ -75,11 +140,14 @@
"netcdf": {
"description": "Enable NetCDF support",
"dependencies": [
"netcdf-c"
{
"name": "netcdf-c",
"default-features": false
}
]
},
"poppler": {
"description": "Enable poppler support",
"description": "Enable PDF reading support via poppler",
"dependencies": [
{
"name": "poppler",
@ -96,30 +164,32 @@
"libpq"
]
},
"recommended-features": {
"description": "Features that are explicity marked as recommended by GDAL.",
"dependencies": [
"expat",
{
"name": "sqlite3",
"features": [
"rtree"
]
}
]
},
"supported-default-features": {
"description": "Default set of features, dependent on platform",
"description": "This feature is an alias for default-features. It is retained for compatibility.",
"dependencies": [
{
"name": "gdal",
"default-features": false,
"features": [
"postgresql"
],
"platform": "!uwp"
},
{
"name": "gdal",
"default-features": false,
"features": [
"hdf5",
"netcdf"
],
"platform": "!uwp & !(windows & arm64)"
"default-features"
]
}
]
},
"system-libraries": {
"description": "Include drivers which need additional libraries"
"$supports": "!windows",
"description": "This feature does nothing. It is retained for compatibility."
},
"tools": {
"description": "Builds gdal and ogr executables"

View File

@ -7,6 +7,7 @@ vcpkg_from_github(
PATCHES
cmakelists.patch
skip-doc-install.patch
public-dependencies.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS

View File

@ -0,0 +1,47 @@
diff --git a/libgeotiff/CMakeLists.txt b/libgeotiff/CMakeLists.txt
index 1840258..fcf2dd0 100644
--- a/libgeotiff/CMakeLists.txt
+++ b/libgeotiff/CMakeLists.txt
@@ -311,17 +311,18 @@ endif()
SET_TARGET_PROPERTIES(${GEOTIFF_LIBRARY_TARGET} PROPERTIES
OUTPUT_NAME ${GEOTIFF_LIB_NAME})
-set(CONFIG_DEPENDENCIES "")
+set(CONFIG_PUBLIC_DEPENDENCIES "")
+set(CONFIG_PRIVATE_DEPENDENCIES "")
if(TARGET TIFF::TIFF)
set(TIFF_LIBRARIES TIFF::TIFF)
- string(APPEND CONFIG_DEPENDENCIES " find_dependency(TIFF)\n")
+ string(APPEND CONFIG_PUBLIC_DEPENDENCIES "find_dependency(TIFF)\n")
endif()
target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PUBLIC
${TIFF_LIBRARIES})
if(TARGET PROJ::proj)
set(PROJ_LIBRARIES PROJ::proj)
- string(APPEND CONFIG_DEPENDENCIES " find_dependency(PROJ CONFIG)\n")
+ string(APPEND CONFIG_PRIVATE_DEPENDENCIES " find_dependency(PROJ CONFIG)\n")
endif()
target_link_libraries(${GEOTIFF_LIBRARY_TARGET} PRIVATE
${PROJ_LIBRARIES})
diff --git a/libgeotiff/cmake/project-config.cmake.in b/libgeotiff/cmake/project-config.cmake.in
index 3690489..87de991 100644
--- a/libgeotiff/cmake/project-config.cmake.in
+++ b/libgeotiff/cmake/project-config.cmake.in
@@ -22,13 +22,14 @@ set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/bin")
unset (_ROOT)
unset (_DIR)
+include(CMakeFindDependencyMacro)
+@CONFIG_PUBLIC_DEPENDENCIES@
set (@PROJECT_NAME@_LIBRARIES @GEOTIFF_LIBRARY_TARGET@)
if("@BUILD_SHARED_LIBS@")
set (@PROJECT_NAME@_SHARED_LIBRARIES ${@PROJECT_NAME@_LIBRARIES})
else()
set (@PROJECT_NAME@_STATIC_LIBRARIES ${@PROJECT_NAME@_LIBRARIES})
- include(CMakeFindDependencyMacro)
-@CONFIG_DEPENDENCIES@
+@CONFIG_PRIVATE_DEPENDENCIES@
endif()
if(NOT @PROJECT_NAME@_FIND_QUIETLY)

View File

@ -1,6 +1,7 @@
{
"name": "libgeotiff",
"version": "1.7.1",
"port-version": 1,
"description": "Libgeotiff is an open source library on top of libtiff for reading and writing GeoTIFF information tags.",
"homepage": "https://github.com/OSGeo/libgeotiff",
"license": "MIT",

View File

@ -2465,8 +2465,8 @@
"port-version": 0
},
"gdal": {
"baseline": "3.4.3",
"port-version": 3
"baseline": "3.5.1",
"port-version": 0
},
"gdcm": {
"baseline": "3.0.12",
@ -3630,7 +3630,7 @@
},
"libgeotiff": {
"baseline": "1.7.1",
"port-version": 0
"port-version": 1
},
"libgit2": {
"baseline": "1.4.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "f623db2a0771ad4df6c248b046cd8f369ecbdcca",
"version-semver": "3.5.1",
"port-version": 0
},
{
"git-tree": "cf1b59dd5a8518c4003a7d23d0db857315af0db9",
"version-semver": "3.4.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "aa303b0481fcc35024bae8af620ab2271ca9b5b2",
"version": "1.7.1",
"port-version": 1
},
{
"git-tree": "5f9baab006dd2bd507b6b8f63d2226dc6ce97cd1",
"version": "1.7.1",