[vlc-devel] [PATCH v3 2/2] opengl: split into convenience library

Alexandre Janniaux ajanni at videolabs.io
Mon Jun 29 14:08:03 CEST 2020


Without the two useless flags in libvlc_opengl/es.la LDFLAGS
of course.

Regards,
--
Alexandre Janniaux
Videolabs

On Mon, Jun 29, 2020 at 01:17:30PM +0200, Alexandre Janniaux wrote:
> Create a libvlc_opengl and libvlc_opengles library that are built only
> if one other target is needing it, avoiding to compile the OpenGL code
> once per module using it and removing the need for OPENGL_COMMON* vars.
>
> As the fact we're using OpenGL or OpenGL ES is defined at compile time,
> the clients must use the correct variant depending on what they use.
>
> In addition, this patch refactor the glesv2 detection in order to
> enable both the gles2 display plugin and the libvlc_opengles.la target
> which must not be built on Windows target for example.
> ---
>  configure.ac                            |  9 ++++-
>  modules/video_output/Makefile.am        | 24 ++++++-------
>  modules/video_output/opengl/Makefile.am | 46 ++++++++++++++++++++-----
>  3 files changed, 58 insertions(+), 21 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index e6fb7da932..7739761783 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3311,7 +3311,14 @@ AS_IF([test "${have_gl}" = "yes"], [
>  ])
>
>  dnl OpenGL ES 2: depends on EGL 1.1
> -PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
> +have_gles2="no"
> +AC_ARG_ENABLE(gles2,
> +  [AS_HELP_STRING([--enable-gles2],
> +      [enable GLES2 support (default disabled)])])
> +AS_IF([test "$enable_gles2" = "yes"], [
> +  PKG_CHECK_MODULES([GLES2], [glesv2], [have_gles2="yes"], [])
> +  ])
> +AM_CONDITIONAL([HAVE_GLES2], [test "${have_gles2}" = "yes"])
>
>  dnl
>  dnl Vulkan
> diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
> index f7f3196a98..83fc2bf96a 100644
> --- a/modules/video_output/Makefile.am
> +++ b/modules/video_output/Makefile.am
> @@ -27,15 +27,15 @@ libglinterop_cvpx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,Foundation,-framework,CoreVideo
>
>  if HAVE_OSX
> -libvout_macosx_plugin_la_SOURCES = video_output/macosx.m $(OPENGL_COMMONSOURCES)
> -libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DHAVE_GL_CORE_SYMBOLS
> -libvout_macosx_plugin_la_LIBADD = $(OPENGL_COMMONLIBS)
> +libvout_macosx_plugin_la_SOURCES = video_output/macosx.m
> +libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) -DHAVE_GL_CORE_SYMBOLS
> +libvout_macosx_plugin_la_LIBADD = libvlc_opengl.la
>  libvout_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,OpenGL,-framework,Cocoa
>
> -libcaopengllayer_plugin_la_SOURCES = video_output/caopengllayer.m $(OPENGL_COMMONSOURCES)
> -libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DHAVE_GL_CORE_SYMBOLS
> -libcaopengllayer_plugin_la_LIBADD = $(OPENGL_COMMONLIBS)
> +libcaopengllayer_plugin_la_SOURCES = video_output/caopengllayer.m
> +libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS)  -DHAVE_GL_CORE_SYMBOLS
> +libcaopengllayer_plugin_la_LIBADD = libvlc_opengl.la
>  libcaopengllayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,OpenGL,-framework,Cocoa,-framework,QuartzCore
>
> @@ -47,9 +47,9 @@ if HAVE_IOS
>  libglinterop_cvpx_plugin_la_CFLAGS = $(AM_CFLAGS) -DUSE_OPENGL_ES2
>  endif
>
> -libvout_ios_plugin_la_SOURCES = video_output/ios.m $(OPENGL_COMMONSOURCES)
> +libvout_ios_plugin_la_SOURCES = video_output/ios.m
>  libvout_ios_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DUSE_OPENGL_ES2
> -libvout_ios_plugin_la_LIBADD = $(OPENGL_COMMONLIBS)
> +libvout_ios_plugin_la_LIBADD = libvlc_opengles.la
>  libvout_ios_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,Foundation,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit
>  if HAVE_IOS
> @@ -137,19 +137,19 @@ libdirect3d11_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
>  vout_LTLIBRARIES += $(LTLIBdirect3d11)
>  EXTRA_LTLIBRARIES += libdirect3d11_plugin.la
>
> -libglwin32_plugin_la_SOURCES = $(OPENGL_COMMONSOURCES) \
> +libglwin32_plugin_la_SOURCES = \
>  	video_output/win32/glwin32.c \
>  	video_output/win32/common.c video_output/win32/common.h \
>  	video_output/win32/events.c video_output/win32/events.h \
>  	video_output/win32/sensors.cpp \
>  	video_output/win32/win32touch.c video_output/win32/win32touch.h
> -libwgl_plugin_la_SOURCES = video_output/win32/wgl.c $(OPENGL_COMMONSOURCES)
> +libwgl_plugin_la_SOURCES = video_output/win32/wgl.c
>
>  libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
>  	-DMODULE_NAME_IS_glwin32
>
> -libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid $(OPENGL_COMMONLIBS)
> -libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 $(OPENGL_COMMONLIBS)
> +libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid libvlc_opengl.la
> +libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 libvlc_opengl.la
>
>  libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DHAVE_GL_CORE_SYMBOLS
>  libwgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS)
> diff --git a/modules/video_output/opengl/Makefile.am b/modules/video_output/opengl/Makefile.am
> index c06195bbca..e6e5945fb0 100644
> --- a/modules/video_output/opengl/Makefile.am
> +++ b/modules/video_output/opengl/Makefile.am
> @@ -22,18 +22,48 @@ endif
>  OPENGL_COMMONCFLAGS = $(LIBPLACEBO_CFLAGS)
>  OPENGL_COMMONLIBS = $(LIBPLACEBO_LIBS)
>
> +# Convenience library for OpenGL components -- OpenGL only
> +libvlc_opengl_la_SOURCES = $(OPENGL_COMMONSOURCES)
> +libvlc_opengl_la_CFLAGS = $(OPENGL_COMMONCFLAGS)
> +libvlc_opengl_la_LIBADD = $(OPENGL_COMMONLIBS) $(LIBM)
> +libvlc_opengl_la_LDFLAGS = \
> +    -static \
> +    -no-undefined \
> +    -export-symbols-regex "^vlc_gl_|^vout_display_opengl_" \
> +    -version-info 0:0:0
> +
> +if HAVE_GL
> +noinst_LTLIBRARIES += libvlc_opengl.la
> +endif
> +
> +# Convenience library for OpenGL components -- OpenGL ES only
> +libvlc_opengles_la_SOURCES = $(OPENGL_COMMONSOURCES)
> +libvlc_opengles_la_CFLAGS = $(OPENGL_COMMONCFLAGS) -DUSE_OPENGL_ES2
> +libvlc_opengles_la_LIBADD = $(OPENGL_COMMONLIBS) $(LIBM)
> +libvlc_opengles_la_LDFLAGS = \
> +    -static \
> +    -no-undefined \
> +    -export-symbols-regex "^vlc_gl_|^vout_display_opengl_" \
> +    -version-info 0:0:0
> +
> +libvlc_opengles_la_CFLAGS += $(GLES2_CFLAGS)
> +libvlc_opengles_la_LIBADD += $(GLES2_LIBS)
> +if HAVE_GLES2
> +noinst_LTLIBRARIES += libvlc_opengles.la
> +endif
> +
>  ### OpenGL ###
> -libgles2_plugin_la_SOURCES = $(OPENGL_COMMONSOURCES) video_output/opengl/display.c
> -libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2 $(OPENGL_COMMONCFLAGS)
> -libgles2_plugin_la_LIBADD = $(GLES2_LIBS) $(LIBM) $(OPENGL_COMMONLIBS)
> +libgles2_plugin_la_SOURCES = video_output/opengl/display.c
> +libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2
> +libgles2_plugin_la_LIBADD = $(GLES2_LIBS) libvlc_opengles.la
>  libgles2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
> +if HAVE_GLES2
> +vout_LTLIBRARIES += libgles2_plugin.la
> +endif
>
> -EXTRA_LTLIBRARIES += libgles2_plugin.la
> -vout_LTLIBRARIES += $(LTLIBgles2)
> -
> -libgl_plugin_la_SOURCES = $(OPENGL_COMMONSOURCES) video_output/opengl/display.c
> +libgl_plugin_la_SOURCES = video_output/opengl/display.c
>  libgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) $(OPENGL_COMMONCFLAGS)
> -libgl_plugin_la_LIBADD = $(LIBM) $(OPENGL_COMMONLIBS)
> +libgl_plugin_la_LIBADD = libvlc_opengl.la
>  if HAVE_WIN32
>  libgl_plugin_la_CFLAGS += -DHAVE_GL_CORE_SYMBOLS
>  libgl_plugin_la_LIBADD += $(GL_LIBS)
> --
> 2.27.0
>


More information about the vlc-devel mailing list