Make the default driver selectable at configure time

When building COGL with multiple backends it can be useful to force a
default driver to be selected. For example while for Debian we do want to
build the GL renderer on ARM, GLESv2 is much more suitable as the
default renderer on that platform.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8a43aa7167b56784f7b50c557391b990861d594f)
This commit is contained in:
Sjoerd Simons 2012-06-20 09:47:41 +02:00 committed by Robert Bragg
parent 69c6d50774
commit cde0eb3e76
3 changed files with 25 additions and 1 deletions

View File

@ -32,6 +32,12 @@ AM_CPPFLAGS = \
-DCOGL_LOCALEDIR=\""$(localedir)"\" \ -DCOGL_LOCALEDIR=\""$(localedir)"\" \
$(NULL) $(NULL)
if HAVE_COGL_DEFAULT_DRIVER
AM_CPPFLAGS += \
-DCOGL_DEFAULT_DRIVER=\"$(COGL_DEFAULT_DRIVER)\"
endif
AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
BUILT_SOURCES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h BUILT_SOURCES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h

View File

@ -260,6 +260,11 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
} }
} }
#ifdef COGL_DEFAULT_DRIVER
if (!driver_name)
driver_name = COGL_DEFAULT_DRIVER;
#endif
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
if (renderer->driver_override == COGL_DRIVER_GL || if (renderer->driver_override == COGL_DRIVER_GL ||
(renderer->driver_override == COGL_DRIVER_ANY && (renderer->driver_override == COGL_DRIVER_ANY &&

View File

@ -612,7 +612,7 @@ AM_CONDITIONAL([COGL_DRIVER_GL_SUPPORTED], [test "x$enable_gl" = "xyes"])
AM_CONDITIONAL([COGL_DRIVER_GLES_SUPPORTED], AM_CONDITIONAL([COGL_DRIVER_GLES_SUPPORTED],
[test "x$enable_gles1" = "xyes" || test "x$enable_gles2" = "xyes"]) [test "x$enable_gles1" = "xyes" || test "x$enable_gles2" = "xyes"])
dnl Allow the GL library names to be overridden with configure options dnl Allow the GL library names and default driver to be overridden with configure options
AC_ARG_WITH([gl-libname], AC_ARG_WITH([gl-libname],
[AS_HELP_STRING([--with-gl-libname], [AS_HELP_STRING([--with-gl-libname],
override the name of the GL library to dlopen)], override the name of the GL library to dlopen)],
@ -625,6 +625,15 @@ AC_ARG_WITH([gles2-libname],
[AS_HELP_STRING([--with-gles2-libname], [AS_HELP_STRING([--with-gles2-libname],
override the name of the GLESv2 library to dlopen)], override the name of the GLESv2 library to dlopen)],
[COGL_GLES2_LIBNAME="$withval"]) [COGL_GLES2_LIBNAME="$withval"])
AC_ARG_WITH([default-driver],
[AS_HELP_STRING([--with-default-driver],
specify a default cogl driver)],
[COGL_DEFAULT_DRIVER="${withval}"],
[COGL_DEFAULT_DRIVER="" ])
AM_CONDITIONAL(HAVE_COGL_DEFAULT_DRIVER,
[ test "x$COGL_DEFAULT_DRIVER" != "x" ])
AC_SUBST([COGL_GL_LIBNAME]) AC_SUBST([COGL_GL_LIBNAME])
AC_SUBST([HAVE_GL]) AC_SUBST([HAVE_GL])
@ -632,6 +641,7 @@ AC_SUBST([COGL_GLES1_LIBNAME])
AC_SUBST([HAVE_GLES1]) AC_SUBST([HAVE_GLES1])
AC_SUBST([COGL_GLES2_LIBNAME]) AC_SUBST([COGL_GLES2_LIBNAME])
AC_SUBST([HAVE_GLES2]) AC_SUBST([HAVE_GLES2])
AC_SUBST([COGL_DEFAULT_DRIVER])
if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then
AC_DEFINE([HAVE_DIRECTLY_LINKED_GL_LIBRARY], [1], AC_DEFINE([HAVE_DIRECTLY_LINKED_GL_LIBRARY], [1],
@ -1234,6 +1244,9 @@ echo "Cogl - $COGL_1_VERSION/$COGL_VERSION (${COGL_RELEASE_STATUS})"
echo "" echo ""
echo " • Global:" echo " • Global:"
echo " Prefix: ${prefix}" echo " Prefix: ${prefix}"
if test "x$COGL_DEFAULT_DRIVER" != "x"; then
echo " Default driver: ${COGL_DEFAULT_DRIVER}"
fi
echo "" echo ""
# Features # Features