Try to make v4l optional when compiling lib only

This commit is contained in:
Ruben van de Ven 2020-09-24 09:08:21 +02:00
parent 7de5440484
commit 928da82d24
2 changed files with 5 additions and 5 deletions

View file

@ -4,11 +4,14 @@ version = "0.1.0"
authors = ["Ruben van de Ven <git@rubenvandeven.com>"] authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
build-binary = ["v4l"]
[[bin]] [[bin]]
name = "visual_haarcascades" name = "visual_haarcascades"
path = "src/main.rs" path = "src/main.rs"
required-features = ["build-binary"] # https://stackoverflow.com/a/46017284
[[bin]] [[bin]]
name = "visual_haarcascades_test" name = "visual_haarcascades_test"
@ -22,7 +25,7 @@ crate-type = ["dylib"]
[dependencies] [dependencies]
nannou = "0.14" nannou = "0.14"
# clang-sys = "0.29.3" # clang-sys = "0.29.3"
v4l = {version = "0.5.1", features = ["libv4l"]} v4l = {version = "0.5.1", features = ["libv4l"], optional = true}
image = "0.23" image = "0.23"
log = "0.4" log = "0.4"
xml-rs = "0.8.3" xml-rs = "0.8.3"

View file

@ -5,7 +5,6 @@ extern crate stopwatch;
use stopwatch::{Stopwatch}; use stopwatch::{Stopwatch};
use simplelog::*; use simplelog::*;
use v4l::{Buffer, CaptureDevice, MappedBufferStream};
use image; use image;
mod visualhaar; mod visualhaar;
@ -13,8 +12,6 @@ mod heatmap;
// use std::fs::File; // use std::fs::File;
static mut CAMERA: Option<CaptureDevice> = None;
fn main() { fn main() {
CombinedLogger::init( CombinedLogger::init(
vec![ vec![