Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow getting glfw system library from pkg-config #506

Closed
Fuuzetsu opened this issue Sep 29, 2022 · 1 comment
Closed

Allow getting glfw system library from pkg-config #506

Fuuzetsu opened this issue Sep 29, 2022 · 1 comment

Comments

@Fuuzetsu
Copy link

Originally a ticket from PistonDevelopers/glfw-sys#26

I was able to verify that something like below works along with turning off the default feature of glfw-rs which pulls in glfw-sys.

Of course this needs a bit more love (made optional) but it appears to work I think.

diff --git a/Cargo.toml b/Cargo.toml
index 8a1ebf1..a87a352 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -38,7 +38,11 @@ version = "^0.4"
 [dev-dependencies]
 log = "0.4"
 
+[build-dependencies]
+pkg-config = "0.3"
+
 [features]
 all = ["image", "vulkan", "log"]
 default = ["glfw-sys"]
 vulkan = ["vk-sys"]
+
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..6d5fe2d
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,5 @@
+extern crate pkg_config;
+
+fn main() {
+    pkg_config::probe_library("glfw3").unwrap();
+}
@bvssvni
Copy link
Member

bvssvni commented Sep 29, 2022

The convention of using -sys crates is to prevent multiple linking to external libraries through Cargo. I think you can reopen the issue on the glfw-sys project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants