下载源码:https://github.com/glfw/glfw/releases

编译

snippet.bash
[yz@test ~]$ unzip glfw-3.3.3.zip
[yz@test ~]$ cd glfw-3.3.3
[yz@test ~]$ cmake -DBUILD_SHARED_LIBS=ON .
[yz@test ~]$ make
[yz@test ~]$ sudo make install

-DBUILDSHAREDLIBS=ON:表示需要编译动态库。

cmake阶段如果缺少库,请自行安装,例如,以下报错:

snippet.bash
CMake Error at CMakeLists.txt:233 (message):
  XInput headers not found; install libxi development package
 
-- Configuring incomplete, errors occurred!

安装 libXi-devel:

snippet.bash
[yz@test glfw-3.3.3]$ sudo yum install libXi-devel

参考