An example of using Dear ImGui with GLFW.
More information about the application in the following article.
Dependencies are built from sources. Provide paths to required libraries source code:
- glad:
-DGLAD_PREFIX="/path/to/glad/generated"
- GLFW:
-DGLFW_PREFIX="/path/to/glfw"
- Dear ImGui:
-DDEAR_IMGUI_PREFIX="/path/to/dearimgui"
By default these paths are set to _dependencies/LIBRARY-NAME
(so you can copy those there).
$ cd /path/to/glfw-imgui-example
$ mkdir build && cd $_
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="../install" \
-DUSING_CONAN=0 \
..
$ cmake --build . --target install
$ ../install/bin/glfw-imgui/glfw-imgui
Pre-built dependencies are fetched from Conan server, only the application itself is built from sources.
Without using CMake preset:
$ cd /path/to/glfw-imgui-example
$ mkdir build && cd $_
$ conan install .. --remote=YOUR-CONAN-REMOTE
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="../install" \
-DUSING_PACKAGE_MANAGER_CONAN=1 \
..
$ cmake --build . --target install
Using CMake preset:
$ cd /path/to/glfw-imgui-example
$ mkdir build/conan && cd $_
$ conan install ../.. -r YOUR-CONAN-REMOTE
$ cd ../..
$ cmake --preset conan
$ cmake --build --preset conan
More information about resolving dependencies with Conan here.
Preparation:
- you need to have vcpkg installed;
- its executable is available in the
PATH
; VCPKG_ROOT
environment variable is set;
- its executable is available in the
- to be able to use CMake presets
v3
, you need to have CMake at leastv3.21
.
Without using CMake preset:
$ cd /path/to/glfw-imgui-example
$ mkdir build && cd $_
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="../install" \
-DUSING_PACKAGE_MANAGER_VCPKG=1 \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
..
$ cmake --build . --target install
Using CMake preset:
$ cd /path/to/glfw-imgui-example
$ cmake --preset vcpkg-default-triplet
$ cmake --build --preset vcpkg-default-triplet
More information about resolving dependencies with vcpkg here.