Skip to content

Commit 1d1a3e9

Browse files
committed
Put bindgen behind a seperate feature
This commit changes proj-sys to not depend on bindgen by default as that introduces a quite heavy build time dependency (libclang) which might not be there on all systems. Instead bundled bindings for the proj version build by the `bundled_proj` feature are provided.
1 parent 4a0e203 commit 1d1a3e9

File tree

5 files changed

+4920
-3
lines changed

5 files changed

+4920
-3
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
- Update to proj-sys 0.24.0 (libproj 9.4.0)
5+
- Provide bundled bindings by default and move support for build time generated bindings behind the `buildtime_bindgen` feature of proj-sys
56
- Bump MSRV to 1.65
67

78
## 0.27.2

proj-sys/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ libsqlite3-sys = "0.28"
1616
link-cplusplus = "1.0"
1717

1818
[build-dependencies]
19-
bindgen = "0.68.1"
19+
bindgen = { version = "0.68.1", optional = true }
2020
pkg-config = "0.3.25"
2121
cmake = "0.1.50"
2222
flate2 = "1.0.24"
@@ -29,6 +29,7 @@ bundled_proj = []
2929
pkg_config = []
3030
network = ["tiff"]
3131
tiff = []
32+
buildtime_bindgen = ["dep:bindgen"]
3233

3334
[package.metadata.docs.rs]
3435
features = [ "nobuild" ] # This feature will be enabled during the docs.rs build

proj-sys/build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4646
})?
4747
};
4848

49+
#[cfg(feature = "buildtime_bindgen")]
50+
generate_bindings(include_path)?;
51+
#[cfg(not(feature = "buildtime_bindgen"))]
52+
let _ = include_path;
53+
54+
Ok(())
55+
}
56+
57+
#[cfg(feature = "buildtime_bindgen")]
58+
fn generate_bindings(include_path: std::path::PathBuf) -> Result<(), Box<dyn std::error::Error>> {
4959
// The bindgen::Builder is the main entry point
5060
// to bindgen, and lets you build up options for
5161
// the resulting bindings.

0 commit comments

Comments
 (0)