posted on: 2015-07-08 10:43:23
Quick reminder of how I build a GLFW project.

This is easy, especially since they use cmake. First I installed cmake and gnu build tools. Then I cloned GLFW from github and I ran the command:

cmake -DCMAKE_INSTALL_PREFIX:PATH=/path/where/i/install

Of course this had errors since I was missing a bunch of -devel libs. So I installed them as cmake requested during building.

sudo dnf install mesa-libGL-devel
sudo dnf install libXrandr-devel
sudo dnf install libXinerama-devel
sudo dnf install libXcursor-devel
sudo dnf install mesa-libGLU-devel

Then the standard make/make install. (If you install doxygen you can also build the docs).

Next step is building a project. First I used pkg-config.

export GLFW_PC=/path/to/lib/pkgconfig/glfw3.pc
export GLFW_CFLAGS=$(pkg-config --cflags "$GLFW_PC")
export GLFW_LIBS=$(pkg-config --static --libs "$GLFW_PC")

Then I built the project fastshadows.

g++ -std=c++11 $GLFW_CFLAGS *.cpp -lGLEW $GLFW_LIBS -o fastshadows

(I also had to install glew for this.)

Comments

Matt
2016-03-04 13:14:21
Turns out glfw3.pc no longer inclues the the libs, so additionaly -lGL needs to be included.
Matt
2019-03-05 04:49:17
This is still nearly an essential resource, if for nothing other than the -DCMAKE_INSTALL_PREFIX:PATH=/path/where/i/install Helps me nearly every time I try a cmake project.
Name: