libs: fix API export/import and 'inconsistent linkage' on MSVC

For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

While we're at it, add new GST_API_EXPORT in config.h and use
that for GST_*_API decorators instead of GST_EXPORT.

The right export define depends on the toolchain and whether
we're using -fvisibility=hidden or not, so it's better to set it
to the right thing directly than hard-coding a compiler whitelist
in the public header.

We put the export define into config.h instead of passing it via the
command line to the compiler because it might contain spaces and brackets
and in the autotools scenario we'd have to pass that through multiple
layers of plumbing and Makefile/shell escaping and we're just not going
to be *that* lucky.

The export define is only used if we're compiling our lib, not by external
users of the lib headers, so it's not a problem to put it into config.h

Also, this means all .c files of libs need to include config.h
to get the export marker defined, so fix up a few that didn't
include config.h.

This commit depends on a common submodule commit that makes gst-glib-gen.mak
add an #include "config.h" to generated enum/marshal .c files for the
autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
This commit is contained in:
Tim-Philipp Müller 2018-04-28 14:50:11 +01:00
parent cfc8d7ec9e
commit dc29bc4e13
49 changed files with 109 additions and 54 deletions

2
common

@ -1 +1 @@
Subproject commit ed78bee437dcbe22e6eef0031d9a29d157c0461f
Subproject commit cd1dee06bf07f094677d0cf3eea4a2e8c2636b24

View file

@ -841,7 +841,13 @@ fi
AC_SUBST(DEPRECATED_CFLAGS)
VISIBILITY_CFLAGS=""
AS_COMPILER_FLAG([-fvisibility=hidden], [VISIBILITY_CFLAGS="-fvisibility=hidden"])
AS_COMPILER_FLAG([-fvisibility=hidden], [
VISIBILITY_CFLAGS="-fvisibility=hidden"
AC_DEFINE(GST_API_EXPORT, [extern __attribute__ ((visibility ("default")))], [public symbol export define])
], [
VISIBILITY_CFLAGS=""
AC_DEFINE(GST_API_EXPORT, [extern], [public symbol export define])
])
AC_SUBST(VISIBILITY_CFLAGS)
VISIBILITY_CXXFLAGS=""

View file

@ -17,7 +17,7 @@ libgstallocators_@GST_API_VERSION@_la_SOURCES = \
gstdmabuf.c
libgstallocators_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM)
libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_ALLOCATORS
libgstallocators_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
if HAVE_INTROSPECTION

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_ALLOCATORS_API
#define GST_ALLOCATORS_API GST_EXPORT
#ifdef BUILDING_GST_ALLOCATORS
#define GST_ALLOCATORS_API GST_API_EXPORT /* from config.h */
#else
#define GST_ALLOCATORS_API GST_API_IMPORT
#endif
#endif /* __GST_ALLOCATORS_PRELUDE_H__ */

View file

@ -10,7 +10,7 @@ install_headers(gst_allocators_headers, subdir : 'gstreamer-1.0/gst/allocators/'
gst_allocators_sources = [ 'gstdmabuf.c', 'gstfdmemory.c', 'gstphysmemory.c']
gstallocators = library('gstallocators-@0@'.format(api_version),
gst_allocators_sources,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_ALLOCATORS'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -17,7 +17,7 @@ include $(top_srcdir)/common/gst-glib-gen.mak
libgstapp_@GST_API_VERSION@_la_SOURCES = gstappsrc.c gstappsink.c
nodist_libgstapp_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
libgstapp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS)
$(GST_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_APP
libgstapp_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS)
libgstapp_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_APP_API
#define GST_APP_API GST_EXPORT
#ifdef BUILDING_GST_APP
#define GST_APP_API GST_API_EXPORT /* from config.h */
#else
#define GST_APP_API GST_API_IMPORT
#endif
#endif /* __GST_APP_PRELUDE_H__ */

View file

@ -9,6 +9,7 @@ install_headers(app_headers, subdir : 'gstreamer-1.0/gst/app/')
app_enums = gnome.mkenums_simple('app-enumtypes',
sources : app_mkenum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/app/app-prelude.h>',
decorator : 'GST_APP_API',
install_header: true,
@ -20,7 +21,7 @@ app_gen_sources = [gstapp_h]
gstapp = library('gstapp-@0@'.format(api_version),
app_sources, gstapp_h, gstapp_c,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_APP'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -104,7 +104,7 @@ noinst_HEADERS = \
audio-resampler-neon.h
libgstaudio_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
$(ORC_CFLAGS)
$(ORC_CFLAGS) -DBUILDING_GST_AUDIO
libgstaudio_@GST_API_VERSION@_la_LIBADD = \
$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) $(ORC_LIBS)

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_AUDIO_API
#define GST_AUDIO_API GST_EXPORT
#ifdef BUILDING_GST_AUDIO
#define GST_AUDIO_API GST_API_EXPORT /* from config.h */
#else
#define GST_AUDIO_API GST_API_IMPORT
#endif
#endif /* __GST_AUDIO_PRELUDE_H__ */

View file

@ -64,6 +64,7 @@ install_headers(audio_headers, subdir : 'gstreamer-1.0/gst/audio/')
audio_enums = gnome.mkenums_simple('audio-enumtypes',
sources : audio_mkenum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/audio/audio-prelude.h>',
decorator : 'GST_AUDIO_API',
install_header: true,
@ -140,7 +141,7 @@ endif
gstaudio = library('gstaudio-@0@'.format(api_version),
audio_src, gstaudio_h, gstaudio_c, orc_c, orc_h,
c_args : gst_plugins_base_args + simd_cargs,
c_args : gst_plugins_base_args + simd_cargs + ['-DBUILDING_GST_AUDIO'],
include_directories: [configinc, libsinc],
link_with : simd_dependencies,
version : libversion,

View file

@ -41,7 +41,7 @@ libgstfft_@GST_API_VERSION@_la_SOURCES = \
kiss_fftr_f64.c
libgstfft_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM)
libgstfft_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstfft_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_FFT
libgstfft_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
EXTRA_DIST = kiss_version

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_FFT_API
#define GST_FFT_API GST_EXPORT
#ifdef BUILDING_GST_FFT
#define GST_FFT_API GST_API_EXPORT /* from config.h */
#else
#define GST_FFT_API GST_API_IMPORT
#endif
#endif /* __GST_FFT_PRELUDE_H__ */

View file

@ -27,7 +27,7 @@ install_headers(fft_headers, subdir : 'gstreamer-1.0/gst/fft/')
gstfft = library('gstfft-@0@'.format(api_version),
fft_sources,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_FFT'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -155,7 +155,7 @@ configexecincludedir = $(libdir)/gstreamer-@GST_API_VERSION@/include/gst/gl
nodist_configexecinclude_HEADERS = $(built_sys_header_configure)
libgstgl_@GST_API_VERSION@_la_CFLAGS = \
-DGST_EXPORTS \
-DBUILDING_GST_GL \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS) \

View file

@ -11,6 +11,7 @@ noinst_HEADERS = \
libgstgl_android_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -21,6 +21,7 @@ libgstgl_cocoainclude_HEADERS = \
libgstgl_cocoa_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -11,6 +11,7 @@ noinst_HEADERS = \
libgstgl_dispmanx_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -13,6 +13,7 @@ noinst_HEADERS = \
libgstgl_eagl_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -22,6 +22,7 @@ libgstgl_eglinclude_HEADERS = \
libgstgl_egl_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -15,6 +15,7 @@ noinst_HEADERS = \
libgstgl_gbm_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_GL_API
#define GST_GL_API GST_EXPORT
#ifdef BUILDING_GST_GL
#define GST_GL_API GST_API_EXPORT /* from config.h */
#else
#define GST_GL_API GST_API_IMPORT
#endif
#endif /* __GST_GL_PRELUDE_H__ */

View file

@ -877,8 +877,8 @@ if build_gstgl
gstgl = library('gstgl-' + api_version,
gl_sources,
c_args : gst_plugins_base_args + gl_cpp_args,
objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args,
c_args : gst_plugins_base_args + gl_cpp_args + ['-DBUILDING_GST_GL'],
objc_args : gst_plugins_base_args + gl_cpp_args + gl_objc_args + ['-DBUILDING_GST_GL'],
include_directories : [configinc, libsinc, gl_includes],
version : libversion,
soversion : soversion,

View file

@ -17,6 +17,7 @@ libgstgl_viv_fbinclude_HEADERS = \
libgstgl_viv_fb_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -18,6 +18,7 @@ libgstgl_waylandinclude_HEADERS = \
libgstgl_wayland_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -14,9 +14,9 @@ noinst_HEADERS += gstglcontext_wgl.h
endif
libgstgl_win32_la_CFLAGS = \
-DGST_EXPORTS \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -23,6 +23,7 @@ endif
libgstgl_x11_la_CFLAGS = \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
-DBUILDING_GST_GL \
$(GL_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \

View file

@ -54,7 +54,7 @@ libgstpbutils_@GST_API_VERSION@_la_LIBADD = \
$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(GST_LIBS)
libgstpbutils_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstpbutils_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_PBUTILS
libgstpbutils_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
BUILT_SOURCES = \

View file

@ -40,6 +40,7 @@ pbutils_mkenum_headers = pbutils_headers
pbutils_enums = gnome.mkenums_simple('pbutils-enumtypes',
sources : pbutils_mkenum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/pbutils/pbutils-prelude.h>',
decorator : 'GST_PBUTILS_API',
install_header: true,
@ -50,7 +51,7 @@ gstpbutils_h = pbutils_enums[1]
gstpbutils_deps = [video_dep, audio_dep, tag_dep]
pbutils = library('gstpbutils-@0@'.format(api_version),
pbutils_sources, gstpbutils_c, gstpbutils_h,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_PBUTILS'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_PBUTILS_API
#define GST_PBUTILS_API GST_EXPORT
#ifdef BUILDING_GST_PBUTILS
#define GST_PBUTILS_API GST_API_EXPORT /* from config.h */
#else
#define GST_PBUTILS_API GST_API_IMPORT
#endif
#ifndef GST_DISABLE_DEPRECATED

View file

@ -18,7 +18,7 @@ libgstriff_@GST_API_VERSION@_la_LIBADD = \
$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) $(GST_LIBS)
libgstriff_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstriff_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_RIFF
libgstriff_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
# *** GIR DISABLED for this library ***

View file

@ -16,7 +16,7 @@ install_headers(riff_headers, subdir : 'gstreamer-1.0/gst/riff/')
riff_deps = [audio_dep, tag_dep]
gstriff = library('gstriff-@0@'.format(api_version),
riff_sources,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_RIFF'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_RIFF_API
#define GST_RIFF_API GST_EXPORT
#ifdef BUILDING_GST_RIFF
#define GST_RIFF_API GST_API_EXPORT /* from config.h */
#else
#define GST_RIFF_API GST_API_IMPORT
#endif
#endif /* __GST_RIFF_PRELUDE_H__ */

View file

@ -25,7 +25,7 @@ libgstrtp_@GST_API_VERSION@_la_SOURCES = gstrtpbuffer.c \
built_sources = gstrtp-enumtypes.c
built_headers = gstrtp-enumtypes.h
libgstrtp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstrtp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -DBUILDING_GST_RTP
libgstrtp_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
libgstrtp_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -24,6 +24,7 @@ install_headers(rtp_headers, subdir : 'gstreamer-1.0/gst/rtp/')
rtp_enums = gnome.mkenums_simple('gstrtp-enumtypes',
sources : rtp_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/rtp/rtp-prelude.h>',
decorator : 'GST_RTP_API',
install_header: true,
@ -34,7 +35,7 @@ gstrtp_enum_h = rtp_enums[1]
gstrtp_deps = [audio_dep, gst_base_dep]
gst_rtp = library('gstrtp-@0@'.format(api_version),
rtp_sources, gstrtp_enum_c, gstrtp_enum_h,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_RTP'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_RTP_API
#define GST_RTP_API GST_EXPORT
#ifdef BUILDING_GST_RTP
#define GST_RTP_API GST_API_EXPORT /* from config.h */
#else
#define GST_RTP_API GST_API_IMPORT
#endif
#endif /* __GST_RTP_PRELUDE_H__ */

View file

@ -34,7 +34,7 @@ nodist_libgstrtspinclude_HEADERS = gstrtsp-enumtypes.h
#gstrtspextwms.c
#rtspextreal.c
libgstrtsp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS)
libgstrtsp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS) -DBUILDING_GST_RTSP
libgstrtsp_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(GIO_LIBS) $(LIBM)
libgstrtsp_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) $(WIN32_LIBS)

View file

@ -24,6 +24,7 @@ install_headers(rtsp_headers, subdir : 'gstreamer-1.0/gst/rtsp/')
rtsp_enums = gnome.mkenums_simple('gstrtsp-enumtypes',
sources : rtsp_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/rtsp/rtsp-prelude.h>',
decorator : 'GST_RTSP_API',
install_header: true,
@ -41,7 +42,7 @@ gstrtsp_deps = [gst_base_dep, gst_dep, gio_dep, libm, winsock2]
gst_rtsp = library('gstrtsp-@0@'.format(api_version),
rtsp_sources,
gstrtsp_h, gstrtsp_c,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_RTSP'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_RTSP_API
#define GST_RTSP_API GST_EXPORT
#ifdef BUILDING_GST_RTSP
#define GST_RTSP_API GST_API_EXPORT /* from config.h */
#else
#define GST_RTSP_API GST_API_IMPORT
#endif
#ifndef GST_DISABLE_DEPRECATED

View file

@ -10,7 +10,7 @@ lib_LTLIBRARIES = libgstsdp-@GST_API_VERSION@.la
libgstsdp_@GST_API_VERSION@_la_SOURCES = gstsdpmessage.c gstmikey.c
libgstsdp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS)
libgstsdp_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GIO_CFLAGS) -DBUILDING_GST_SDP
libgstsdp_@GST_API_VERSION@_la_LIBADD = $(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_API_VERSION@.la $(GST_LIBS) $(GIO_LIBS)
libgstsdp_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -11,7 +11,7 @@ rtsp_deps = [rtp_dep, gst_dep, gio_dep]
gst_sdp_sources = ['gstsdpmessage.c', 'gstmikey.c']
gstsdp = library('gstsdp-@0@'.format(api_version),
gst_sdp_sources,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_SDP'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_SDP_API
#define GST_SDP_API GST_EXPORT
#ifdef BUILDING_GST_SDP
#define GST_SDP_API GST_API_EXPORT /* from config.h */
#else
#define GST_SDP_API GST_API_IMPORT
#endif
#endif /* __GST_SDP_PRELUDE_H__ */

View file

@ -30,7 +30,7 @@ libgsttag_@GST_API_VERSION@_la_SOURCES = \
nodist_libgsttag_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
libgsttag_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ZLIB_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ZLIB_CFLAGS) -DBUILDING_GST_TAG \
-DLICENSE_TRANSLATIONS_PATH=\"$(pkgdatadir)/@GST_API_VERSION@/license-translations.dict\"
libgsttag_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) $(ZLIB_LIBS)
libgsttag_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -28,6 +28,7 @@ install_headers(tag_headers, subdir : 'gstreamer-1.0/gst/tag/')
tag_enums = gnome.mkenums_simple('tag-enumtypes',
sources : tag_mkenum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/tag/tag-prelude.h>',
decorator : 'GST_TAG_API',
install_header: true,
@ -75,7 +76,7 @@ core_conf.set('HAVE_ZLIB', zlib_dep.found())
tag_deps = [gst_base_dep, libm, zlib_dep]
gsttag = library('gsttag-@0@'.format(api_version),
tag_sources, gsttag_h, gsttag_c,
c_args : gst_plugins_base_args + gst_tag_args,
c_args : gst_plugins_base_args + gst_tag_args + ['-DBUILDING_GST_TAG'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_TAG_API
#define GST_TAG_API GST_EXPORT
#ifdef BUILDING_GST_TAG
#define GST_TAG_API GST_API_EXPORT /* from config.h */
#else
#define GST_TAG_API GST_API_IMPORT
#endif
#endif /* __GST_TAG_PRELUDE_H__ */

View file

@ -95,7 +95,7 @@ nodist_libgstvideo_@GST_API_VERSION@include_HEADERS = $(built_headers)
noinst_HEADERS = gstvideoutilsprivate.h
libgstvideo_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
$(ORC_CFLAGS)
$(ORC_CFLAGS) -DBUILDING_GST_VIDEO
libgstvideo_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
libgstvideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -89,6 +89,7 @@ video_mkenum_headers = [
video_enums = gnome.mkenums_simple('video-enumtypes',
sources : video_mkenum_headers,
body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif',
header_prefix : '#include <gst/video/video-prelude.h>',
decorator : 'GST_VIDEO_API',
install_header: true,
@ -120,7 +121,7 @@ endif
gstvideo = library('gstvideo-@0@'.format(api_version),
video_sources, gstvideo_h, gstvideo_c, orc_c, orc_h,
c_args : gst_plugins_base_args,
c_args : gst_plugins_base_args + ['-DBUILDING_GST_VIDEO'],
include_directories: [configinc, libsinc],
version : libversion,
soversion : soversion,

View file

@ -24,8 +24,10 @@
#include <gst/gst.h>
#ifndef GST_VIDEO_API
#define GST_VIDEO_API GST_EXPORT
#ifdef BUILDING_GST_VIDEO
#define GST_VIDEO_API GST_API_EXPORT /* from config.h */
#else
#define GST_VIDEO_API GST_API_IMPORT
#endif
#endif /* __GST_VIDEO_PRELUDE_H__ */

View file

@ -59,11 +59,21 @@ if cc.has_link_argument('-Wl,-Bsymbolic-functions')
add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
endif
core_conf = configuration_data()
# Symbol visibility
if cc.has_argument('-fvisibility=hidden')
if cc.get_id() == 'msvc'
export_define = '__declspec(dllexport) extern'
elif cc.has_argument('-fvisibility=hidden')
add_project_arguments('-fvisibility=hidden', language: 'c')
export_define = 'extern __attribute__ ((visibility ("default")))'
else
export_define = 'extern'
endif
# Passing this through the command line would be too messy
core_conf.set('GST_API_EXPORT', export_define)
# Disable strict aliasing
if cc.has_argument('-fno-strict-aliasing')
add_project_arguments('-fno-strict-aliasing', language: 'c')
@ -93,7 +103,6 @@ if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
endif
core_conf = configuration_data()
check_headers = [
['HAVE_DLFCN_H', 'dlfcn.h'],
['HAVE_EMMINTRIN_H', 'emmintrin.h'],