Skip to content

Commit 194dab4

Browse files
author
Brandon Lumbra
committed
Added 'utilities' feature to reduce lib dependencies
1 parent e30f05b commit 194dab4

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Cargo.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,25 @@ Linux Industrial I/O (IIO) Support
1616
libiio-sys = { version = "0.3", path = "libiio-sys" }
1717
thiserror = "1.0"
1818
nix = "0.23"
19-
clap = "2.34"
19+
clap = { version = "2.34", optional = true }
2020

2121
[dev-dependencies]
2222
schedule_recv = "0.1"
2323
chrono = "0.4"
2424
ctrlc = "3.2"
2525
anyhow = "1.0"
26+
clap = "2.34"
27+
28+
[features]
29+
default = ["utilities"]
30+
utilities = ["clap"]
31+
32+
# ----- Utilities -----
33+
34+
[[bin]]
35+
name = "iio_info_rs"
36+
required-features = ["utilities"]
37+
38+
[[bin]]
39+
name = "riio_stop_all"
40+
required-features = ["utilities"]

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ To keep up with the latest announcements for this project, follow:
4646
### Unreleased Features in This Branch
4747

4848
- [#21](https://github.com/fpagliughi/rust-industrial-io/issues/21) Updated the nix dependency to the latest verison (v0.23)
49+
- Create separate on-by-default 'utilities' feature to reduce dependencies for lib-only builds
4950

5051
### New in Version 0.5.1
5152

@@ -241,12 +242,18 @@ $ iiod --version
241242

242243
## Build the Rust Crate
243244

244-
This is a fairly standard Rust wrapper project around a C library. It contains an unsafe _"-sys"_ sub-crate to wrap the C library API, and a higher-level, safe, Rust library in the main crate. To build them:
245+
This is a fairly standard Rust wrapper project around a C library. It contains an unsafe _"-sys"_ sub-crate to wrap the C library API, and a higher-level, safe, Rust library in the main crate. The crate also contains utilities that interface with IIO devices via the library. To build the library and utilities:
245246

246247
```
247248
$ cargo build
248249
```
249250

251+
The library can be built with fewer dependencies. To build just the library:
252+
253+
```
254+
$ cargo build --lib --no-default-features
255+
```
256+
250257
There are also a number of example applications. They can all be built with:
251258

252259
```

0 commit comments

Comments
 (0)