diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 14:50:58 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-01-18 14:50:58 -0500 |
commit | 2d5743959278a12347f92cc389905dfb5bf39ee6 (patch) | |
tree | 189951c613176440bb501f042e0fd88b2c9b1a78 | |
parent | 40e49ac7b52713fef8cc8b623ad78a4ef0cd55e3 (diff) |
clients: Allow compiling with the cairo glesv2 backend
This disables gears and wscreensaver, which use full GL.
-rw-r--r-- | clients/Makefile.am | 43 | ||||
-rw-r--r-- | clients/window.c | 18 | ||||
-rw-r--r-- | configure.ac | 15 |
3 files changed, 52 insertions, 24 deletions
diff --git a/clients/Makefile.am b/clients/Makefile.am index e323de6..ddc8dac 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -18,7 +18,6 @@ endif if BUILD_CLIENTS clients_programs = \ - gears \ flower \ screenshot \ terminal \ @@ -26,8 +25,8 @@ clients_programs = \ dnd \ smoke \ resizor \ - wscreensaver \ - eventdemo + eventdemo \ + $(full_gl_client_programs) desktop_shell = weston-desktop-shell tablet_shell = weston-tablet-shell @@ -37,7 +36,7 @@ noinst_LIBRARIES = libtoytoolkit.a AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = \ -DDATADIR='"$(datadir)"' \ - $(CLIENT_CFLAGS) + $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS) libtoytoolkit_a_SOURCES = \ window.c \ @@ -47,10 +46,7 @@ libtoytoolkit_a_SOURCES = \ toolkit_libs = \ libtoytoolkit.a \ - $(CLIENT_LIBS) -lrt -lm - -gears_SOURCES = gears.c -gears_LDADD = $(toolkit_libs) + $(CLIENT_LIBS) $(CAIRO_EGL_LIBS) -lrt -lm flower_SOURCES = flower.c flower_LDADD = $(toolkit_libs) @@ -73,17 +69,6 @@ smoke_LDADD = $(toolkit_libs) resizor_SOURCES = resizor.c resizor_LDADD = $(toolkit_libs) -wscreensaver_SOURCES = \ - wscreensaver.c \ - wscreensaver.h \ - desktop-shell-client-protocol.h \ - desktop-shell-protocol.c \ - wscreensaver-glue.c \ - wscreensaver-glue.h \ - glmatrix.c \ - matrix3.xpm -wscreensaver_LDADD = $(toolkit_libs) -lGLU - eventdemo_SOURCES = eventdemo.c eventdemo_LDADD = $(toolkit_libs) @@ -112,6 +97,26 @@ BUILT_SOURCES = \ CLEANFILES = $(BUILT_SOURCES) endif +if BUILD_FULL_GL_CLIENTS +full_gl_client_programs = \ + gears \ + wscreensaver + +gears_SOURCES = gears.c +gears_LDADD = $(toolkit_libs) + +wscreensaver_SOURCES = \ + wscreensaver.c \ + wscreensaver.h \ + desktop-shell-client-protocol.h \ + desktop-shell-protocol.c \ + wscreensaver-glue.c \ + wscreensaver-glue.h \ + glmatrix.c \ + matrix3.xpm +wscreensaver_LDADD = $(toolkit_libs) -lGLU +endif + @wayland_scanner_rules@ if HAVE_POPPLER diff --git a/clients/window.c b/clients/window.c index 4dd9960..4717711 100644 --- a/clients/window.c +++ b/clients/window.c @@ -2743,13 +2743,24 @@ init_egl(struct display *d) EGL_NONE }; +#ifdef USE_CAIRO_GLESV2 + static const EGLint context_attribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + EGLint api = EGL_OPENGL_ES_API; +#else + EGLint *context_attribs = NULL; + EGLint api = EGL_OPENGL_API; +#endif + d->dpy = eglGetDisplay(d->display); if (!eglInitialize(d->dpy, &major, &minor)) { fprintf(stderr, "failed to initialize display\n"); return -1; } - if (!eglBindAPI(EGL_OPENGL_API)) { + if (!eglBindAPI(api)) { fprintf(stderr, "failed to bind api EGL_OPENGL_API\n"); return -1; } @@ -2766,13 +2777,14 @@ init_egl(struct display *d) return -1; } - d->rgb_ctx = eglCreateContext(d->dpy, d->rgb_config, EGL_NO_CONTEXT, NULL); + d->rgb_ctx = eglCreateContext(d->dpy, d->rgb_config, + EGL_NO_CONTEXT, context_attribs); if (d->rgb_ctx == NULL) { fprintf(stderr, "failed to create context\n"); return -1; } d->argb_ctx = eglCreateContext(d->dpy, d->argb_config, - EGL_NO_CONTEXT, NULL); + EGL_NO_CONTEXT, context_attribs); if (d->argb_ctx == NULL) { fprintf(stderr, "failed to create context\n"); return -1; diff --git a/configure.ac b/configure.ac index 2f2cee4..1123312 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,16 @@ if test x$enable_wayland_compositor == xyes; then PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client wayland-egl]) fi +AC_ARG_WITH(cairo-glesv2, AS_HELP_STRING([--with-cairo-gles2], + [Use GLESv2 cairo instead of full GL]), + [cairo_modules="cairo-glesv2"], + [cairo_modules="cairo-gl"]) +AM_CONDITIONAL(BUILD_FULL_GL_CLIENTS, + test x$cairo_modules == "xcairo-gl") +if test x$cairo_modules == xcairo-glesv2; then + AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend]) +fi + AC_ARG_ENABLE(simple-clients, [ --enable-simple-clients],, enable_simple_clients=yes) AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test x$enable_simple_clients == xyes) if test x$enable_simple_clients == xyes; then @@ -104,12 +114,13 @@ AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients == xyes) if test x$enable_clients == xyes; then AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients]) - PKG_CHECK_MODULES(CLIENT, [wayland-client wayland-egl egl >= 7.10 gl cairo >= 1.10.0 gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 xkbcommon]) + PKG_CHECK_MODULES(CLIENT, [wayland-client wayland-egl egl >= 7.10 cairo >= 1.10.0 gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 xkbcommon]) PKG_CHECK_MODULES(POPPLER, [poppler-glib], [have_poppler=yes], [have_poppler=no]) - PKG_CHECK_MODULES(CAIRO_EGL, [cairo-egl >= 1.11.3], + PKG_CHECK_MODULES(CAIRO_EGL, [cairo-egl >= 1.11.3 $cairo_modules], [have_cairo_egl=yes], [have_cairo_egl=no]) + AS_IF([test "x$have_cairo_egl" = "xyes"], [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])], [AC_MSG_WARN([Cairo-EGL not found - clients will use cairo image])]) |