1 project('gst-plugins-ugly', 'c',
3 meson_version : '>= 0.47',
4 default_options : [ 'warning_level=1',
5 'buildtype=debugoptimized' ])
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0].to_int()
10 gst_version_minor = version_arr[1].to_int()
11 gst_version_micro = version_arr[2].to_int()
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3].to_int()
17 gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90
19 have_cxx = add_languages('cpp', required : false)
21 glib_req = '>= 2.40.0'
22 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
26 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
28 cc = meson.get_compiler('c')
30 cxx = meson.get_compiler('cpp')
33 if cc.get_id() == 'msvc'
34 # Ignore several spurious warnings for things gstreamer does very commonly
35 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
36 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
37 # NOTE: Only add warnings here if you are sure they're spurious
38 add_project_arguments(
39 '/wd4018', # implicit signed/unsigned conversion
40 '/wd4146', # unary minus on unsigned (beware INT_MIN)
41 '/wd4244', # lossy type conversion (e.g. double -> int)
42 '/wd4305', # truncating type conversion (e.g. double -> float)
44 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
45 # are built with MinGW
46 noseh_link_args = ['/SAFESEH:NO']
51 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
52 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
54 if have_cxx and cxx.has_link_argument('-Wl,-Bsymbolic-functions')
55 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'cpp')
58 cdata = configuration_data()
60 ['HAVE_DLFCN_H', 'dlfcn.h'],
61 ['HAVE_INTTYPES_H', 'inttypes.h'],
62 ['HAVE_MALLOC_H', 'malloc.h'],
63 ['HAVE_MEMORY_H', 'memory.h'],
64 ['HAVE_STDINT_H', 'stdint.h'],
65 ['HAVE_STDLIB_H', 'stdlib.h'],
66 ['HAVE_STRINGS_H', 'strings.h'],
67 ['HAVE_STRING_H', 'string.h'],
68 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
69 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
70 ['HAVE_UNISTD_H', 'unistd.h'],
71 ['HAVE_WINSOCK2_H', 'winsock2.h'],
74 foreach h : check_headers
75 if cc.has_header(h.get(1))
76 cdata.set(h.get(0), 1)
81 ['HAVE_DCGETTEXT', 'dcgettext'], # FIXME: this looks unused
84 foreach f : check_functions
85 if cc.has_function(f.get(1))
86 cdata.set(f.get(0), 1)
90 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
91 cdata.set('SIZEOF_INT', cc.sizeof('int'))
92 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
93 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
94 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
96 cdata.set_quoted('VERSION', gst_version)
97 cdata.set_quoted('PACKAGE', 'gst-plugins-ugly')
98 cdata.set_quoted('GST_LICENSE', 'LGPL')
99 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-ugly-1.0')
100 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
102 # GStreamer package name and origin url
103 gst_package_name = get_option('package-name')
104 if gst_package_name == ''
105 if gst_version_nano == 0
106 gst_package_name = 'GStreamer Ugly Plug-ins source release'
107 elif gst_version_nano == 1
108 gst_package_name = 'GStreamer Ugly Plug-ins git'
110 gst_package_name = 'GStreamer Ugly Plug-ins prerelease'
113 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
114 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
117 gst_dep = dependency('gstreamer-1.0', version : gst_req,
118 fallback : ['gstreamer', 'gst_dep'])
119 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
120 fallback : ['gst-plugins-base', 'app_dep'])
121 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
122 fallback : ['gst-plugins-base', 'video_dep'])
123 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
124 fallback : ['gst-plugins-base', 'pbutils_dep'])
125 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
126 fallback : ['gst-plugins-base', 'tag_dep'])
127 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
128 fallback : ['gst-plugins-base', 'fft_dep'])
129 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
130 fallback : ['gst-plugins-base', 'audio_dep'])
131 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
132 fallback : ['gstreamer', 'gst_base_dep'])
133 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
134 fallback : ['gst-plugins-base', 'riff_dep'])
135 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
136 fallback : ['gst-plugins-base', 'rtp_dep'])
137 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
138 fallback : ['gstreamer', 'gst_net_dep'])
139 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
140 fallback : ['gst-plugins-base', 'sdp_dep'])
141 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
142 fallback : ['gst-plugins-base', 'rtsp_dep'])
143 if host_machine.system() != 'windows'
144 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
145 required : get_option('tests'),
146 fallback : ['gstreamer', 'gst_check_dep'])
148 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
149 fallback : ['gstreamer', 'gst_controller_dep'])
151 orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : get_option('orc'))
153 cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection
155 cdata.set('DISABLE_ORC', 1)
158 ugly_args = ['-DHAVE_CONFIG_H']
159 configinc = include_directories('.')
160 libsinc = include_directories('gst-libs')
162 if gst_dep.type_name() == 'internal'
163 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
165 # We can't check that in the case of subprojects as we won't
166 # be able to build against an internal dependency (which is not built yet)
167 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
170 if gst_debug_disabled and cc.has_argument('-Wno-unused')
171 add_project_arguments('-Wno-unused', language: 'c')
175 '-Wmissing-declarations',
179 '-Wformat-nonliteral',
182 '-Wmissing-include-dirs',
187 '-Waggregate-return',
188 '-fno-strict-aliasing',
190 '-fvisibility=hidden',
194 '-Wmissing-prototypes',
195 '-Wold-style-definition',
196 '-Wdeclaration-after-statement',
200 foreach extra_arg : warning_flags
201 if cc.has_argument (extra_arg)
202 add_project_arguments([extra_arg], language: 'c')
204 if have_cxx and cxx.has_argument (extra_arg)
205 add_project_arguments([extra_arg], language: 'cpp')
209 foreach extra_arg : warning_c_flags
210 if cc.has_argument (extra_arg)
211 add_project_arguments([extra_arg], language: 'c')
215 # Define G_DISABLE_DEPRECATED for development versions
216 if gst_version_is_dev
217 message('Disabling deprecated GLib API')
218 add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
221 cast_checks = get_option('gobject-cast-checks')
222 if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
223 message('Disabling GLib cast checks')
224 add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
227 glib_asserts = get_option('glib-asserts')
228 if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
229 message('Disabling GLib asserts')
230 add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
233 glib_checks = get_option('glib-checks')
234 if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
235 message('Disabling GLib checks')
236 add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
239 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
241 pkgconfig = import('pkgconfig')
242 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
243 if get_option('default_library') == 'shared'
244 # If we don't build static plugins there is no need to generate pc files
245 plugins_pkgconfig_install_dir = disabler()
252 # xgettext is optional (on Windows for instance)
253 if find_program('xgettext', required : get_option('nls')).found()
254 cdata.set('ENABLE_NLS', 1)
258 configure_file(output : 'config.h', configuration : cdata)
260 python3 = import('python').find_installation()
261 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')