autotools: fix compiling/linking gl engines on OSX.

Summary:
Until now, it was necessary to set global LDFLAGS and CFLAGS to allow
compiling (and linking) engines using OpenGL.
gl_generic used to complained about missing headers or unkown libraries.
A problem on OSX is that there is CGL (Apple's Core OpenGL) on which the whole system
relies on and GLX, when X11 is installed; and they cohabit together.
When gl_cocoa is enabled, gl_generic is now linked against CGL.
When it is not, gl_generic is compiled with and linked against GLX as a fallback.

@fix

Test Plan:
With --enable-cocoa: software_x11, opengl_x11 and opengl_cocoa are working as expected.
With --disable-cocoa: software_x11 and opengl_x11 are also working as expected.
No compiling nor linking problems have been issued.

Reviewers: cedric, raster, raoulh

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1723

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Jean Guyomarc'h 2014-12-03 09:45:51 +01:00 committed by Cedric BAIL
parent b1f8f3fb17
commit 682d7fab54
2 changed files with 23 additions and 0 deletions

View File

@ -1805,6 +1805,28 @@ else
evas_engine_gl_common_libs="-lGL"
fi
# The lines below fix compiling/linking of gl_generic on OSX
if test "x${have_darwin}" = "xyes"; then
if test "x${have_evas_engine_gl_cocoa}" = "xyes"; then
# If gl_cocoa is enabled, Apple's Core OpenGL (CGL) should be the default OpenGL.
# CFLAGS and LIBS are determined by evas-gl_cocoa.
evas_engine_gl_common_libs="${evas_engine_gl_cocoa_libs}"
evas_engine_gl_common_cflags="${evas_engine_gl_cocoa_cflags}"
else
# If evas-gl_cocoa is disabled, the only supported OpenGL engine on OSX (for now)
# is evas-gl_x11. Without its CFLAGS and LIBS explicitely set, gl_generic
# cannot compile (nor link).
evas_engine_gl_common_libs=""
evas_engine_gl_common_cflags=""
if test "x${have_evas_engine_gl_xlib}" = "xyes"; then
evas_engine_gl_common_libs="${evas_engine_gl_xlib_libs}"
evas_engine_gl_common_cflags="${evas_engine_gl_xlib_cflags}"
fi
### XXX Check for other supported engines supported on OSX (dec. 2014: NONE)
fi
fi
AC_SUBST([evas_engine_gl_common_cflags])
AC_SUBST([evas_engine_gl_common_libs])

View File

@ -711,6 +711,7 @@ modules_evas_engines_gl_generic_module_la_CFLAGS = \
-I$(top_srcdir)/src/lib/evas/include \
-I$(top_srcdir)/src/lib/evas/cserve2 \
-I$(top_srcdir)/src/modules/evas/engines/gl_common \
@evas_engine_gl_common_cflags@ \
@EVAS_CFLAGS@
modules_evas_engines_gl_generic_module_la_LIBADD = \
modules/evas/engines/gl_common/libevas_engine_gl_common.la \