OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
-FIND_PACKAGE(OpenGL REQUIRED)
-INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
-LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
+# OpenGL ES support
+OPTION(FREEGLUT_GLES1 "Use OpenGL ES 1.x (requires EGL)" OFF)
+OPTION(FREEGLUT_GLES2 "Use OpenGL ES 2.x (requires EGL) (overrides BUILD_GLES1)" OFF)
+
+IF(FREEGLUT_GLES2)
+ ADD_DEFINITIONS(-DGLESv2)
+ LIST(APPEND LIBS GLESv2 EGL)
+ELSEIF(FREEGLUT_GLES1)
+ ADD_DEFINITIONS(-DGLESv1)
+ LIST(APPEND LIBS GLESv1 EGL)
+ELSE()
+ FIND_PACKAGE(OpenGL REQUIRED)
+ LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
+ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+ENDIF()
# lib m for math, not needed on windows
IF (NOT WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ENDIF()
-if(UNIX)
+if(UNIX AND NOT ANDROID)
FIND_PACKAGE(X11 REQUIRED)
LIST(APPEND LIBS ${X11_LIBRARIES})
IF(X11_Xrandr_FOUND)