This commit is contained in:
linkmauve 2015-07-28 15:06:11 +00:00
commit 5d4620120a
7 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,16 @@
# Find libepoxy
#
# EPOXY_INCLUDE_DIR
# EPOXY_LIBRARY
# EPOXY_FOUND
find_path(EPOXY_INCLUDE_DIR NAMES epoxy/gl.h PATHS /opt/vc/include)
set(EPOXY_NAMES ${EPOXY_NAMES} epoxy)
find_library(EPOXY_LIBRARY NAMES ${EPOXY_NAMES} PATHS /opt/vc/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EPOXY DEFAULT_MSG EPOXY_LIBRARY EPOXY_INCLUDE_DIR)
mark_as_advanced(EPOXY_INCLUDE_DIR EPOXY_LIBRARY)

View File

@ -61,7 +61,7 @@ set(CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
if (GLFW_USE_EGL) if (GLFW_USE_EGL)
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
"The client library to use; one of opengl, glesv1 or glesv2") "The client library to use; one of opengl, glesv1, glesv2 or epoxy")
if (${GLFW_CLIENT_LIBRARY} STREQUAL "opengl") if (${GLFW_CLIENT_LIBRARY} STREQUAL "opengl")
set(_GLFW_USE_OPENGL 1) set(_GLFW_USE_OPENGL 1)
@ -69,13 +69,15 @@ if (GLFW_USE_EGL)
set(_GLFW_USE_GLESV1 1) set(_GLFW_USE_GLESV1 1)
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv2") elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv2")
set(_GLFW_USE_GLESV2 1) set(_GLFW_USE_GLESV2 1)
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "epoxy")
set(_GLFW_USE_EPOXY 1)
else() else()
message(FATAL_ERROR "Unsupported client library") message(FATAL_ERROR "Unsupported client library")
endif() endif()
find_package(EGL REQUIRED) find_package(EGL REQUIRED)
if (NOT _GLFW_USE_OPENGL) if (NOT _GLFW_USE_OPENGL AND NOT _GLFW_USE_EPOXY)
set(GLFW_BUILD_EXAMPLES OFF) set(GLFW_BUILD_EXAMPLES OFF)
set(GLFW_BUILD_TESTS OFF) set(GLFW_BUILD_TESTS OFF)
message(STATUS "NOTE: Examples and tests require OpenGL") message(STATUS "NOTE: Examples and tests require OpenGL")
@ -90,6 +92,8 @@ elseif (_GLFW_USE_GLESV1)
find_package(GLESv1 REQUIRED) find_package(GLESv1 REQUIRED)
elseif (_GLFW_USE_GLESV2) elseif (_GLFW_USE_GLESV2)
find_package(GLESv2 REQUIRED) find_package(GLESv2 REQUIRED)
elseif (_GLFW_USE_EPOXY)
find_package(Epoxy REQUIRED)
endif() endif()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -400,6 +404,10 @@ if (_GLFW_EGL)
list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}") list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}")
list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}") list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}")
list(APPEND glfw_PKG_DEPS "glesv2") list(APPEND glfw_PKG_DEPS "glesv2")
elseif (_GLFW_USE_EPOXY)
list(APPEND glfw_LIBRARIES "${EPOXY_LIBRARY}")
list(APPEND glfw_INCLUDE_DIRS "${EPOXY_INCLUDE_DIR}")
list(APPEND glfw_PKG_DEPS "epoxy")
endif() endif()
endif() endif()

View File

@ -80,6 +80,9 @@ header instead of the regular OpenGL header.
`GLFW_INCLUDE_ES31` makes the GLFW header include the OpenGL ES 3.1 `GLES3/gl31.h` `GLFW_INCLUDE_ES31` makes the GLFW header include the OpenGL ES 3.1 `GLES3/gl31.h`
header instead of the regular OpenGL header. header instead of the regular OpenGL header.
`GLFW_INCLUDE_EPOXY` makes the GLFW header include the libepoxy `epoxy/gl.h`
header instead of the regular OpenGL header.
`GLFW_INCLUDE_NONE` makes the GLFW header not include any OpenGL or OpenGL ES API `GLFW_INCLUDE_NONE` makes the GLFW header not include any OpenGL or OpenGL ES API
header. This is useful in combination with an extension loading library. header. This is useful in combination with an extension loading library.

View File

@ -281,6 +281,8 @@ through extensions. The options are:
OpenGL.framework) OpenGL.framework)
- `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental) - `_GLFW_USE_GLESV1` for OpenGL ES 1.x (experimental)
- `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental) - `_GLFW_USE_GLESV2` for OpenGL ES 2.x (experimental)
- `_GLFW_USE_EPOXY` for libepoxy to resolve which of the three previous ones
to use at runtime.
Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL, Note that `_GLFW_USE_GLESV1` and `_GLFW_USE_GLESV2` may only be used with EGL,
as the other context creation APIs do not interface with OpenGL ES client as the other context creation APIs do not interface with OpenGL ES client

View File

@ -149,6 +149,8 @@ extern "C" {
#if defined(GLFW_INCLUDE_GLEXT) #if defined(GLFW_INCLUDE_GLEXT)
#include <GLES3/gl2ext.h> #include <GLES3/gl2ext.h>
#endif #endif
#elif defined(GLFW_INCLUDE_EPOXY)
#include <epoxy/gl.h>
#elif !defined(GLFW_INCLUDE_NONE) #elif !defined(GLFW_INCLUDE_NONE)
#include <GL/gl.h> #include <GL/gl.h>
#if defined(GLFW_INCLUDE_GLEXT) #if defined(GLFW_INCLUDE_GLEXT)

View File

@ -78,4 +78,6 @@
#cmakedefine _GLFW_USE_GLESV1 #cmakedefine _GLFW_USE_GLESV1
// Define this to 1 if using OpenGL ES 2.0 as the client library // Define this to 1 if using OpenGL ES 2.0 as the client library
#cmakedefine _GLFW_USE_GLESV2 #cmakedefine _GLFW_USE_GLESV2
// Define this to 1 if using libepoxy as the client library
#cmakedefine _GLFW_USE_EPOXY

View File

@ -52,6 +52,8 @@
#define GLFW_INCLUDE_ES1 #define GLFW_INCLUDE_ES1
#elif defined(_GLFW_USE_GLESV2) #elif defined(_GLFW_USE_GLESV2)
#define GLFW_INCLUDE_ES2 #define GLFW_INCLUDE_ES2
#elif defined(_GLFW_USE_EPOXY)
#define GLFW_INCLUDE_EPOXY
#else #else
#error "No supported client library selected" #error "No supported client library selected"
#endif #endif