gtk2/modules/media/meson.build
Chun-wei Fan acd9c12667 modules: Fix build on Visual Studio
Visual Studio does not allow decorating functions with '__declspec (dllexport)'
if a prototype exists and is not decorated with '__declspec (dllexport)' as
well, so we cannot just decorate g_io_module_[load|unload|query] in the various
module sources with G_MODULE_EXPORT because the prototypes of these functions
have been marked with _GLIB_EXTERN, which equates to 'extern' unless overridden

Fix this by overriding _GLIB_EXTERN with the appropriate visibility flag, as we
have used to define _GDK_EXTERN.  Unfortunately, we can't just use _GDK_EXTERN
G_MODULE_EXPORT as they may have not been defined yet for our use

Do this across the board for all modules, even if they are not buildable on
Visual Studio nor Windows, for consistency's sake.
2020-06-05 11:16:45 +08:00

63 lines
2.0 KiB
Meson

all_media_backends = [
'ffmpeg',
'gstreamer'
]
enabled_media_backends = get_option('media').split(',')
if enabled_media_backends.contains('none')
media_backends = []
elif enabled_media_backends.contains('all')
media_backends = all_media_backends
else
media_backends = []
foreach b: enabled_media_backends
if all_media_backends.contains(b)
media_backends += b
else
error('No media backend named "@0@" exists.'.format (b))
endif
endforeach
endif
media_subdir = 'gtk-4.0/@0@/media'.format(gtk_binary_version)
media_install_dir = join_paths(get_option('libdir'), media_subdir)
extra_c_args = [
'-DGTK_COMPILATION',
'-D_GLIB_EXTERN=@0@'.format(visibility_define),
]
extra_c_args += common_cflags
if media_backends.contains('ffmpeg')
libavfilter_dep = dependency('libavfilter', version: '>= 6.47.100', required: true)
libavformat_dep = dependency('libavformat', version: '>= 57.41.100', required: true)
libavcodec_dep = dependency('libavcodec', version: '>= 57.48.101', required: true)
libavutil_dep = dependency('libavutil', version: '>= 55.28.100', required: true)
libswscale_dep = dependency('libswscale', version: '>= 4.6.100', required: true)
ffmpeg_deps = [libavfilter_dep, libavformat_dep, libavcodec_dep, libavutil_dep, libswscale_dep]
cdata.set('HAVE_FFMPEG', 1)
shared_module('media-ffmpeg',
'gtkffmediafile.c',
c_args: extra_c_args,
dependencies: [ libgtk_dep, ffmpeg_deps ],
install_dir: media_install_dir,
install : true)
endif
if media_backends.contains('gstreamer')
gstplayer_dep = dependency('gstreamer-player-1.0', version: '>= 1.12.3', required: true)
cdata.set('HAVE_GSTREAMER', 1)
shared_module('media-gstreamer',
'gtkgstmediafile.c',
'gtkgstpaintable.c',
'gtkgstsink.c',
c_args: extra_c_args,
dependencies: [ libgtk_dep, gstplayer_dep ],
install_dir: media_install_dir,
install : true)
endif