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

Support for vcpkg on Windows #865

Closed
ruifengx opened this issue Feb 4, 2022 · 9 comments
Closed

Support for vcpkg on Windows #865

ruifengx opened this issue Feb 4, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@ruifengx
Copy link

ruifengx commented Feb 4, 2022

Looks like vcpkg has support for gtk. vcpkg has long been my preferred "package manager" for C/C++ libraries, and it looks very popular among Windows programmers (14.8k stars atm). There is a Rust binding for vcpkg (vcpkg-rs), and I find it relatively easy to use (see the use of vcpkg in rust-sdl2, for example).

Installing gtk using vcpkg should be as easy as vcpkg install gtk. Compare this to the steps listed in the Book currently. I wonder whether or not it is possible to add support for vcpkg here, so that installation on Windows could be less painful (at least from my perspective).

If you find this change appropriate, I could work on this and try to submit a PR, but I will need some guidance on which files to modify (it seems the -sys crates here are automatically generated, and I currently have very little knowledge on that generator). The change should only involve modifying Cargo.toml (adding an optional dependency on vcpkg) and build.rs (making use of vcpkg to locate the library to link with), and we should be able to make both modifications backward compatible (e.g. by feature-gating the use of vcpkg).

P.S. The title says "on Windows", but one should also be able to use vcpkg on other platforms like Linux, but I am afraid that very few people would actually want to do that (because apparently pkg-config is well-integrated on Linux, and installing gtk should be as easy as e.g. dnf install gtk4-devel).

@ruifengx ruifengx added the enhancement New feature or request label Feb 4, 2022
@bilelmoussaoui
Copy link
Member

Are there any bindings out there that makes use of it ? Would it conflict with the current automatic system-deps usage ?

It looks interesting though

@ids1024
Copy link
Contributor

ids1024 commented Feb 4, 2022

See gdesmott/system-deps#8 and gdesmott/system-deps#12 for previous discussion and work on this.

@ruifengx
Copy link
Author

ruifengx commented Feb 4, 2022

As I mentioned, there is rust-sdl2 using both pkg-config and vcpkg. If this PR lands, imgui-rs will also be using both. Regarding system-deps (I did not know it is used here; my guess was that pkg-config-rs is used here), I found this interesting issue and this PR. However, both lack an update ever since Aug 2020. They did mention vcpkg's gtk builds are broken, but that was one year ago, and this PR (merged 2 months ago) might have fixed the problem. I will try vcpkg install gtk to verify this soon.

However, to be clear, I am not necessarily bound to using vcpkg. I am just not satisfied with the current steps for installation required on Windows (just compare that long list to the one-line dnf install gtk4-devel on Fedora, for example).

@ruifengx
Copy link
Author

ruifengx commented Feb 4, 2022

See also microsoft/vcpkg#22881 regarding build failure and version update.

@Hofer-Julian
Copy link
Collaborator

@ruifengx could you elaborate what you mean with "support" for vcpkg?

@ruifengx
Copy link
Author

ruifengx commented Feb 5, 2022

That would be automatically locating the package with vcpkg and getting all the link flags, without going through an extra pkg-config step. IMO pkg-config on Windows is barely usable, and supporting gtk would be its mere purpose for existing on my PC.

@Hofer-Julian
Copy link
Collaborator

Then I guess there is nothing to do from our side until gdesmott/system-deps#12 is merged.

@ruifengx
Copy link
Author

ruifengx commented Feb 5, 2022

Okay, and it seems that PR won't be merged any time soon in its current status. I guess I have to live with the status quo, or try to help that PR land. Thanks anyway.

Do you prefer this issue closed, or should I leave it open until the upstream PR is merged?

@Hofer-Julian
Copy link
Collaborator

I think we can close it and open a new one when it becomes actionable :)

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

No branches or pull requests

4 participants