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

Drop pre-3.0 GDAL support #504

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

## Unreleased

- **Breaking**: Drop support for GDAL 2.x

- <https://github.com/georust/gdal/pull/504>

- Added `Feature::unset_field`

- <https://github.com/georust/gdal/pull/503>

- Added ability to convert between `Buffer<T>` and `ndarray::Array2<T>`.
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Documentation](https://docs.rs/gdal/badge.svg)](https://docs.rs/gdal)
![Build Status](https://github.com/georust/gdal/workflows/CI/badge.svg)

[GDAL](http://gdal.org/) is a translator and processing library for various raster and vector geospatial data formats.
[GDAL](http://gdal.org/) is a translator and processing library for various raster and vector geospatial data formats.

This crate provides safe, idiomatic [Rust](http://www.rust-lang.org/) bindings for GDAL.

Expand All @@ -20,9 +20,9 @@ GDAL is an incredibly powerful library. For a general understanding of its capab

## Documentation

This crate's [API documentation](https://docs.rs/crate/gdal) is hosted on [docs.rs](https://docs.rs).
This crate's [API documentation](https://docs.rs/crate/gdal) is hosted on [docs.rs](https://docs.rs).

The Rust documentation is currently a work in progress, and may not cover requisite details on parameter semantics, value interpretation, etc.
The Rust documentation is currently a work in progress, and may not cover requisite details on parameter semantics, value interpretation, etc.
Therefore, the authoritative documentation is that of GDAL in the form of its [C](https://gdal.org/api/index.html#c-api) and [C++](https://gdal.org/api/index.html#id3) APIs.
The former is technically what this crate calls, but the latter is usually more clear and better documented.

Expand All @@ -32,17 +32,22 @@ This crate provides high-level, idiomatic Rust bindings for GDAL.
To do that, it uses [`gdal-sys`](gdal-sys) internally, a low-level interface to the GDAL C library, which is generated using [`bindgen`](https://rust-lang.github.io/rust-bindgen/).
Using the `gdal-sys` crate directly is normally not needed, but it can be useful in order to call APIs that have not yet been exposed in `gdal`.

## Version support

As a general rule, only GDAL versions in Ubuntu LTS-1 (previous LTS version, that is, GDAL 3.0 in 20.04 at this moment) are supported.
`gdal-sys` might support earlier versions using the `bindgen` feature flag, but `gdal` does not.

Building this crate assumes a compatible version of GDAL is installed with the corresponding header files and shared libraries.
This repository includes pre-generated bindings for GDAL 2.4 through 3.6 (see the`gdal-sys/prebuilt-bindings` directory).
If you're compiling against a later version of GDAL, you can enable the `bindgen` feature flag to have new bindings generated on the fly.
This repository includes pre-generated bindings for GDAL 3.0 through 3.8 (see the`gdal-sys/prebuilt-bindings` directory).
If you're compiling against another version of GDAL, you can enable the `bindgen` feature flag to have the bindings generated on the fly.

## Community

This crate is part of the expansive (and expanding!) [`georust`](https://georust.org/) organization. Come join our discussions on [Discord](https://discord.gg/Fp2aape)!

## Contributing

This crate continues to evolve, and PRs are welcome. Make sure you are comfortable with the [Code of Conduct](CODE_OF_CONDUCT.md) and [License](LICENSE.txt) before submitting a PR.
This crate continues to evolve, and PRs are always welcome. Make sure you are comfortable with the [Code of Conduct](CODE_OF_CONDUCT.md) and [License](LICENSE.txt) before submitting a PR.

## License

Expand Down
13 changes: 3 additions & 10 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,21 @@ fn main() {
let minor = (gdal_version - major * 1000000) / 10000;
let patch = (gdal_version - major * 1000000 - minor * 10000) / 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that line calculating patch still needed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still printed in the panic message below, just in case. Probably doesn't hurt to have it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, nevermind, I missed that use


if major < 2 {
panic!("The GDAL crate requires a GDAL version >= 2.0.0. Found {major}.{minor}.{patch}");
if major < 3 {
panic!("The GDAL crate requires a GDAL version >= 3.0.0. Found {major}.{minor}.{patch}");
}

println!("cargo:rustc-cfg=gdal_{major}");
println!("cargo:rustc-cfg=gdal_{major}_{minor}");
println!("cargo:rustc-cfg=gdal_{major}_{minor}_{patch}");

println!("cargo:rustc-cfg=major_is_{major}");
println!("cargo:rustc-cfg=minor_is_{minor}");
println!("cargo:rustc-cfg=patch_is_{patch}");

// we only support GDAL >= 2.0.
for major in 2..=major {
for major in 3..=major {
println!("cargo:rustc-cfg=major_ge_{major}");
}

for minor in 0..=minor {
println!("cargo:rustc-cfg=minor_ge_{minor}");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never care about the patch version, so I think it's fine to emitting all those cfgs for it.

for patch in 0..=patch {
println!("cargo:rustc-cfg=patch_ge_{patch}");
}
}
Loading