Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Build Guide

This page documents CMake options, presets, the justfile task runner, and common build scenarios.

CMake presets

The repo ships a CMakePresets.json with these presets:

PresetDescription
defaultDesktop C++ with GLFW + OpenGL3
default_sdlDesktop C++ with SDL2 + OpenGL3
python_bindingsPython bindings (forces GLFW + OpenGL3)
all_cpp_optionsEverything enabled: all backends, demos, tests, ImmVision with OpenCV

Usage:

mkdir -p builds/my_build && cd builds/my_build
cmake ../.. --preset python_bindings -DPython_EXECUTABLE=$(which python)
cmake --build . -j

Module selection (IMGUI_BUNDLE_WITH_*)

Each library can be individually enabled or disabled. All default to ON.

OptionLibraryNotes
IMGUI_BUNDLE_WITH_HELLO_IMGUIHello ImGuiDisabling also disables immapp, imgui_md, test_engine
IMGUI_BUNDLE_WITH_IMMAPPImmAppDepends on hello_imgui + imgui_node_editor
IMGUI_BUNDLE_WITH_IMPLOTImPlot2D plotting
IMGUI_BUNDLE_WITH_IMPLOT3DImPlot3D3D plotting
IMGUI_BUNDLE_WITH_IMGUI_NODE_EDITORNode editor
IMGUI_BUNDLE_WITH_IMGUI_MDMarkdownDepends on immapp
IMGUI_BUNDLE_WITH_IMGUIZMOImGuizmo3D gizmos
IMGUI_BUNDLE_WITH_NANOVGNanoVGNeeds OpenGL3 or Metal
IMGUI_BUNDLE_WITH_IMFILEDIALOGImFileDialogNeeds OpenGL3
IMGUI_BUNDLE_WITH_IMGUI_TEX_INSPECTTexture inspectorNeeds OpenGL3
IMGUI_BUNDLE_WITH_IMMVISIONImmVisionNeeds OpenGL3
IMGUI_BUNDLE_WITH_IMANIMImAnimAnimation library
IMGUI_BUNDLE_WITH_IMGUI_EXPLORER_LIBImGui ExplorerInteractive widget explorer

Dependency chain: CMake automatically disables dependent modules. For example, setting IMGUI_BUNDLE_WITH_HELLO_IMGUI=OFF also disables immapp, imgui_md, test_engine, and the GLFW backend.

Convention: CMake option names and C++ #define names are identical. For example, IMGUI_BUNDLE_WITH_IMANIM is both the option() and the #ifdef guard in C++.

Legacy options: IMGUI_BUNDLE_DISABLE_* options are deprecated (removal ~January 2028). Use IMGUI_BUNDLE_WITH_*=OFF instead.

Backend selection

You need at least one platform backend and one rendering backend:

Platform backends:

OptionBackend
HELLOIMGUI_USE_GLFW3GLFW3 (recommended default)
HELLOIMGUI_USE_SDL2SDL2

Rendering backends:

OptionBackendNotes
HELLOIMGUI_HAS_OPENGL3OpenGL3Recommended, especially for beginners
HELLOIMGUI_HAS_METALMetalmacOS/iOS only
HELLOIMGUI_HAS_VULKANVulkanAdvanced
HELLOIMGUI_HAS_DIRECTX11DirectX 11Windows only, experimental
HELLOIMGUI_HAS_DIRECTX12DirectX 12Windows only, experimental

If you make no choice, the default is GLFW3 + OpenGL3.

Other build options

OptionDefaultDescription
IMGUI_BUNDLE_BUILD_PYTHONOFF (ON via pip)Build Python bindings
IMGUI_BUNDLE_BUILD_DEMOSON (top-level)Build C++ demo executables
IMGUI_BUNDLE_BUILD_IMGUI_EXPLORER_APPOFFBuild ImGui Explorer standalone app
IMGUI_BUNDLE_INSTALL_CPPON (top-level, non-Python)Install C++ targets
IMGUI_BUNDLE_AUTO_CLONE_SUBMODULESONAuto-clone submodules during configure
HELLOIMGUI_WITH_TEST_ENGINEON (desktop)Include ImGui Test Engine
HELLOIMGUI_USE_FREETYPEautoUse FreeType for font rendering
IMMVISION_FETCH_OPENCVOFFFetch & build OpenCV for ImmVision
IMGUI_BUNDLE_BUILD_CI_AUTOMATION_TESTSOFFBuild CI automation tests
IMGUI_BUNDLE_WITH_IMANIM_FULL_DEMOSONInclude all ImAnim author demos in manual

For pip builds, pass CMake options via the CMAKE_ARGS environment variable:

CMAKE_ARGS="-DIMGUI_BUNDLE_WITH_IMMVISION=OFF" pip install -v -e .

Common build scenarios

Desktop C++ (minimal)

mkdir -p builds/desktop && cd builds/desktop
cmake ../.. --preset default
cmake --build . -j

Python bindings with ImmVision

mkdir -p builds/python && cd builds/python
cmake ../.. --preset python_bindings \
    -DPython_EXECUTABLE=$(which python) \
    -DIMMVISION_FETCH_OPENCV=ON
cmake --build . -j

Emscripten (ImGui Bundle Explorer)

just ibex_build       # builds into build_ibex_ems/
just ibex_serve       # serve on port 8642

Or manually:

mkdir -p builds/ems && cd builds/ems
source ~/emsdk/emsdk_env.sh
emcmake cmake ../.. -DCMAKE_BUILD_TYPE=Release
make -j

Emscripten (ImGui Explorer, lightweight)

just imex_ems_build   # builds into build_imex_ems/
just imex_ems_serve   # serve on port 7006, add ?lib=imgui etc. to URL

Pyodide (Python in the browser)

just pyodide_setup_local_build    # one-time setup
just pyodide_build                # build wheel
just pyodide_test_serve           # serve test page

See also ci_scripts/pyodide_local_build/Readme.md.

Offline build (vcpkg)

git clone https://github.com/microsoft/vcpkg && ./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install opencv freetype glfw3 lunasvg
export CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build && cd build && cmake ..

justfile reference

The justfile at the repo root provides shortcuts for common tasks. Run just to list all commands.

Library management (just libs_*)

CommandDescription
just libs_infoShow all libraries with their remotes and branches
just libs_reattachReattach all submodules to branches (fork + official)
just libs_fetchFetch all remotes for all submodules
just libs_pullPull all submodules
just libs_check_upstreamCheck which forks have new upstream changes
just libs_log <name>Show new upstream commits for a fork library
just libs_rebase <name>Tag and rebase a fork on its upstream
just libs_tag <name>Push a date tag to a fork library
just libs_bindings <name>Regenerate bindings for one library
just libs_bindings_allRegenerate all bindings

Build & deploy

CommandDescription
just ibex_buildBuild ImGui Bundle Explorer (Emscripten + OpenCV)
just ibex_serveServe explorer on port 8642
just ibex_deployDeploy explorer to traineq.org
just imex_ems_buildBuild ImGui Explorer (Emscripten, lightweight)
just imex_ems_serveServe ImGui Explorer on port 7006
just imex_ems_deployDeploy ImGui Explorer to GitHub Pages

Documentation

CommandDescription
just doc_serve_interactiveBuild docs with live reload
just doc_build_staticBuild static HTML
just doc_serve_staticServe static HTML on port 7005
just doc_build_pdfBuild PDF

Testing

CommandDescription
just test_pytestRun pytest
just test_mypyRun mypy on bindings

Pyodide

CommandDescription
just pyodide_setup_local_buildInstall tools for local Pyodide builds
just pyodide_buildBuild Pyodide wheel
just pyodide_test_serveServe browser test page
just pyodide_cleanClean Pyodide build artifacts

CI / Docker

CommandDescription
just cibuild_docker_musllinuxRun a musllinux Docker container with repo mounted
just cibuild_docker_manylinuxRun a manylinux Docker container with repo mounted