Can I customize the import paths of plutovg and plutosvg?
Version/Branch of Dear ImGui:
Version 1.92.0 Branch: all (master/docking/etc.)
Back-ends:
imgui_impl_dx11.cpp + imgui_impl_win32.cpp
Compiler, OS:
WIN11+MSVC2022
Full config/build information:
No response
Details:
Can I customize the import paths of plutovg and plutosvg? The default paths after vcpkg build are "plutovg/plutovg.h" and "plutosvg/plutosvg.h" while imgui uses "plutovg.h" and "plutosvg.h"
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Hmm
- plutovg/plutosvg examples use <plutovg.h> <plutosvg.h> https://github.com/sammycage/plutovg/tree/main/examples https://github.com/sammycage/plutosvg/tree/master/examples
- plutovg.h is inside an include/ folder. plutosvg.h is include a source/ folder. But I presume "installing" them changes the layout.
It is a bit annoying that there's no neat standard for it.... See Conan package : https://conan.io/center/recipes/plutosvg
I don't know if we should just change it use "plutovg/plutovg.h" style? or use __has_include...
Ref #7927 @pthom
plutosvg.h itself does:
#include <plutovg.h>
So I don't know how it could work with vcpkg if the only possible path include path are "plutovg/plutovg.h" and "plutosvg/plutosvg.h", even if our include in imgui_freetype.h succeeded, the one in plutosvg.h would fail. Something is wrong either in vcpkg either in the way we use it.
It is probably an error on the plutosvg's conan recipe in itself.
When using imgui via vcpkg, it is perfectly possible to #include "imgui.h".
Since plutovg, and plutosvg is meant to be used this way, this should be possible too to write #include "plutosvg.h"
The recipe's readme recommends this.
May be this recipe should be compared to imgui's conan recipe.
See below, the content of vcpkg/packages for imgui and plutosvg: the recipe for plutosvg adds an unanted include/plutosvg subfolder
Anyhow, as a conclusion:
- this is a bug in the conan recipe. The reasonable way to fix this is in the recipe itselt.
- On ImGui side, it might be possible to add
__has_include. However, this requires c++17, and should be considered a last resort, if we really want to offer a solution against broken package recipes. - On the user side (@o-3-o ), are you able to patch imgui source in your own checkout? This would be an easy solution.
First of all, thank yous for your answer, this is indeed not a problem with imgui, but a problem with the package manager's build, my current solution is to add an additional include directory, this will not pollute other files.
There's maybe a quirk in pthom message, seems to be conflating vcpkg and conan which I imagine are unrelated recipes. I don't know if Conan's recipe is wrong, but vcpkg recipe seems to be wrong. Opening an issue on vcpkg could make sense...
What puzzles me is that e.g. @RT2Code opened this https://github.com/microsoft/vcpkg/pull/43789 which suggest they were able to use plutosvg with vcpkg in the first place? So there's something I don't understand.