retifrav / glfw-imgui-example

An example of using Dear ImGui with GLFW

Home Page:https://retifrav.github.io/blog/2019/08/04/glfw-dear-imgui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GLFW Dear ImGui example

An example of using Dear ImGui with GLFW.

GLFW and Dear ImGui

More information about the application in the following article.

Building

Without package managers

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

With Conan

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.

With vcpkg

Preparation:

  • you need to have vcpkg installed;
    • its executable is available in the PATH;
    • VCPKG_ROOT environment variable is set;
  • to be able to use CMake presets v3, you need to have CMake at least v3.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.

About

An example of using Dear ImGui with GLFW

https://retifrav.github.io/blog/2019/08/04/glfw-dear-imgui/

License:GNU General Public License v3.0


Languages

Language:C++ 63.8%Language:CMake 17.6%Language:C 17.4%Language:Python 1.2%