EmulationStation-retropie/CMake/Packages/FindOpenGLES.cmake
cmitu d5d3cbfc4b cmake: add GLES20 renderer build support
Added support for the GLESv2 renderer to the CMake build.

* Refactored the OpenGLES detection for both versions.
     Platform detection is done only in the main project file, settings hints for the GLES headers/libraries detection in the corresponding 'Find' cmake modules.
* Simplified the additions of directories for includes/libraries, based on the same hints added during detection.

Notes:

* GLESv2 is the default for GLES-enabled systems.

* For the Raspberry Pi systems, both the legacy (BRCM) and the new (MESA) GLES libraries can be present.
 The selection can be done via the `USE_MESA_GLES` CMake option (default: Off)
 By default, the legacy (BRCM) libraries/headers are used, without any special configuration.
 For the Pi4, the GL renderer/system must be explicitely selected
 ** select the OpenGL 2 renderer with `-DGL=On`
 ** select the GLESv2 renderer with `-DUSE_MESA_GLES=On`

* the GLESv1 renderer can still be forcibly enabled using the `FORCE_GLESv1` build option, for platforms where GLESv1 is the only option.

Minor - set the start-up project in MS Visual Studio to 'emulationstation'.
2020-06-11 04:28:59 +01:00

48 lines
1.5 KiB
CMake

# - Try to find OpenGLES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGLES
# OPENGLES_INCLUDE_DIRS - the GL include directory
# OPENGLES_LIBRARIES - Link these to use OpenGLES
if(NOT HINT_GLES_LIBNAME)
set(HINT_GLES_LIBNAME GLESv1_CM)
endif()
if (WIN32)
if(CYGWIN)
find_path(OPENGLES_INCLUDE_DIR GLES/gl.h )
find_library(OPENGLES_gl_LIBRARY libgles_cm )
else(CYGWIN)
if(MSVC)
#The user has to provide this atm. GLES can be emulated via Desktop OpenGL
#using the ANGLE project found at: http://code.google.com/p/angleproject/
SET (OPENGLES_gl_LIBRARY import32 CACHE STRING "OpenGL ES 1.x library for win32")
endif(MSVC)
endif(CYGWIN)
elseif(APPLE)
create_search_paths(/Developer/Platforms)
findpkg_framework(OpenGLES)
set(OPENGLES_gl_LIBRARY "-framework OpenGLES")
else()
find_path(OPENGLES_INCLUDE_DIR GLES/gl.h
PATHS "${CMAKE_FIND_ROOT_PATH}/usr/include"
HINTS "${HINT_GLES_INCDIR}"
)
find_library(OPENGLES_gl_LIBRARY
NAMES ${HINT_GLES_LIBNAME}
HINTS "${HINT_GLES_LIBDIR}"
)
endif(WIN32)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenGLES
REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_INCLUDE_DIR)
if(OPENGLES_FOUND)
set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY})
set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR})
mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY)
endif()