-
Notifications
You must be signed in to change notification settings - Fork 6
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 new c-bindings
feature flag
#6
Conversation
Feature optionally enables building the c bindings. It is off by default.
Not really, because AFAICS the bindings are already checked into the repo and bundled with the crate. Also, the name of the generated file was changed in 8bf7a42 since the last release, so the next release will be breaking for anyone using C bindings anyway 🤷 Unless I'm missing something, there's no reason not to disable binding generation by default. |
Note after some digging it looks like our internal build issues were caused by some unexpected behavior in the |
fn main() { | ||
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
#[cfg(feature = "c-bindings")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't build scripts need to use CARGO_FEATURE_<name>
env var? https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought that, but this SO question clarified (and this worked locally for me). It doesn't seem to be documented anywhere that I could find.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. Good to know. Thanks!
How about:
|
@jrandolf I gave it a try in #9, I will leave it to the maintainers to decide what option they prefer. |
The implementation in #9 is better, imho, and has been merged in https://github.com/awesomized/crc64fast-nvme/releases/tag/1.2.0. Thanks all! |
The c bindings generated in
build.rs
were causing issues for some sandboxed builds. This PR introduces a new feature flagc-bindings
that allows building those bindings to be opted in to. It is off by default. This would technically be a breaking change for anyone using the c bindings, so we could instead make it a default feature that can be disabled if that is a worry.