Skip to content

libigl example project

A blank project example showing how to use libigl and cmake can be found here. Feel free and encouraged to copy or fork this project as a way of starting a new personal project using libigl.

See the tutorial first

Then build, run and understand the libigl tutorial.


The only dependencies are the STL, libigl, Eigen3 (included in libigl) and the dependencies of the igl::opengl::glfw::Viewer.

libigl can be installed by cloning the git repository on your computer:

git clone
In the next section we discuss how to find an existing copy of libigl when compiling the example project.

For ease of use, it can be a good idea to place your example project right next to the libigl folder. For example, if libigl is installed in ~/foo/libigl, then you can create a copy of the example project right next to it:

git clone ~/foo/libigl-example-project


Compile this project using the standard CMake routine:

mkdir build
cd build
cmake ../

Just make sure that CMake is able to find libigl. To do so CMake checks a few directories and environment variables, see FindLIBIGL.cmake. If your libigl version is located elsewhere, you can set the environment variable LIBIGL_DIR to the root directory of libigl, or pass this variable when invoking CMake from the command line:

cmake -DLIBIGL_DIR=<path-to-libigl> ..

This should find and build the dependencies and create a example_bin binary.


From within the build directory just issue:


A glfw app should launch displaying a 3D cube.

Libigl example project: libigl/libigl-example-project