This page documents how to configure and build Dear ImGui for integration into your application. It covers compiler flags, build system integration patterns, configuration defines, and platform-specific requirements. This page focuses on the build configuration mechanics; for information about selecting and integrating backends, see Backend Architecture. For CI/CD automation, see CI/CD Pipeline.
Dear ImGui is designed to be easily integrated into existing projects with minimal build system complexity. The library follows a "bring your own build system" philosophy.
The minimal set of files required to build Dear ImGui core:
Sources: .github/workflows/build.yml62-93
Dear ImGui has minimal external dependencies:
| Component | Dependencies | Optional |
|---|---|---|
| Core Library | C++ compiler, C++ standard library | No |
| Windows Platform | imm32.lib (IME support) | No (Windows) |
| FreeType Integration | FreeType library | Yes |
| Platform Backends | Platform-specific libraries (GLFW, SDL, Win32 API) | Backend-dependent |
| Renderer Backends | Graphics API libraries (Vulkan, DirectX, OpenGL) | Backend-dependent |
Sources: .github/workflows/build.yml37-50 .github/workflows/build.yml281-284
Dear ImGui supports integration with various build systems. Examples demonstrate Makefiles, Visual Studio projects, CMake, and Gradle (Android).
The repository provides Makefiles for Unix-like systems. Key patterns:
Example Makefile invocations from CI:
make -C examples/example_glfw_opengl2make -C examples/example_null WITH_EXTRA_WARNINGS=1make -C examples/example_null WITH_FREETYPE=1CXX=clang++ make -C examples/example_nullCXXFLAGS="$CXXFLAGS -m32" make -C examples/example_nullSources: .github/workflows/build.yml286-304 .github/workflows/build.yml318-321
Visual Studio project files (.vcxproj) are provided for Windows examples. The CI workflow demonstrates MSBuild usage:
"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release
Project configuration notes:
v143 for VS 2022)WindowsTargetPlatformVersion should be set to a compatible SDK versionSources: .github/workflows/build.yml52-59 .github/workflows/build.yml189-267
CMake is supported for select examples, particularly for Emscripten builds:
Sources: .github/workflows/build.yml640-647
Android projects use Gradle:
Sources: .github/workflows/build.yml656-659
Recommended compiler flags for building Dear ImGui:
| Flag | Purpose | Required |
|---|---|---|
-Wall | Enable common warnings | Recommended |
-Wformat | Warn about printf format issues | Recommended |
-Wextra | Enable additional warnings | Recommended (CI) |
-Werror | Treat warnings as errors | CI only |
-std=c++11 (or higher) | C++ standard version | Yes |
Sources: .github/workflows/build.yml286-304
The CI system tests with WITH_EXTRA_WARNINGS=1 which enables comprehensive warning detection. This helps ensure code quality across different compilers (GCC, Clang, MSVC).
Sources: .github/workflows/build.yml286-304 .github/workflows/build.yml75-80
Dear ImGui supports multiple C++ standards:
| Standard | Support Status | Notes |
|---|---|---|
| C++11 | Fully supported | Minimum required |
| C++14 | Fully supported | |
| C++17 | Fully supported | |
| C++20 | Fully supported | Tested in CI |
| C++26 | Tested | Forward compatibility |
Sources: .github/workflows/build.yml398-408 .github/workflows/build.yml467-477
Dear ImGui can be built without the C++ standard library runtime for embedded systems:
Sources: .github/workflows/build.yml479-489 .github/workflows/build.yml550-559
Dear ImGui supports extensive compile-time configuration through preprocessor defines. These can be set in your build system or in imconfig.h.
Tested configurations:
| Define | Purpose | CI Test |
|---|---|---|
IMGUI_DISABLE_OBSOLETE_FUNCTIONS | Remove deprecated functions | build.yml374-384 |
IMGUI_DISABLE_OBSOLETE_KEYIO | Remove old keyboard IO API | build.yml386-396 |
IMGUI_DISABLE_DEMO_WINDOWS | Exclude demo window code | build.yml410-421 |
IMGUI_DISABLE_DEBUG_TOOLS | Remove debug/metrics tools | build.yml410-421 |
IMGUI_DISABLE_FILE_FUNCTIONS | Remove file I/O functions | build.yml423-433 |
IMGUI_DISABLE_WIN32_FUNCTIONS | Remove Win32 API dependencies | build.yml94-105 |
Sources: .github/workflows/build.yml306-446
Dear ImGui allows customization of core types:
Tested configurations:
#define ImDrawIdx unsigned int - Supports meshes with >65,536 vertices#define ImTextureID SomeType - Can be a pointer or struct#define IMGUI_USE_WCHAR32 - Enables 32-bit character supportSources: .github/workflows/build.yml346-372 .github/workflows/build.yml334-344
Custom vector types can be integrated:
Sources: .github/workflows/build.yml447-465
| Define | Purpose |
|---|---|
IMGUI_USE_BGRA_PACKED_COLOR | Use BGRA color format instead of RGBA |
IMGUI_API | Control symbol export/import for DLLs |
IMGUI_IMPL_API | Control backend symbol export/import |
IM_ASSERT(x) | Custom assertion macro |
Sources: .github/workflows/build.yml435-445 .github/workflows/build.yml306-316
Dear ImGui supports single-file builds using misc/single_file/imgui_single_file.h:
This header includes all core .cpp files, simplifying integration. The CI tests this extensively to ensure it works with various configurations.
Sources: .github/workflows/build.yml82-92 .github/workflows/build.yml323-332
Dear ImGui can be built as a DLL or shared library:
Windows DLL example (MinGW):
Windows DLL example (MSVC):
Sources: .github/workflows/build.yml65-73 .github/workflows/build.yml107-117
For static library builds, compile all .cpp files into a library:
Link your application against libimgui.a and include appropriate backend files.
Key points:
imm32.lib for IME supportSources: .github/workflows/build.yml52-59 .github/workflows/build.yml119-267
Sources: .github/workflows/build.yml281-284
Sources: .github/workflows/build.yml521-592
iOS builds use Xcode projects with code signing disabled for CI:
Sources: .github/workflows/build.yml594-604
Sources: .github/workflows/build.yml606-647
Android builds use Gradle with the Android SDK:
Sources: .github/workflows/build.yml649-659
For Vulkan, you need Vulkan headers and loader libraries. The CI uses pre-built libraries:
Vulkan-Headers (from KhronosGroup)vulkan-1.lib (Windows), libvulkan.so (Linux)Special configuration:
IMGUI_IMPL_VULKAN_NO_PROTOTYPES - Use when Vulkan function pointers are loaded manuallySources: .github/workflows/build.yml48-50 .github/workflows/build.yml505-506
DirectX backends require Windows SDK:
Sources: .github/workflows/build.yml179-267
SDL2 and SDL3 require respective development libraries:
Sources: .github/workflows/build.yml39-46
The CI system tests numerous build configurations to ensure compatibility:
The example_null application serves as a configuration test bed, building successfully with various compile-time options validates compatibility.
Sources: .github/workflows/build.yml62-489
When integrating Dear ImGui into your project:
Add source files:
imgui.cpp, imgui_widgets.cpp, imgui_tables.cpp, imgui_draw.cppimgui_demo.cpp, imgui_freetype.cppimgui_impl_*.cpp for your platform and rendererConfigure compiler flags:
-std=c++11 (or higher)-Wall -WformatLink dependencies:
imm32.libSet configuration defines (if needed):
imconfig.h or via compiler flags (-DIMGUI_DISABLE_...)Choose build variant:
Test your configuration:
example_null)Sources: All sections above
Refresh this wiki