linux编译freeglut

freeglut 是 GLUT (OpenGL Utility Toolkit)的一个免费开源替代库。在程序中负责创建窗口、初始化 OpenGL 上下文和处理输入事件所需的所有系统特定的杂务,从而允许创建真正可移植的 OpenGL 程序。

源码路径
https://github.com/freeglut/freeglut

编译选项

Breakdown of CMake configuration options
----------------------------------------
CMAKE_BUILD_TYPE            [Empty, Debug, Release] Can be overridden by
                            passing it as a make variable during build.
CMAKE_INSTALL_PREFIX        Installation prefix (e.g. /usr/local on UNIX)
FREEGLUT_BUILD_DEMOS        [ON, OFF] Controls whether the demos are
                            built or not.
FREEGLUT_BUILD_SHARED_LIBS  [ON, OFF] Build freeglut as a shared library
FREEGLUT_BUILD_STATIC_LIBS  [ON, OFF] Build freeglut as a static library
FREEGLUT_GLES               [ON, OFF] Link with GLEs libraries instead
                            of OpenGL
FREEGLUT_WAYLAND            [ON, OFF] Link with Wayland libraries instead
                            of X11
FREEGLUT_PRINT_ERRORS       [ON, OFF] Controls whether errors are
                            default handled or not when user does not
                            provide an error callback
FREEGLUT_PRINT_WARNINGS     [ON, OFF] Controls whether warnings are
                            default handled or not when user does not
                            provide an warning callback
FREEGLUT_REPLACE_GLUT       [ON, OFF] For non-Windows platforms,
                            freeglut is by default built as -lglut. if
                            off, built as -lfreeglut. On Windows,
                            libraries are always built as freeglut.
INSTALL_PDB                 [ON, OFF] MSVC only: controls whether debug
                            information files are included with the
                            install or not
mkdir build
cd build/
cmake .. -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_DEBUG_POSTFIX="_d" -DCMAKE_INSTALL_PREFIX=publish/Debug -DBUILD_SHARED_LIBS=ON
export NPROC=$(nproc)
ninja -j${NPROC}
ninja install
 
mkdir build-release
cd build-release/
cmake .. -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=publish/Release -DBUILD_SHARED_LIBS=ON
ninja install

参考资料

freeglut官网
OpenGL ES freeglut 下载和使用

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容