基於cmake編譯glew


cmake已經成為了C/C++開源項目的主流構建工具。glew也提供了cmake的腳本,但用cmake編譯glew容易采坑:glew的github上的代碼,無論是master分支還是glew-2.1.0這個tag,都無法正確用cmake編譯(Linux、OSX親測,均失敗);必須從sourceforge上下載glew,sourceforge下載的glew-2.1.0.tgz才能被cmake正確編譯。

tar -zxvf glew-2.1.0.tgz
cd glew-2.1.0
cd build
mkdir linux
cd linux
cmake ../cmake -DCMAKE_INSTALL_PREFIX=./install
make

你個混球,@Nigel Stewart,浪費我時間。

p.s. 如果cmake報錯提示:
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)

則需要安裝:
sudo apt-fast install libgl1-mesa-dev

如果cmake報錯提示:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_glu_LIBRARY (ADVANCED)

則需要安裝:
sudo apt-get install libglu1-mesa-dev


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM