pthom / hello_imgui

Hello, Dear ImGui: unleash your creativity in app development and prototyping
https://pthom.github.io/hello_imgui
MIT License
604 stars 91 forks source link

Problems with implot from vcpkg #93

Closed sabudilovskiy closed 4 months ago

sabudilovskiy commented 5 months ago

Hi, I tried to use your project together with implot, supplied from vcpkg. I came across the fact that implot pulls its imgui from vcpkg, which does not have backend files, even if you throw it into hello_imgui, it will not work, well, there is a slightly different name for the target, but this is solved by alias. I don't understand well what you can try to do in such a situation. Hypothetically, if the backends you use were in separate targets (with separate settings), then you could use the package from vcpkg, turn off the imgui build along with hello_imgui and it would work.

pthom commented 5 months ago

Hello,

Using imgui and/or implot from vcpkg is not recommended. HelloImGui provides its own copy of ImGui (on the docking branch).

You have two solutions:

  1. Add ImPlot manually (as a submodule for example):
add_library(implot implot/implot.cpp implot/implot.h etc...)
target_link_library(implot PUBLIC imgui)
  1. If you really want to use vcpkg for implot

In this case, both ImGui and ImPlot will need to come from vcpkg.

See instructions here (following a recent commit):

https://github.com/pthom/hello_imgui/blob/2fa95691540389dcdbdb15feaf88a6a0b02aa95a/CMakeLists.txt#L245-L290