2019-12-15 10:15:37 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e88f9)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files @ 63dd366)
|
2019-03-19 07:37:29 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
extern crate pkg_config;
|
|
|
|
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
use pkg_config::{Config, Error};
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
use std::env;
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
use std::io;
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2019-06-18 10:04:39 +00:00
|
|
|
use std::io::prelude::*;
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
use std::process;
|
|
|
|
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(feature = "dox")]
|
|
|
|
fn main() {} // prevent linking libraries to avoid documentation failure
|
|
|
|
|
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
fn main() {
|
|
|
|
if let Err(s) = find() {
|
|
|
|
let _ = writeln!(io::stderr(), "{}", s);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-05 10:06:30 +00:00
|
|
|
#[cfg(not(feature = "dox"))]
|
2017-04-09 10:34:20 +00:00
|
|
|
fn find() -> Result<(), Error> {
|
|
|
|
let package_name = "gstreamer-base-1.0";
|
|
|
|
let shared_libs = ["gstbase-1.0"];
|
2019-04-23 12:32:33 +00:00
|
|
|
let version = if cfg!(feature = "v1_16") {
|
|
|
|
"1.16"
|
|
|
|
} else if cfg!(feature = "v1_14_3") {
|
2018-10-30 19:15:27 +00:00
|
|
|
"1.14.3"
|
|
|
|
} else if cfg!(feature = "v1_14_1") {
|
2018-05-21 08:28:08 +00:00
|
|
|
"1.14.1"
|
|
|
|
} else if cfg!(feature = "v1_14") {
|
2018-03-20 08:42:53 +00:00
|
|
|
"1.14"
|
2018-03-14 16:59:28 +00:00
|
|
|
} else if cfg!(feature = "v1_12_1") {
|
2017-10-10 14:37:56 +00:00
|
|
|
"1.12.1"
|
|
|
|
} else if cfg!(feature = "v1_12") {
|
2017-04-09 10:34:20 +00:00
|
|
|
"1.12"
|
|
|
|
} else if cfg!(feature = "v1_10") {
|
|
|
|
"1.10"
|
2017-09-09 21:21:38 +00:00
|
|
|
} else if cfg!(feature = "v1_8") {
|
|
|
|
"1.8"
|
2017-04-09 10:34:20 +00:00
|
|
|
} else if cfg!(feature = "v1_6") {
|
|
|
|
"1.6"
|
|
|
|
} else if cfg!(feature = "v1_4") {
|
|
|
|
"1.4"
|
|
|
|
} else if cfg!(feature = "v1_2") {
|
|
|
|
"1.2"
|
2017-09-09 21:21:38 +00:00
|
|
|
} else if cfg!(feature = "v1_0_1") {
|
|
|
|
"1.0.1"
|
2017-04-09 10:34:20 +00:00
|
|
|
} else {
|
|
|
|
"1.0"
|
|
|
|
};
|
|
|
|
|
2019-03-19 07:37:29 +00:00
|
|
|
if let Ok(inc_dir) = env::var("GTK_INCLUDE_DIR") {
|
|
|
|
println!("cargo:include={}", inc_dir);
|
|
|
|
}
|
2017-04-09 10:34:20 +00:00
|
|
|
if let Ok(lib_dir) = env::var("GTK_LIB_DIR") {
|
|
|
|
for lib_ in shared_libs.iter() {
|
|
|
|
println!("cargo:rustc-link-lib=dylib={}", lib_);
|
|
|
|
}
|
|
|
|
println!("cargo:rustc-link-search=native={}", lib_dir);
|
2019-06-18 10:04:39 +00:00
|
|
|
return Ok(());
|
2017-04-09 10:34:20 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 14:14:32 +00:00
|
|
|
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
|
2017-04-09 10:34:20 +00:00
|
|
|
let hardcode_shared_libs = target.contains("windows");
|
|
|
|
|
|
|
|
let mut config = Config::new();
|
|
|
|
config.atleast_version(version);
|
2018-02-21 17:43:31 +00:00
|
|
|
config.print_system_libs(false);
|
2017-04-09 10:34:20 +00:00
|
|
|
if hardcode_shared_libs {
|
|
|
|
config.cargo_metadata(false);
|
|
|
|
}
|
|
|
|
match config.probe(package_name) {
|
|
|
|
Ok(library) => {
|
2019-03-19 07:37:29 +00:00
|
|
|
if let Ok(paths) = std::env::join_paths(library.include_paths) {
|
|
|
|
println!("cargo:include={}", paths.to_string_lossy());
|
|
|
|
}
|
2017-04-09 10:34:20 +00:00
|
|
|
if hardcode_shared_libs {
|
|
|
|
for lib_ in shared_libs.iter() {
|
|
|
|
println!("cargo:rustc-link-lib=dylib={}", lib_);
|
|
|
|
}
|
|
|
|
for path in library.link_paths.iter() {
|
2019-06-18 10:04:39 +00:00
|
|
|
println!(
|
|
|
|
"cargo:rustc-link-search=native={}",
|
|
|
|
path.to_str().expect("library path doesn't exist")
|
|
|
|
);
|
2017-04-09 10:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
Err(Error::EnvNoPkgConfig(_)) | Err(Error::Command { .. }) => {
|
|
|
|
for lib_ in shared_libs.iter() {
|
|
|
|
println!("cargo:rustc-link-lib=dylib={}", lib_);
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
Err(err) => Err(err),
|
|
|
|
}
|
|
|
|
}
|