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

Add feature to configure building with TIFF support. #58

Merged
merged 3 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- "--features \"network bundled_proj\""
- "--features \"network geo-types\""
- "--features \"bundled_proj geo-types\""
- "--features \"bundled_proj tiff\""
- "--features \"network bundled_proj geo-types\""
container:
image: georust/proj-ci:latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ members = ["proj-sys"]

[features]
bundled_proj = [ "proj-sys/bundled_proj" ]
tiff = [ "proj-sys/tiff" ]
pkg_config = [ "proj-sys/pkg_config" ]
network = ["reqwest"]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
network = ["reqwest"]
network = ["reqwest", "tiff"]

Since the network grid requires tiff, maybe like this?


Expand Down
1 change: 1 addition & 0 deletions proj-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ nobuild = []
bundled_proj = []
# `pkg_config` feature is deprecated and does nothing
pkg_config = []
tiff = []

[package.metadata.docs.rs]
features = [ "nobuild" ] # This feature will be enabled during the docs.rs build
13 changes: 8 additions & 5 deletions proj-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ libproj from source bundled in the crate.

## Features

`bundled_proj` - forces building libproj from source even if an acceptable
version could be found on your system. Note that SQLite3 and `libtiff` must be
present on your system if you wish to use this feature, and that it builds
`libproj` **without** its native network functionality; you will have to
implement your own set of callbacks if you wish to make use of them (see the
- `bundled_proj` - forces building libproj from source even if an acceptable
version could be found on your system. Note that SQLite3 must be
present on your system if you wish to use this feature, and that it builds
`libproj` **without** its native network functionality; you will have to
implement your own set of callbacks if you wish to make use of them (see the
[`proj`](https://crates.io/crates/proj) crate for an example).
- `tiff` - If the `bundled_proj` feature is enabled, adding the `tiff` feature
will build PROJ with TIFF support. Note that libtiff must be present on your
system if you wish to use this feature.

## License

Expand Down
7 changes: 5 additions & 2 deletions proj-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
config.define("BUILD_PROJINFO", "OFF");
config.define("BUILD_PROJSYNC", "OFF");
config.define("ENABLE_CURL", "OFF");
config.define("ENABLE_TIFF", "ON");
let tiff_support = cfg!(feature = "tiff");
config.define("ENABLE_TIFF", if tiff_support { "ON" } else { "OFF" });
let proj = config.build();
// Tell cargo to tell rustc to link libproj, and where to find it
// libproj will be built in $OUT_DIR/lib
Expand All @@ -114,7 +115,9 @@ fn build_from_source() -> Result<std::path::PathBuf, Box<dyn std::error::Error>>
);
// The PROJ library needs SQLite and the C++ standard library.
println!("cargo:rustc-link-lib=dylib=sqlite3");
println!("cargo:rustc-link-lib=dylib=tiff");
if tiff_support {
println!("cargo:rustc-link-lib=dylib=tiff");
}
if cfg!(target_os = "linux") {
println!("cargo:rustc-link-lib=dylib=stdc++");
} else if cfg!(target_os = "macos") {
Expand Down