Repository: PistonDevelopers/glfw-rs (language: rust)

Issue:
Can't find system glfw3 on Ubuntu 14.10
Using `default-features = false` I'm getting `cannot find -lglfw3` when linking. The `libglfw3-dev` package installs `/usr/lib/x86_64-linux-gnu/libglfw.so`. The package conflicts with `libglfw-dev` (so you can't install both glfw 2 and 3 on ubuntu).

Is there a way to use libglfw.so as a fallback?



Discussion / hints:
glfw brings its own copy of glfw - it doesn't rely on the global version. Is there a particular reason why you don't want it?

The reason is that glfw coming with glfw-rs doesn't work on Windows and I want to be able to work on both systems.

A way to declare `default-features = false` only on Windows would also work for me ;)

Ah, didn't think of that! I think you might be able to do this with cargo - but I'm not sure... you might have to ask on the #cargo IRC channel.

@jhasse, any update on this? I am running into the same problem.

@bjz, Would we want to do something like this,
- Check if user specified a location for GLFW
  - Found: Link against it
  - Not found: Look in common locations
    - Found: Link against it
    - Not found: Build it ourselves
- Check in common locations
  - Found: Link against it
  - Not found: build it ourselves

?


Fix patch:
diff --git a/src/ffi/link.rs b/src/ffi/link.rs
index cc489378..3351d33f 100644
--- a/src/ffi/link.rs
+++ b/src/ffi/link.rs
@@ -19,6 +19,12 @@ extern {}
 
 #[cfg(not(feature = "glfw-sys"))]
 // leaving off `kind = static` allows for the specification of a dynamic library if desired
+#[cfg(target_family = "unix")]
+#[link(name = "glfw")]
+extern {}
+
+#[cfg(not(feature = "glfw-sys"))]
+#[cfg(target_family = "windows")]
 #[link(name = "glfw3")]
 extern {}
 


Test patch: