-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Lightweight, Modular CMake Integration for ImGui #7992
base: master
Are you sure you want to change the base?
Conversation
I had a few doubts, i was unsure, what is the more standard expected way when including backends #include <backends/imgui_impl_xxxxx.h> or directly #include<imgui_impl_xxxxx.h> also, what about, when installing imgui includes, is it supposed to be installed within a #include <imgui/imgui.h>
#include <imgui/xxxx/xxxx.h> or direclty install imgui includes to the destination root include path, in such a way that includes looks like: #include <imgui.h>
#include <imgui_xxxxx.h> Note: the aim is to have minimum amount of change and maximum amount of consistency. |
Example: find_package(imgui REQUIRED)
# or
# add_subdirectory(path/to/imgui)
add_executable(foo foo.cpp)
target_link_libraries(myexec
imgui::core # Core Agnostic Imgui Impl, ex imgui.cpp imgui_tables.cpp ... etc etc
imgui::freetype # Imgui FreeType Implementation
...
imgui::win32 # Imgui Windows Backend
# imgui::opengl2 # Imgui Opengl2 Backend Implementation
imgui::opengl3 # Imgui Opengl3 Backend Implementation
...
) As shown above, everything is very decoupled, concerns are very separated, in a way feels like composing your build with // foo.cpp
#include <imgui.h> // From imgui::core
#include <imgui_impl_win32.h> // From imgui::win32
//#include <imgui_impl_opengl2.h> // From imgui::opengl2
#include <imgui_impl_opengl3.h> // From imgui::opengl3
#include <imgui_freetype.h> // From imgui::freetype
int main()
{
Imgui:: .... ();
} Note: Each component shown above is automatically being linked statically! (including |
This commit introduces a minimal and clean
CMake
setup aimed at maintaining the simplicity of the project. The goal is to provide a foundation for modular build configurations, allowing for future additions (e.g.,backend implementations
,examples
) without introducing bloat.