OpenGL starter project with GLFW using CMake.
Note: This project currently uses glad
to generate OpenGL 4.1 Core. Edit lib/CMakeLists.txt
if you want to change this.
To use project template, you need to install the following:
You will also need the Jinja2
Python package. You can install it using pip by running this command:
pip install jinja2
In a terminal with Git installed, clone the repository by typing in the following command in a directory where you want your project:
$ git clone --recurse-submodules https://github.com/dante1130/glfw-opengl-cmake-starter
CMake generates the project files for a subset of buildsystem that you may want to use.
I recommend using Ninja so I'll use that as an example.
See here for a list of all CMake generators: https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html
Alternatively, most modern IDEs like Visual Studio and CLion have CMake support, so you may use your IDE to generate instead.
To generate for the Ninja buildsystem, run the following command:
$ cmake -S . -B build -G "Ninja"
In the build
directory, you will see that the files for the Ninja buildsystem has been generated.
$ cmake --build build
The compiled executable will now be in build/bin
.
Alternatively, most modern IDEs like Visual Studio and CLion have CMake support, so you may use your IDE to build instead.