Simple template to get started with Dear ImGui using GLFW and GLEW.
This template uses cmkr together with vcpkg for frictionless cross platform dependency management with CMake.
Clone this repository and open it in your favorite IDE with CMake support (Visual Studio, CLion, Qt Creator). Everything should work out of the box.
cmake -B build
cmake --build build
Note: On Ubuntu you need to run sudo apt-get install libgl-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev
to use this template.
Under the hood cmkr generates the CMakeLists.txt
required to build this project from the cmake.toml
file:
[cmake]
version = "3.15"
cmkr-include = "cmake/cmkr.cmake"
[project]
name = "imgui_template"
# See https://github.com/microsoft/vcpkg#getting-started on how to use vcpkg
# Chose a version from https://github.com/microsoft/vcpkg/releases
# During CMake configuration you will be told how to find and link to the packages
[vcpkg]
version = "2021.05.12"
packages = ["glfw3", "GLEW"]
# vcpkg will download the packages, but you still need to find them to use them
[find-package]
glfw3 = {}
GLEW = {}
[target.imgui]
type = "static"
sources = [
"third_party/imgui/*.cpp",
"third_party/imgui/*.h",
"third_party/imgui/backends/imgui_impl_glfw.cpp",
"third_party/imgui/backends/imgui_impl_glfw.h",
"third_party/imgui/backends/imgui_impl_opengl3.cpp",
"third_party/imgui/backends/imgui_impl_opengl3.h",
]
include-directories = ["third_party/imgui"]
link-libraries = ["glfw", "GLEW::GLEW"]
compile-features = ["cxx_std_11"]
[target.example]
type = "executable"
sources = ["src/main.cpp"]
link-libraries = ["imgui"]