-
Notifications
You must be signed in to change notification settings - Fork 380
add vcpkg-rs for locating freetype #582
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
Conversation
This looks great, thanks! Will give it a proper test as soon as I can - so far I've only checked on Linux and it does as expected (happily falls back to pkgconfig) |
I really hope this can be merged soon, MFEKglif is still stuck on imgui-rs 0.7.0 and the branch has diverged a whole bunch yet again, I'd like to be able to upgrade it to 0.8.0 finally. (Cf. MFEK/glif#128 (comment)) |
f50bf9e
to
616361b
Compare
hey @ruifengx this looks excellent, but I'm having some trouble in the CI here. You can see on my fork my current progress: |
No time pressure, but this is probably the last thing we need merged in before I can do a 0.8.1 patch! |
@sanbox-irl BTW, in the current design, we always try |
Hmm! That seems less useful to end users then, huh? I was thinking this would work like how sdl2's vcpkg works, where it DOES fetch it for you |
I think i'd confused this with their |
For now, i'm going to merge this in and fix up the error messages, change some of hte feature gates (I'd rather you opt into vcpkg and freetype, rather than automagically getting both, since vcpkg seems to be much more common on windows) and then merge it in. Seperately, I'll make an issue for a |
@ruifengx A. Add some testing for this feature to our CI, specifically in our Windows builds. For that, see lines 133-150.
B. Separate this feature into a Let me know when you've got those done, and I'll merge it it, or let me know if you'd rather drop your own work on this, and when I'm back home for the holidays and have a Windows machine available, I can investigate this myself! (I'm on a Mac till the new year) |
Hi @sanbox-irl, sorry for the delayed response. I see plenty of exclamation marks in your comments; please be assured that I get your frustration on a PR failing your expectation, and that the failure is due to complicated real-life situations rather than poor design.
I am afraid this is not the case, and I also believe generally it is not a wise decision to automatically install the dependency (in this case
To support a
I will take some time investigating this tonight. I did confirm that the approach taken here works correctly on my PC before submitting this PR, so I guess there is something misconfigured in the CI process.
OK, get it. I will try fixing this CI script and report my progress soon.
I did not feature-gate
I will try to get a properly-updated version in several days. |
Oh hey, no frustration on my end -- your work is great and I appreciate your contribution greatly! I'm just of the age where I can't help but put
I agree with the above -- but unfortunately, we're a bit locked in without making a breaking change. I think perhaps in v0.10.0 we can make a major goal to have better freetype management for users. For now, just getting something that works for the majority of users will be sufficient I suspect. Thank you for the effort -- I don't know nearly enough about this to get it done on my own, so your input is essential |
I really really don't think it's a problem to have |
fair point, but I would like CI figured out before merge |
Oh, that's not really a major problem. This commit doesn't touch CI. You need to add something like - if: matrix.platform == 'windows'
name: Setup dependencies (Windows)
run: vcpkg install freetype |
Sorry, I know you are waiting or him to reply, I just want this fixed :-P |
I actually did try that! If you see my above posts, I did exactly that, but it failed in the CI on my fork. I didn't use that linked action though since windows runners come with vcpkg pre installed. That looks like it mostly handles caching -- does it also do some other work that might fix the issues I ran into? |
And don't worry, any help is good help and appreciated @ctrlcctrlv |
Oh, I'm sorry, I didn't understand fully the CI problem. I think you need this also: https://crates.io/crates/cargo-vcpkg, which claims to interoperate with Then in [package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static", dependencies = ["freetype"] } |
Also I am doubting a little bit that the Windows GitHub CI comes with vcpkg. The opencv-rust project, well maintained, installs it themselves: https://github.com/twistedfall/opencv-rust/blob/master/.github/workflows/opencv-rust.yml |
RustDesk project also installs own Their |
Oh, I just found something interesting, even if you are right about vcpkg bundling with Windows GH CI, there is this in the //! # Environment variables
//!
//! A number of environment variables are available to globally configure which
//! libraries are selected.
//!
//! * `VCPKG_ROOT` - Set the directory to look in for a vcpkg installation. If
//! it is not set, vcpkg will use the user-wide installation if one has been
//! set up with `vcpkg integrate install`, and check the crate source and target
//! to see if a vcpkg tree has been created by [cargo-vcpkg](https://crates.io/crates/cargo-vcpkg).
So you may have to run |
We should not use cargo-vcpkg in ci if we can avoid it, as cargo installing a binary in ci tends to be very slow |
That's not a good argument because you can just cache |
Caching is pretty dodgy at best, snd installing a program to avoid running a single command is… iffy, imo |
There's nothing iffy about GH Actions caching, and if you don't trust it, you could upload a Win32 binary of cargo-vcpkg.exe somewhere, and fetch it on a cache miss. Given it is only some 5MB, probably would even fit in a GitHub gist.
There are benefits to users of using Regardless, current imgui 0.8 is very broken on Win32, so I'd take iffy over broken, given it will only affect Windows CI build. |
616361b
to
05f8728
Compare
@sanbox-irl It seems I managed to make the CI pass: https://github.com/ruifengx/imgui-rs/runs/4631059708. Our first attempt was indeed in the correct direction, it is just Rust expects to be linked with 64bit static libraries with the MSVC runtime dynamically linked (thus the I will update the CI script first, and then start working on feature-gating |
The default software for the Windows runners is listed here, and does include vcpkg: Not sure when this was added, it might be a fairly recent thing thus RustDesk etc installed it manually?
I think the bundling flag is a good convenience (maybe to do later), but I'm not too sure it's worth the minor extra complexity of having the two My thinking is;
|
Meanwhile you can add to cimgui_manuals in generator.lua the function to be skipped in generation |
For imgui-rs 0.9, I reckon we can ~manually backport the ocornut/imgui@980deb4 fix to the vendored copies of imgui However in 0.8 it's a bit trickier as that version still uses the git-submodule, but if tweaking the cimgui generator would work, then that sounds like a good solution here |
how is this still open should i just port my code to egui and be done with it because "we don't use random commits" imgui-rs 0.8 has significant unfixed breakage and really i'm starting to doubt this project's priorities… another option i could take is to PR a way to replace your entire imgui-sys with a link to |
My post suggested that i encourage people (expectially c++ users) to compile themselves as it allows configuring stuff like compatible math types. Binaries built by others won’t do that. Do whatever works for you. A friend of mine started rewriting cimgui because it appears like in its current iteration it became a bit of a bottleneck for progress for users of non C++ languages, if you are interested we can share the wip repo. (Our version currently output enough metadata to output headers with full comments etc) |
yes, very interested, as I experimented myself already with compiling libcimgui to .so i believe it works i'm frustrated with lack of progress in this project, so if i could PR a way to tell imgui-sys where to find a .so and just call |
The better way to do this (which doesn't require you wait for a release even) is to just override it in the More broadly, imgui isn't ABI stable, so linking to it as a dynamic library isn't something we really want to expose IMO, since it could easily be unsound. Statically linking is good for 99% of cases, and the remaining 1% can just override in their .cargo/config.toml. |
it's not something you want to expose at all, or not something you want to expose by default? |
oh i see what you're saying. with that |
The upstream fix for this is part of imgui v1.87 onwards - so I think the most pragmatic approach to (finally! 😓) getting this out is:
|
Glad to hear this! I could rebase this PR onto the latest |
@ruifengx Sorry for the protracted delay, but.. I think this is now ready to rebase (v0.9 is out the door), if you have the time! |
ca6127f
to
7eec3e9
Compare
I have just rebased my fork to Note: To link properly with MSVC for |
Ah I think that manual edit to The upgrade PR is 99% done, so should be merged in a few days (barring some delays for the Christmas holidays) - then I think we can finally merge this - thanks for all the work! |
Good news for users of this library but I invested in switching MFEKglif off of
Not mad about it, just saying that maintenance decisions have consequences downstream :-) perhaps this one is even fine / worth it on both sides. |
…tBuilderForStbTruetype() function. cimgui/cimgui#193 imgui-rs/imgui-rs#582
Should solve #562 and #566.
I used the method I proposed here (using
vcpkg
in addition topkg-config
). It builds and links properly with my local settings, but I'm not entirely sure whether or not it runs correctly (the program looks correct, though).This PR chose to base on the tag
v0.8.0
(instead ofHEAD
) on purpose, so that it is possible to test and compare the result with the latest published release oncrates.io
. If needed, I can rebase it ontoHEAD
.