GLFW+GLEW+CMAKE in M1 MacOS
运行设备
macbook air macos big sur 11.6 IDE :vscode
预备
glfw :brew install glfw glew :brew install glew
cmake
CMakeLists.txt中载入glfw,与glew
find_package(OpenGL REQUIRED)
find_package(glfw3 3.3 REQUIRED)
include_directories(${GLFW3_INCLUDE_DIR})
find_package(GLEW 2.0 REQUIRED)
include_directories(${GLEW_INCLUDE_DIR})
...
target_link_libraries(GLProject
glfw
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
${GLM_LIBRARIES}
)
打开terminal,
cmake -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 ..
make即可
测试了下不修改DCMAKE_APPLE_SILICON_PROCESSOR=arm64也可以,本篇主要为cmake文件复制了
reference
https://stackoverflow.com/questions/64923977/mac-os-with-m1-encounters-with-an-error-when-using-glfw-glew
|