pub use serializable::{CppBuildConfig, CppBuildConfigData, CppLibraryType};
use std::path::PathBuf;
#[derive(Debug, Default, Clone)]
pub struct CppBuildPaths {
lib_paths: Vec<PathBuf>,
framework_paths: Vec<PathBuf>,
include_paths: Vec<PathBuf>,
}
impl CppBuildPaths {
pub fn new() -> CppBuildPaths {
CppBuildPaths::default()
}
pub fn add_lib_path<P: Into<PathBuf>>(&mut self, path: P) {
self.lib_paths.push(path.into());
}
pub fn add_framework_path<P: Into<PathBuf>>(&mut self, path: P) {
self.framework_paths.push(path.into());
}
pub fn add_include_path<P: Into<PathBuf>>(&mut self, path: P) {
self.include_paths.push(path.into());
}
pub fn apply_env(&mut self) {
use ::std::env;
if let Ok(paths) = env::var("CPP_TO_RUST_LIB_PATHS") {
self.lib_paths = env::split_paths(&paths).collect();
}
if let Ok(paths) = env::var("CPP_TO_RUST_FRAMEWORK_PATHS") {
self.framework_paths = env::split_paths(&paths).collect();
}
if let Ok(paths) = env::var("CPP_TO_RUST_INCLUDE_PATHS") {
self.include_paths = env::split_paths(&paths).collect();
}
}
pub fn lib_paths(&self) -> &[PathBuf] {
&self.lib_paths
}
pub fn framework_paths(&self) -> &[PathBuf] {
&self.framework_paths
}
pub fn include_paths(&self) -> &[PathBuf] {
&self.include_paths
}
}