Skip to content

Commit

Permalink
Cargo: only depend on criterion when building benchmarks
Browse files Browse the repository at this point in the history
This is a bit of a hack as it requires setting `--features bench` when
invoking `cargo bench`, but it allows us to avoid pulling in criterion
when building tests and examples, which reduces the number of
dependencies for those build in half.
  • Loading branch information
ghedo committed Feb 10, 2020
1 parent 464d8e7 commit 4100cec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ fuzzing = []
# For building with Android NDK < 18 and GCC.
ndk-old-gcc = []

# Build benchmarks. This is intended to make benchmark-specific dependencies
# optional, so we don't have to build them for other targets.
bench = ["criterion"]

[package.metadata.docs.rs]
default-features = false

Expand All @@ -56,6 +60,7 @@ cmake = "0.1"
log = { version = "0.4", features = ["std"] }
libc = "0.2"
ring = "0.16"
criterion = { version = "0.3", optional = true }
lazy_static = "1"

[target."cfg(windows)".dependencies]
Expand All @@ -65,7 +70,6 @@ winapi = { version = "0.3", features = ["wincrypt"] }
mio = "0.6"
url = "1"
docopt = "1"
criterion = "0.3"
env_logger = "0.6"

[profile.bench]
Expand All @@ -80,3 +84,4 @@ crate-type = ["lib", "staticlib", "cdylib"]
[[bench]]
name = "benches"
harness = false
required-features = ["bench"]

0 comments on commit 4100cec

Please sign in to comment.