Minimal template app: CMake, Dear ImGui, OpenGL (desktop) / WebGL2 (Emscripten), GLM, and a hardcoded colored triangle.
NuGet supplies GLFW/GLEW on MSVC; ImGui is vendored under third_party/.
| Piece | Location |
|---|---|
| Dear ImGui (+ GLFW/OpenGL3 backends) | third_party/imgui/ (vendored copy) |
| GLM | third_party/glm/ |
| GLFW + GLEW (native) | NuGet via CMake (MSVC) |
third_party/imgui/imgui_impl_glfw.cpp includes the physical-pixel canvas sizing from
imgui#7519.
Details: third_party/imgui/PATCHES.md.
Requires CMake, a C++20 compiler, and nuget on PATH for GLFW/GLEW (choco install nuget.commandline).
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release
.\build\Release\emgui.exeUses emsdk. This repo assumes it lives at C:\src\emsdk.
# Activate the toolchain (same shell for the rest)
. C:\src\emsdk\emsdk_env.ps1
# Configure + build (Ninja recommended)
emcmake cmake -S . -B build-em -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build-em
# Serve the build output (needs a local HTTP server; file:// will not work for Wasm)
python -m http.server 8000 --directory build-emOpen http://localhost:8000/emgui.html — that is the generated page (emcc fills in the shell).
Debug (source maps):
emcmake cmake -S . -B build-em -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build-emcmake/modules/ FindGLFW3 / FindGLEW (native)
src/ main + triangle renderer
third_party/ imgui, glm
web/shell.html Emscripten HTML shell template (used via --shell-file)