diff --git a/sdl2-sys/Cargo.toml b/sdl2-sys/Cargo.toml index 918b806b..dc5d30a0 100644 --- a/sdl2-sys/Cargo.toml +++ b/sdl2-sys/Cargo.toml @@ -8,6 +8,12 @@ build = "build.rs" [lib] name = "sdl2-sys" +path = "src/lib.rs" [build-dependencies] pkg-config = "*" + +[features] + +default = [] +use-pkgconfig = [] diff --git a/sdl2-sys/build.rs b/sdl2-sys/build.rs index 14ee66ab..e521f5b0 100644 --- a/sdl2-sys/build.rs +++ b/sdl2-sys/build.rs @@ -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 {