ImGUI CMake+vcpkg project
Preconfigured CMake + vcpkg project for FFU as a base of other projects.
Source
The app source is a copy of
example_glfw_opengl3
with some modifications with a goal to hide a backend initialization spaghetti
code. The hidden code located in imgui_bootstrap.hpp
header file.
Build
The next set of backend libs is used for ImGUI:
- opengl;
- glfw3;
- glad;
- glm.
All of them are fetched by vcpkg
. Only ImGUI
is fetched from GitHub
repo with FetchContent
tool. See
deps/imgui.cmake
.
For Windows "Visual Studio 15 2017" is used. For Linux GCC with C++17 support is used. The compiler must be installed on your system before the configuring. Ninja is required for the Linux build too.
If you want to build a release version change CMAKE_BUILD_TYPE
in
CMakePresets.json
file.
Fast way
You have just to run a preconfigured CMake script to init vcpkg, configure and build all.
cmake -P build_all.cmake
or separately
cmake -D CONFIGURE=YES -P build_all.cmake
cmake -D BUILD=YES -P build_all.cmake
By hand
Go to the root folder and clone vcpkg
.
git clone https://github.com/microsoft/vcpkg.git
Then configure CMake with a preset accoring to your OS.
cmake --preset=windows .
# or
cmake --preset=linux .
Build the executable:
cmake --build build
Run
After the building, the executable should appear somewhere in build
folder.
On Windows it should be in Debug
subfolder.
Debug
The project's been preconfigured for VS Code
IDE. See .vscode
folder files. Just
- open the project in VS Code,
- install C++ and CMake extentions,
- rename
settings.template.json
tosettings.json
, - select one of CMake, presets,
- press the build button.
After that, you can select launch configuration according to your platform and
start debugging. Pay attention to linux.env
file if you are on the Linux
platform: DISPLAY
variable must be selected correctly or deleted from there.