Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GDAL] Use NetCDF and HDF5 when available. #5466

Merged
merged 4 commits into from
Sep 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 47 additions & 19 deletions G/GDAL/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using BinaryBuilder, Pkg

name = "GDAL"
upstream_version = v"3.5.1"
version_offset = v"0.0.1"
version_offset = v"0.0.2"
version = VersionNumber(upstream_version.major * 100 + version_offset.major,
upstream_version.minor * 100 + version_offset.minor,
upstream_version.patch * 100 + version_offset.patch)
Expand All @@ -28,25 +28,41 @@ if [[ "${target}" == *-freebsd* ]]; then
export LDFLAGS="-undefined"
fi

cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_PREFIX_PATH=${prefix} \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_PYTHON_BINDINGS=OFF \
-DBUILD_JAVA_BINDINGS=OFF \
-DBUILD_CSHARP_BINDINGS=OFF \
-DGDAL_USE_CURL=ON \
-DGDAL_USE_EXPAT=ON \
-DGDAL_USE_GEOTIFF=ON \
-DGDAL_USE_GEOS=ON \
-DGDAL_USE_OPENJPEG=ON \
-DGDAL_USE_SQLITE3=ON \
-DGDAL_USE_TIFF=ON \
-DGDAL_USE_ZLIB=ON \
-DGDAL_USE_ZSTD=ON \
..
CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=${prefix}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}
-DCMAKE_PREFIX_PATH=${prefix}
-DCMAKE_FIND_ROOT_PATH=${prefix}
-DCMAKE_BUILD_TYPE=Release
-DBUILD_PYTHON_BINDINGS=OFF
-DBUILD_JAVA_BINDINGS=OFF
-DBUILD_CSHARP_BINDINGS=OFF
-DGDAL_USE_CURL=ON
-DGDAL_USE_EXPAT=ON
-DGDAL_USE_GEOTIFF=ON
-DGDAL_USE_GEOS=ON
-DGDAL_USE_OPENJPEG=ON
-DGDAL_USE_SQLITE3=ON
-DGDAL_USE_TIFF=ON
-DGDAL_USE_ZLIB=ON
-DGDAL_USE_ZSTD=ON)

# NetCDF is the most restrictive dependency as far as platform availability, so we'll use it where applicable but disable it otherwise
if ! find ${libdir} -name "libnetcdf*.${dlext}" -exec false '{}' +; then
CMAKE_FLAGS+=(-DGDAL_USE_NETCDF=ON)
else
echo "Disabling NetCDF support"
CMAKE_FLAGS+=(-DGDAL_USE_NETCDF=OFF)
fi

# HDF5 is also a restrictive dependency as far as platform availability, so we'll use it where applicable but disable it otherwise
if ! find ${libdir} -name "libhdf5*.${dlext}" -exec false '{}' +; then
CMAKE_FLAGS+=(-DGDAL_USE_HDF5=ON)
else
echo "Disabling HDF5 support"
CMAKE_FLAGS+=(-DGDAL_USE_HDF5=OFF)
fi

cmake .. ${CMAKE_FLAGS[@]}
cmake --build . -j${nproc}
cmake --build . -j${nproc} --target install
"""
Expand Down Expand Up @@ -79,6 +95,16 @@ products = [
ExecutableProduct("ogrtindex", :ogrtindex_path),
]

hdf5_platforms = [
Platform("x86_64", "linux"),
Platform("aarch64", "linux"; libc="glibc"),
Platform("x86_64", "macos"),
Platform("x86_64", "windows"),
Platform("i686", "windows"),
Platform("aarch64", "macos"),
]
hdf5_platforms = expand_cxxstring_abis(hdf5_platforms)

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("GEOS_jll"; compat="~3.11"),
Expand All @@ -91,6 +117,8 @@ dependencies = [
Dependency("Libtiff_jll"; compat="4.3"),
Dependency("libgeotiff_jll"; compat="100.700.100"),
Dependency("LibCURL_jll"; compat="7.73"),
Dependency("NetCDF_jll"; compat="400.902.5", platforms=hdf5_platforms),
Dependency("HDF5_jll"; platforms=hdf5_platforms),
]

# Build the tarballs, and possibly a `build.jl` as well.
Expand Down