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

Make clap optional for build scripts #31

Open
RazrFalcon opened this issue Jul 22, 2017 · 4 comments
Open

Make clap optional for build scripts #31

RazrFalcon opened this issue Jul 22, 2017 · 4 comments

Comments

@RazrFalcon
Copy link
Contributor

There is no need in clap when we use cbindgen in a build script.

@eqrion
Copy link
Collaborator

eqrion commented Jul 22, 2017

I'd like to do this too. rust-bindgen has the same problem.

Unfortunately - rust-lang/cargo#1982

@RazrFalcon
Copy link
Contributor Author

You can use features for this.

@eqrion eqrion changed the title Make 'clap' optional Make clap optional for build scripts Aug 18, 2018
@eqrion
Copy link
Collaborator

eqrion commented Aug 18, 2018

Was able to find a potential workaround here for the cargo issue.

[[bin]]
name = "mybinary"
path = "src/main.rs"
required-features = ["binaries"]

[dependencies]
docopt = { version = "0.8.1", optional = true }

[features]
binaries = ["docopt"]

Unfortunately that would require all users to install the cbindgen binary with cargo install cbindgen --features=binary or else they'll get a 'descriptive' error. This could be okay.

@micahsnyder
Copy link

Looks like this was already done, here: 6748b78

And you can disable building with clap by disabling the default features. E.g. this in your own Cargo.toml:
cbindgen = { version ="0.25", default-features = false }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants