CMake: option to build with OpenGL ES

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1102 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
beuc 2012-03-11 09:18:15 +00:00
parent c8a8d03fc5
commit 70e2afb9cc

View File

@ -86,9 +86,21 @@ SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
# 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)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
ENDIF()
# lib m for math, not needed on windows
IF (NOT WIN32)
@ -100,7 +112,7 @@ IF(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)