--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,9 +46,15 @@ add_compile_options(-fsigned-char -fno-strict-aliasing) -# Find OpenGL +# Find OpenGL. Android has no desktop GL/GLX for CMake's FindOpenGL module +# to find - just link the NDK's own GLESv2/EGL libraries directly. if(ENABLE_OPENGL) - find_package(OpenGL REQUIRED) + if(ANDROID) + set(OPENGL_INCLUDE_DIRS "") + set(OPENGL_LIBRARIES GLESv2 EGL) + else() + find_package(OpenGL REQUIRED) + endif() add_definitions(-DUSE_OPENGL) if(WIN32) list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)