cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.27k stars 939 forks source link

Added optional ${CINDER_IMGUI_DIR} cmake variable to build with an external version of ImGui #2276

Closed simongeilfus closed 11 months ago

simongeilfus commented 2 years ago

This PR allows to ship Cinder along with an external version of DearImGui.

It's great to have a script to update the version cinder is shipping with but it's a far less convenient solution when trying to setup a repository with a custom version of imgui. When working with a team it is easier to rely on submodules and cmake than having to depend on users to execute a python script.

The cmake changes are minimal but there's a couple of small required changes on the cpp side. Mostly the addition of a new CINDER_IMGUI_EXTERNAL preprocessor define to switch between the cinder friendly #include "imgui/imgui.h" and the standard #include "imgui used by DearImGui (and all libraries built upon DearImGui). This is taken care of by appending to the CINDER_DEFINES cmake variable.

This PR also removes the unused #include "imgui/imgui_stdlib.h" present at the top of CinderImGui.h. This hopefully shouldn't cause any major issue as cinder is not using the content of that file.

richardeakin commented 1 year ago

I think this is a good move, to allow users to update their Dear Imgui copy locally without having a dirty git tree.

richardeakin commented 11 months ago

Merci Simon!

totalgee commented 10 months ago

This PR also removes the unused #include "imgui/imgui_stdlib.h" present at the top of CinderImGui.h. This hopefully shouldn't cause any major issue as cinder is not using the content of that file.

Definitely doesn't cause a major problem ;-), but if I have a project that relied on the overload of ImGui::InputText() that takes a string argument (instead of c-string plus length), I should just include the (now) missing imgui_stdlib.h header? Thanks!

totalgee commented 10 months ago

(To answer myself: it seems to work fine that way...thanks and sorry for the noise.)