diff mbox

[16/21] gl: Add GLESv2 backend to build system

Message ID 1311602208-5973-16-git-send-email-alexandros.frantzis@linaro.org
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 25, 2011, 1:56 p.m. UTC
From: Alexandros Frantzis <alexandros.frantzis@linaro.org>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 boilerplate/Makefile.win32.features |   12 ++++++++++++
 build/Makefile.win32.features       |    1 +
 build/Makefile.win32.features-h     |    3 +++
 build/configure.ac.features         |    1 +
 configure.ac                        |   14 ++++++++++++++
 src/Makefile.sources                |    4 ++++
 src/Makefile.win32.features         |   16 ++++++++++++++++
 7 files changed, 51 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features
index b97f6d0..d0b184d 100644
--- a/boilerplate/Makefile.win32.features
+++ b/boilerplate/Makefile.win32.features
@@ -259,6 +259,18 @@  enabled_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_gl_cxx_sources)
 enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources)
 endif
 
+unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_glesv2_headers)
+all_cairo_boilerplate_headers += $(cairo_boilerplate_glesv2_headers)
+all_cairo_boilerplate_private += $(cairo_boilerplate_glesv2_private)
+all_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_glesv2_cxx_sources)
+all_cairo_boilerplate_sources += $(cairo_boilerplate_glesv2_sources)
+ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
+enabled_cairo_boilerplate_headers += $(cairo_boilerplate_glesv2_headers)
+enabled_cairo_boilerplate_private += $(cairo_boilerplate_glesv2_private)
+enabled_cairo_boilerplate_cxx_sources += $(cairo_boilerplate_glesv2_cxx_sources)
+enabled_cairo_boilerplate_sources += $(cairo_boilerplate_glesv2_sources)
+endif
+
 unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_directfb_headers)
 all_cairo_boilerplate_headers += $(cairo_boilerplate_directfb_headers)
 all_cairo_boilerplate_private += $(cairo_boilerplate_directfb_private)
diff --git a/build/Makefile.win32.features b/build/Makefile.win32.features
index d76cf0e..0d0261d 100644
--- a/build/Makefile.win32.features
+++ b/build/Makefile.win32.features
@@ -20,6 +20,7 @@  CAIRO_HAS_GALLIUM_SURFACE=0
 CAIRO_HAS_XCB_DRM_FUNCTIONS=0
 CAIRO_HAS_PNG_FUNCTIONS=1
 CAIRO_HAS_GL_SURFACE=0
+CAIRO_HAS_GLESV2_SURFACE=0
 CAIRO_HAS_DIRECTFB_SURFACE=0
 CAIRO_HAS_VG_SURFACE=0
 CAIRO_HAS_EGL_FUNCTIONS=0
diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h
index f5cbcf1..ce39de3 100644
--- a/build/Makefile.win32.features-h
+++ b/build/Makefile.win32.features-h
@@ -65,6 +65,9 @@  endif
 ifeq ($(CAIRO_HAS_GL_SURFACE),1)
 	@echo "#define CAIRO_HAS_GL_SURFACE 1" >> src/cairo-features.h
 endif
+ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
+	@echo "#define CAIRO_HAS_GLESV2_SURFACE 1" >> src/cairo-features.h
+endif
 ifeq ($(CAIRO_HAS_DIRECTFB_SURFACE),1)
 	@echo "#define CAIRO_HAS_DIRECTFB_SURFACE 1" >> src/cairo-features.h
 endif
diff --git a/build/configure.ac.features b/build/configure.ac.features
index 343442a..e1651d8 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -381,6 +381,7 @@  AC_DEFUN([CAIRO_REPORT],
 	echo "  PDF:           $use_pdf"
 	echo "  SVG:           $use_svg"
 	echo "  OpenGL:        $use_gl"
+	echo "  OpenGL ES 2.0: $use_glesv2"
 	echo "  BeOS:          $use_beos"
 	echo "  DirectFB:      $use_directfb"
 	echo "  OpenVG:        $use_vg"
diff --git a/configure.ac b/configure.ac
index 951e960..9107b3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,20 @@  CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
 ])
 
 dnl ===========================================================================
+CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
+  glesv2_REQUIRES="glesv2"
+  PKG_CHECK_MODULES(glesv2, $glesv2_REQUIRES,, [
+	  dnl Fallback to searching for headers
+	  AC_CHECK_HEADER(GLES2/gl2.h,, [use_glesv2="no (glesv2.pc nor OpenGL ES 2.0 headers not found)"])
+	  if test "x$use_glesv2" = "xyes"; then
+	      glesv2_NONPKGCONFIG_CFLAGS=
+	      glesv2_NONPKGCONFIG_LIBS="-lGLESv2"
+	  fi])
+
+  need_egl_functions=yes
+])
+
+dnl ===========================================================================
 
 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
   directfb_REQUIRES=directfb
diff --git a/src/Makefile.sources b/src/Makefile.sources
index c4ca001..474e092 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -328,6 +328,10 @@  cairo_gl_sources = cairo-gl-composite.c \
 		   cairo-gl-shaders.c \
 		   cairo-gl-surface.c
 
+cairo_glesv2_headers = $(cairo_gl_headers)
+cairo_glesv2_private = $(cairo_gl_private)
+cairo_glesv2_sources = $(cairo_gl_sources)
+
 cairo_egl_sources += cairo-egl-context.c
 cairo_glx_sources += cairo-glx-context.c
 cairo_wgl_sources += cairo-wgl-context.c
diff --git a/src/Makefile.win32.features b/src/Makefile.win32.features
index e1701e7..d7cc77e 100644
--- a/src/Makefile.win32.features
+++ b/src/Makefile.win32.features
@@ -341,6 +341,22 @@  ifeq ($(CAIRO_HAS_GL_SURFACE),1)
 enabled_cairo_pkgconf += cairo-gl.pc
 endif
 
+unsupported_cairo_headers += $(cairo_glesv2_headers)
+all_cairo_headers += $(cairo_glesv2_headers)
+all_cairo_private += $(cairo_glesv2_private)
+all_cairo_cxx_sources += $(cairo_glesv2_cxx_sources)
+all_cairo_sources += $(cairo_glesv2_sources)
+ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
+enabled_cairo_headers += $(cairo_glesv2_headers)
+enabled_cairo_private += $(cairo_glesv2_private)
+enabled_cairo_cxx_sources += $(cairo_glesv2_cxx_sources)
+enabled_cairo_sources += $(cairo_glesv2_sources)
+endif
+all_cairo_pkgconf += cairo-glesv2.pc
+ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
+enabled_cairo_pkgconf += cairo-glesv2.pc
+endif
+
 unsupported_cairo_headers += $(cairo_directfb_headers)
 all_cairo_headers += $(cairo_directfb_headers)
 all_cairo_private += $(cairo_directfb_private)