Closed kinnison closed 4 years ago
Looks like a good solution to me, only makes it more confusing for users if they want to use the API but it does not exist because of their GTK version. With a feature flag we could print some more useful error if the user tries to enable it but it does not exist.
I've changed the config to gdk_backend="x11"
and friends, since that seems more descriptive. I've also added explanatory notes in build.rs
Is there no way to add it to gdk-sys?
@EPashkin Yes, the same work ought to work for gdk-sys if you want to use the capability there for any reason.
I want detect flags in gdk-sys and use it here
@EPashkin Aaah, right, to my knowledge it's not possible for crates to acquire configuration flags from their dependencies. If you know of a way to do this, I'm happy to rework it.
I thought about something like "DEP_GDK_BACKEND" from https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key It should works if gtk depends of gdk-sys directly and need "build.rs" in "gtk" too.
Oh that's interesting, I shall look at doing that because yes, that makes a lot of sense. I think gdk-sys should compute them gtk-sys should propagate them, and gtk can then consume them. Hmm...
I've pushed the first part of that new variant here - https://github.com/gtk-rs/sys/pull/167 Once that merges, I'll pop a PR up for replacing this calculating with inheriting it from gtk-sys
This is a proposed approach for better handling of targets. The pkg-config file defines a targets variable which is whitespace separated. This PR consumes that in
build.rs
and setstarget="x11"
and friends as config values.To demonstrate its use, this then switches
gtk::Plug
andgtk::Socket
to be predicated ontarget="x11"
rather thanall(not(windows), not(target_os = "macos"))
@sdroege What do you think of this as an approach? If considered good, it should probably be spread to
gtk-sys
and possibly other crates.