Adding a YAML parser
Like other tools we are already using (the Open Asset Import Library, GLFW, or ImGui), we will use a freely available open source solution: yaml-cpp.
By integrating yaml-cpp, we can read and write YAML files from C++ with minimal effort. The biggest step is to make sure our custom data types are known to yaml-cpp. Plus, we have to think about a proper structure for the data file.
Let’s start by exploring how to integrate yaml-cpp into our project.
Getting yaml-cpp
For Linux systems, getting yaml-cpp is easy. Similar to the other tools, most distributions already contain the yaml-cpp library and header files. For instance, in Ubuntu 22.04 or later, yaml-cpp and its development files can be installed with the following command:
sudo apt install libyaml-cpp-dev
If you are using an Arch based Linux distribution, you can install yaml-cpp with the following command:
sudo pacman –S yaml-cpp
For Windows, we are also in luck...