Merge pull request #254 from caryhaynie/osx_pkgconfig_fix

move building via pkg-config to behind a feature.
This commit is contained in:
Tony Aldridge
2015-01-05 09:20:34 +00:00
2 changed files with 12 additions and 2 deletions
+6
View File
@@ -8,6 +8,12 @@ build = "build.rs"
[lib]
name = "sdl2-sys"
path = "src/lib.rs"
[build-dependencies]
pkg-config = "*"
[features]
default = []
use-pkgconfig = []
+6 -2
View File
@@ -1,8 +1,12 @@
extern crate "pkg-config" as pkg_config;
fn main() {
if build_pkgconfig() { return; }
panic!("Could not find SDL2 via pkgconfig");
if std::os::getenv("CARGO_FEATURE_USE_PKGCONFIG").is_some() {
if build_pkgconfig() { return; }
panic!("Could not find SDL2 via pkgconfig");
} else {
println!("cargo:rustc-flags=-l SDL2");
}
}
fn build_pkgconfig() -> bool {