简介
GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc.
https://www.glfw.org/
下载
https://github.com/glfw/glfw
git clone https://github.com/glfw/glfw.git
编译
- linux直接编译,会报错误:
error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
error: ‘M_PI’ undeclared (first use in this function)
需要在 CMakeLists.txt 中添加
add_definitions(-std=gnu99)
- 动态编译
cmake -DBUILD_SHARED_LIBS=ON .
make
编译结果
./src/libglfw.so.3
./src/libglfw.so
./src/libglfw.so.3.4
- 静态编译
cmake .
make