-
-
Notifications
You must be signed in to change notification settings - Fork 82
Conversation
Gir.toml
Outdated
@@ -1535,7 +1535,7 @@ status = "generate" | |||
[[object]] | |||
name = "Gtk.Plug" | |||
status = "generate" | |||
cfg_condition = "all(not(windows),not(target_os = \"macos\"))" | |||
cfg_condition = "target = \"x11\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know you could define your own targets 😮
We should also do the same with gio-unix
and things like that I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean re gio-unix
since this is mostly a gdk/gtk thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a similar problem with GIO (and GLib) about Windows/POSIX/Linux specific APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah, I don't think gio exports such info in their pkg-config but perhaps there's a different way to discover it for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate pkg-config
files
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. |
This adds a gdk_backend="x11" etc set of flags which can be used in #[cfg] checks. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
I've changed the config to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
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 |
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 - gtk-rs/sys#167 |
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.