clients: Allow compiling with the cairo glesv2 backend

This disables gears and wscreensaver, which use full GL.
dev
Kristian Høgsberg 13 years ago
parent 40e49ac7b5
commit 2d57439592
  1. 43
      clients/Makefile.am
  2. 18
      clients/window.c
  3. 15
      configure.ac

@ -18,7 +18,6 @@ endif
if BUILD_CLIENTS if BUILD_CLIENTS
clients_programs = \ clients_programs = \
gears \
flower \ flower \
screenshot \ screenshot \
terminal \ terminal \
@ -26,8 +25,8 @@ clients_programs = \
dnd \ dnd \
smoke \ smoke \
resizor \ resizor \
wscreensaver \ eventdemo \
eventdemo $(full_gl_client_programs)
desktop_shell = weston-desktop-shell desktop_shell = weston-desktop-shell
tablet_shell = weston-tablet-shell tablet_shell = weston-tablet-shell
@ -37,7 +36,7 @@ noinst_LIBRARIES = libtoytoolkit.a
AM_CFLAGS = $(GCC_CFLAGS) AM_CFLAGS = $(GCC_CFLAGS)
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-DDATADIR='"$(datadir)"' \ -DDATADIR='"$(datadir)"' \
$(CLIENT_CFLAGS) $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS)
libtoytoolkit_a_SOURCES = \ libtoytoolkit_a_SOURCES = \
window.c \ window.c \
@ -47,10 +46,7 @@ libtoytoolkit_a_SOURCES = \
toolkit_libs = \ toolkit_libs = \
libtoytoolkit.a \ libtoytoolkit.a \
$(CLIENT_LIBS) -lrt -lm $(CLIENT_LIBS) $(CAIRO_EGL_LIBS) -lrt -lm
gears_SOURCES = gears.c
gears_LDADD = $(toolkit_libs)
flower_SOURCES = flower.c flower_SOURCES = flower.c
flower_LDADD = $(toolkit_libs) flower_LDADD = $(toolkit_libs)
@ -73,17 +69,6 @@ smoke_LDADD = $(toolkit_libs)
resizor_SOURCES = resizor.c resizor_SOURCES = resizor.c
resizor_LDADD = $(toolkit_libs) 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_SOURCES = eventdemo.c
eventdemo_LDADD = $(toolkit_libs) eventdemo_LDADD = $(toolkit_libs)
@ -112,6 +97,26 @@ BUILT_SOURCES = \
CLEANFILES = $(BUILT_SOURCES) CLEANFILES = $(BUILT_SOURCES)
endif 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@ @wayland_scanner_rules@
if HAVE_POPPLER if HAVE_POPPLER

@ -2743,13 +2743,24 @@ init_egl(struct display *d)
EGL_NONE 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); d->dpy = eglGetDisplay(d->display);
if (!eglInitialize(d->dpy, &major, &minor)) { if (!eglInitialize(d->dpy, &major, &minor)) {
fprintf(stderr, "failed to initialize display\n"); fprintf(stderr, "failed to initialize display\n");
return -1; return -1;
} }
if (!eglBindAPI(EGL_OPENGL_API)) { if (!eglBindAPI(api)) {
fprintf(stderr, "failed to bind api EGL_OPENGL_API\n"); fprintf(stderr, "failed to bind api EGL_OPENGL_API\n");
return -1; return -1;
} }
@ -2766,13 +2777,14 @@ init_egl(struct display *d)
return -1; 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) { if (d->rgb_ctx == NULL) {
fprintf(stderr, "failed to create context\n"); fprintf(stderr, "failed to create context\n");
return -1; return -1;
} }
d->argb_ctx = eglCreateContext(d->dpy, d->argb_config, d->argb_ctx = eglCreateContext(d->dpy, d->argb_config,
EGL_NO_CONTEXT, NULL); EGL_NO_CONTEXT, context_attribs);
if (d->argb_ctx == NULL) { if (d->argb_ctx == NULL) {
fprintf(stderr, "failed to create context\n"); fprintf(stderr, "failed to create context\n");
return -1; return -1;

@ -91,6 +91,16 @@ if test x$enable_wayland_compositor == xyes; then
PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client wayland-egl]) PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client wayland-egl])
fi 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) AC_ARG_ENABLE(simple-clients, [ --enable-simple-clients],, enable_simple_clients=yes)
AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test x$enable_simple_clients == xyes) AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test x$enable_simple_clients == xyes)
if test x$enable_simple_clients == xyes; then 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 if test x$enable_clients == xyes; then
AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients]) 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], PKG_CHECK_MODULES(POPPLER, [poppler-glib],
[have_poppler=yes], [have_poppler=no]) [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]) [have_cairo_egl=yes], [have_cairo_egl=no])
AS_IF([test "x$have_cairo_egl" = "xyes"], AS_IF([test "x$have_cairo_egl" = "xyes"],
[AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])], [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],
[AC_MSG_WARN([Cairo-EGL not found - clients will use cairo image])]) [AC_MSG_WARN([Cairo-EGL not found - clients will use cairo image])])

Loading…
Cancel
Save