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

View File

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