diff --git a/Cargo.toml b/Cargo.toml index c98404e..4b5f46d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ lazy_static = { version = "0.2", optional = true } core-foundation = "0.4" cgl = "0.2" -[target.'cfg(target_os = "linux")'.dependencies.x11] +[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "android"))))'.dependencies.x11] optional = true version = "2.3.0" features = ["xlib"] diff --git a/src/lib.rs b/src/lib.rs index b368caf..d52f688 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ extern crate log; #[cfg(feature="serde")] extern crate serde; -#[cfg(all(target_os="linux", feature="x11"))] +#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), feature="x11"))] extern crate x11; #[cfg(target_os="macos")] extern crate cgl; @@ -56,7 +56,7 @@ pub use gl_formats::GLFormats; mod gl_limits; pub use gl_limits::GLLimits; -#[cfg(all(target_os="linux", feature="x11"))] +#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), feature="x11"))] #[allow(improper_ctypes)] mod glx { include!(concat!(env!("OUT_DIR"), "/glx_bindings.rs")); diff --git a/src/platform/mod.rs b/src/platform/mod.rs index 06c4a85..5f514d8 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -30,16 +30,16 @@ pub trait NativeGLContextMethods: Sized { fn is_osmesa(&self) -> bool { false } } -#[cfg(all(target_os="linux", feature="x11"))] +#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), feature="x11"))] pub mod with_glx; -#[cfg(all(target_os="linux", feature="x11"))] +#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), feature="x11"))] pub use self::with_glx::{NativeGLContext, NativeGLContextHandle}; #[cfg(feature="osmesa")] pub mod with_osmesa; #[cfg(feature="osmesa")] pub use self::with_osmesa::{OSMesaContext, OSMesaContextHandle}; -#[cfg(all(target_os="linux", not(feature="x11")))] +#[cfg(all(unix, not(any(target_os = "macos", target_os = "android")), not(feature="x11")))] pub use self::with_osmesa::{OSMesaContext as NativeGLContext, OSMesaContextHandle as NativeGLContextHandle}; @@ -58,7 +58,7 @@ pub mod with_wgl; #[cfg(target_os="windows")] pub use self::with_wgl::{NativeGLContext, NativeGLContextHandle}; -#[cfg(not(any(target_os="linux", target_os="android", target_os="macos", target_os="windows")))] +#[cfg(not(any(unix, target_os="windows")))] pub mod not_implemented; -#[cfg(not(any(target_os="linux", target_os="android", target_os="macos", target_os="windows")))] +#[cfg(not(any(unix, target_os="windows")))] pub use self::not_implemented::{NativeGLContext, NativeGLContextHandle};