From 682d7fab54f763212cd40c0ad0b24dba1717ce7f Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Wed, 3 Dec 2014 09:45:51 +0100 Subject: [PATCH] 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 --- configure.ac | 22 ++++++++++++++++++++++ src/Makefile_Evas.am | 1 + 2 files changed, 23 insertions(+) diff --git a/configure.ac b/configure.ac index 8880089ae3..27a6411cb8 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 9e67eacb8d..a625ec67e8 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -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 \