Make it work on DragonFly/FreeBSD

Tested on DragonFly BSD. Should work similarily on FreeBSD.
This commit is contained in:
Michael Neumann 2015-08-29 22:54:17 +02:00
parent b8b1b80631
commit b707959c2c
12 changed files with 30 additions and 11 deletions

View file

@ -108,3 +108,17 @@ wayland-client = { version = "0.2.1", features = ["egl", "dlopen"] }
wayland-kbd = "0.2.0" wayland-kbd = "0.2.0"
wayland-window = "0.1.0" wayland-window = "0.1.0"
x11-dl = "~2.0" x11-dl = "~2.0"
[target.x86_64-unknown-dragonfly.dependencies]
osmesa-sys = "0.0.5"
wayland-client = { version = "0.2.1", features = ["egl", "dlopen"] }
wayland-kbd = "0.2.0"
wayland-window = "0.1.0"
x11-dl = "~2.0"
[target.x86_64-unknown-freebsd.dependencies]
osmesa-sys = "0.0.5"
wayland-client = { version = "0.2.1", features = ["egl", "dlopen"] }
wayland-kbd = "0.2.0"
wayland-window = "0.1.0"
x11-dl = "~2.0"

View file

@ -59,7 +59,7 @@ fn main() {
"1.5", "core", &mut file).unwrap(); "1.5", "core", &mut file).unwrap();
} }
if target.contains("linux") { if target.contains("linux") || target.contains("dragonfly") || target.contains("freebsd") {
let mut file = File::create(&dest.join("glx_bindings.rs")).unwrap(); let mut file = File::create(&dest.join("glx_bindings.rs")).unwrap();
gl_generator::generate_bindings(gl_generator::StructGenerator, gl_generator::generate_bindings(gl_generator::StructGenerator,
gl_generator::registry::Ns::Glx, gl_generator::registry::Ns::Glx,

View file

@ -1,4 +1,4 @@
#![cfg(target_os = "linux")] #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))]
#![allow(dead_code)] #![allow(dead_code)]
use libc; use libc;

View file

@ -33,3 +33,5 @@ pub type EGLNativeWindowType = winapi::HWND;
pub type EGLNativeWindowType = *const libc::c_void; pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
pub type EGLNativeWindowType = *const libc::c_void; pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
pub type EGLNativeWindowType = *const libc::c_void;

View file

@ -1,4 +1,5 @@
#![cfg(any(target_os = "windows", target_os = "linux", target_os = "android"))] #![cfg(any(target_os = "windows", target_os = "linux", target_os = "android",
target_os = "dragonfly", target_os = "freebsd"))]
#![allow(unused_variables)] #![allow(unused_variables)]
use BuilderAttribs; use BuilderAttribs;

View file

@ -1,4 +1,4 @@
#![cfg(all(target_os = "linux", feature = "window"))] #![cfg(all(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"), feature = "window"))]
use BuilderAttribs; use BuilderAttribs;
use ContextError; use ContextError;

View file

@ -1,4 +1,4 @@
#![cfg(any(target_os = "linux", target_os = "freebsd"))] #![cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
extern crate osmesa_sys; extern crate osmesa_sys;

View file

@ -1,4 +1,4 @@
#![cfg(target_os = "linux")] #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))]
#![allow(unused_variables, dead_code)] #![allow(unused_variables, dead_code)]
use self::wayland::egl::{EGLSurface, is_egl_available}; use self::wayland::egl::{EGLSurface, is_egl_available};

View file

@ -1,4 +1,4 @@
#![cfg(all(target_os = "linux", feature = "window"))] #![cfg(all(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"), feature = "window"))]
pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor};
pub use self::window::{Window, XWindow, PollEventsIterator, WaitEventsIterator, Context, WindowProxy}; pub use self::window::{Window, XWindow, PollEventsIterator, WaitEventsIterator, Context, WindowProxy};

View file

@ -55,7 +55,7 @@ extern crate cocoa;
extern crate core_foundation; extern crate core_foundation;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
extern crate core_graphics; extern crate core_graphics;
#[cfg(any(target_os = "linux", target_os = "freebsd"))] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
extern crate x11_dl; extern crate x11_dl;
pub use events::*; pub use events::*;

View file

@ -1,4 +1,4 @@
#![cfg(target_os = "linux")] #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))]
use Api; use Api;
use BuilderAttribs; use BuilderAttribs;

View file

@ -3,7 +3,7 @@ pub use self::platform::*;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
#[path="windows/mod.rs"] #[path="windows/mod.rs"]
mod platform; mod platform;
#[cfg(target_os = "linux")] #[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))]
#[path="linux/mod.rs"] #[path="linux/mod.rs"]
mod platform; mod platform;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@ -16,5 +16,7 @@ mod platform;
#[path="ios/mod.rs"] #[path="ios/mod.rs"]
mod platform; mod platform;
#[cfg(all(not(target_os = "ios"), not(target_os = "windows"), not(target_os = "linux"), not(target_os = "macos"), not(target_os = "android")))] #[cfg(all(not(target_os = "ios"), not(target_os = "windows"), not(target_os = "linux"),
not(target_os = "macos"), not(target_os = "android"), not(target_os = "dragonfly"),
not(target_os = "freebsd")))]
use this_platform_is_not_supported; use this_platform_is_not_supported;