Skip to content

Commit

Permalink
Allow UNIX users to use the OPENCV_DIR environment variable. (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvallanger authored and Pzixel committed Feb 8, 2019
1 parent 403a44a commit e88ae6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ mod windows {

#[cfg(unix)]
mod unix {
pub fn opencv_include() -> &'static str {
"/usr/local/include"
use std::env;

pub fn opencv_include() -> String {
if let Ok(dir) = env::var("OPENCV_DIR") {
format!("{}/include", dir)
} else {
"/usr/local/include".into()
}
}

pub fn opencv_link() {
Expand Down

0 comments on commit e88ae6e

Please sign in to comment.