[vlc-devel] [PATCH 2/4] doc: add an option to build libvlc sample app from the documentation

Steve Lhomme robux4 at ycbcr.xyz
Fri Feb 26 15:17:53 UTC 2021


This can useful in the CI the make sure the sample apps are always in sync with
the libvlc API.

Build the "doc" folder after the "libvlc" folder so it uses the latest libvlc
built.

For now the QtPlayer, QtGl, win_player, d3d9_player and d3d11_player libvlc
apps are supported.
---
 Makefile.am            |  2 +-
 configure.ac           |  9 ++++++++
 doc/Makefile.am        |  2 ++
 doc/libvlc/Makefile.am | 52 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 doc/libvlc/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index be9516f9f86..d46707539fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@
 # something. DIST_SUBDIRS stores the directories where nothing is built but
 # which have makefiles with distribution information.
 #  - src (libvlccore) is nedeed by modules
-SUBDIRS = compat doc po share src modules lib bin test
+SUBDIRS = compat po share src modules lib bin doc test
 DIST_SUBDIRS = m4 $(SUBDIRS)
 
 EXTRA_DIST = \
diff --git a/configure.ac b/configure.ac
index a82c956c70f..ab7ca8ff2cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4464,6 +4464,14 @@ AS_IF([test "${enable_osx_notifications}" != "no"], [
   VLC_ADD_PLUGIN([osx_notifications])
 ])
 
+dnl
+dnl  doc samples
+dnl
+AC_ARG_ENABLE([doc_samples],
+  AS_HELP_STRING([--enable-doc-samples],
+      [enable build of documentation samples (default disabled)]))
+AM_CONDITIONAL([HAVE_DOC_SAMPLES], [test "${enable_doc_samples}" = "yes"])
+
 dnl
 dnl Libnotify notification plugin
 dnl
@@ -4633,6 +4641,7 @@ AC_SUBST([FILE_LIBVLC_DLL])
 AC_CONFIG_FILES([
   Makefile
   doc/Makefile
+  doc/libvlc/Makefile
   modules/Makefile
   m4/Makefile
   po/Makefile.in
diff --git a/doc/Makefile.am b/doc/Makefile.am
index a926b1eef8d..3d0c1c27e55 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,5 +1,7 @@
 NULL =
 
+SUBDIRS = libvlc
+
 LIBVLC_SAMPLES = \
 	libvlc/gtk_player.c \
 	libvlc/QtPlayer/LICENSE \
diff --git a/doc/libvlc/Makefile.am b/doc/libvlc/Makefile.am
new file mode 100644
index 00000000000..4054df745ed
--- /dev/null
+++ b/doc/libvlc/Makefile.am
@@ -0,0 +1,52 @@
+SUFFIXES = .c .cpp .ui .h .hpp .moc.cpp
+
+moc_verbose = $(moc_verbose_$(V))
+moc_verbose_ = $(moc_verbose__$(AM_DEFAULT_VERBOSITY))
+moc_verbose_0 = @echo "  MOC   " $@;
+moc_verbose__0 = $(moc_verbose_0)
+
+MOC_CPPFLAGS = $(DEFS) -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) \
+	$(qtgl_libvlc_CPPFLAGS)
+
+nodist_qtgl_libvlc_SOURCES = qtvlcwidget.moc.cpp
+
+qtgl_libvlc_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) $(CXXFLAGS_qt)
+qtgl_libvlc_LDADD = $(QT_LIBS) $(LIBS_qt) $(LIBM) ../../lib/libvlc.la
+qtgl_libvlc_SOURCES = QtGL/main.cpp QtGL/qtvlcwidget.cpp QtGL/qtvlcwidget.h
+
+qtvlcwidget.moc.cpp: QtGL/qtvlcwidget.h
+	$(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $<
+
+nodist_qtplayer_libvlc_SOURCES = player.moc.cpp
+
+qtplayer_libvlc_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) $(CXXFLAGS_qt)
+qtplayer_libvlc_LDADD = $(QT_LIBS) $(LIBS_qt) $(LIBM) ../../lib/libvlc.la
+qtplayer_libvlc_SOURCES = QtPlayer/main.cpp QtPlayer/player.cpp QtPlayer/player.h
+
+player.moc.cpp: QtPlayer/player.h
+	$(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $<
+
+d3d9_player_SOURCES = d3d9_player.c
+d3d9_player_LDADD =  -ld3d9 ../../lib/libvlc.la
+d3d9_player_LDFLAGS = $(AM_LDFLAGS) -mwindows -Wc,-static
+
+d3d11_player_SOURCES = d3d11_player.cpp
+d3d11_player_LDADD =  -ld3d11 -ld3dcompiler_47 ../../lib/libvlc.la
+d3d11_player_LDFLAGS = $(AM_LDFLAGS) -mwindows -Wc,-static
+
+win_player_SOURCES = win_player.c
+win_player_LDADD = ../../lib/libvlc.la
+win_player_LDFLAGS = $(AM_LDFLAGS) -mwindows -Wc,-static
+
+noinst_PROGRAMS =
+if HAVE_DOC_SAMPLES
+if HAVE_WIN32
+noinst_PROGRAMS += d3d11_player d3d9_player win_player
+endif
+if ENABLE_QT
+noinst_PROGRAMS += qtplayer_libvlc
+if HAVE_GL
+noinst_PROGRAMS += qtgl_libvlc
+endif
+endif
+endif
-- 
2.29.2



More information about the vlc-devel mailing list