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 = join_paths(get_option('libdir'), 'gstreamer-1.0')
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)
43 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
45 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
46 # are built with MinGW
47 noseh_link_args = ['/SAFESEH:NO']
52 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
53 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
55 if have_cxx and cxx.has_link_argument('-Wl,-Bsymbolic-functions')
56 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'cpp')
59 cdata = configuration_data()
61 ['HAVE_DLFCN_H', 'dlfcn.h'],
62 ['HAVE_INTTYPES_H', 'inttypes.h'],
63 ['HAVE_MALLOC_H', 'malloc.h'],
64 ['HAVE_MEMORY_H', 'memory.h'],
65 ['HAVE_STDINT_H', 'stdint.h'],
66 ['HAVE_STDLIB_H', 'stdlib.h'],
67 ['HAVE_STRINGS_H', 'strings.h'],
68 ['HAVE_STRING_H', 'string.h'],
69 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
70 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
71 ['HAVE_UNISTD_H', 'unistd.h'],
72 ['HAVE_WINSOCK2_H', 'winsock2.h'],
75 foreach h : check_headers
76 if cc.has_header(h.get(1))
77 cdata.set(h.get(0), 1)
82 ['HAVE_DCGETTEXT', 'dcgettext'], # FIXME: this looks unused
85 foreach f : check_functions
86 if cc.has_function(f.get(1))
87 cdata.set(f.get(0), 1)
91 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
92 cdata.set('SIZEOF_INT', cc.sizeof('int'))
93 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
94 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
95 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
97 cdata.set_quoted('VERSION', gst_version)
98 cdata.set_quoted('PACKAGE', 'gst-plugins-ugly')
99 cdata.set_quoted('GST_LICENSE', 'LGPL')
100 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-plugins-ugly-1.0')
101 cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
103 # GStreamer package name and origin url
104 gst_package_name = get_option('package-name')
105 if gst_package_name == ''
106 if gst_version_nano == 0
107 gst_package_name = 'GStreamer Ugly Plug-ins source release'
108 elif gst_version_nano == 1
109 gst_package_name = 'GStreamer Ugly Plug-ins git'
111 gst_package_name = 'GStreamer Ugly Plug-ins prerelease'
114 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
115 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
118 gst_dep = dependency('gstreamer-1.0', version : gst_req,
119 fallback : ['gstreamer', 'gst_dep'])
120 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
121 fallback : ['gst-plugins-base', 'app_dep'])
122 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
123 fallback : ['gst-plugins-base', 'video_dep'])
124 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
125 fallback : ['gst-plugins-base', 'pbutils_dep'])
126 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
127 fallback : ['gst-plugins-base', 'tag_dep'])
128 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
129 fallback : ['gst-plugins-base', 'fft_dep'])
130 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
131 fallback : ['gst-plugins-base', 'audio_dep'])
132 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
133 fallback : ['gstreamer', 'gst_base_dep'])
134 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
135 fallback : ['gst-plugins-base', 'riff_dep'])
136 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
137 fallback : ['gst-plugins-base', 'rtp_dep'])
138 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
139 fallback : ['gstreamer', 'gst_net_dep'])
140 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
141 fallback : ['gst-plugins-base', 'sdp_dep'])
142 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
143 fallback : ['gst-plugins-base', 'rtsp_dep'])
144 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
145 required : get_option('tests'),
146 fallback : ['gstreamer', 'gst_check_dep'])
147 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
148 fallback : ['gstreamer', 'gst_controller_dep'])
150 orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : get_option('orc'))
152 cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection
154 cdata.set('DISABLE_ORC', 1)
157 ugly_args = ['-DHAVE_CONFIG_H']
158 configinc = include_directories('.')
159 libsinc = include_directories('gst-libs')
161 if gst_dep.type_name() == 'internal'
162 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
164 # We can't check that in the case of subprojects as we won't
165 # be able to build against an internal dependency (which is not built yet)
166 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
169 if gst_debug_disabled and cc.has_argument('-Wno-unused')
170 add_project_arguments('-Wno-unused', language: 'c')
174 '-Wmissing-declarations',
178 '-Wformat-nonliteral',
181 '-Wmissing-include-dirs',
186 '-Waggregate-return',
187 '-fno-strict-aliasing',
189 '-fvisibility=hidden',
193 '-Wmissing-prototypes',
194 '-Wold-style-definition',
195 '-Wdeclaration-after-statement',
199 foreach extra_arg : warning_flags
200 if cc.has_argument (extra_arg)
201 add_project_arguments([extra_arg], language: 'c')
203 if have_cxx and cxx.has_argument (extra_arg)
204 add_project_arguments([extra_arg], language: 'cpp')
208 foreach extra_arg : warning_c_flags
209 if cc.has_argument (extra_arg)
210 add_project_arguments([extra_arg], language: 'c')
214 # Define G_DISABLE_DEPRECATED for development versions
215 if gst_version_is_dev
216 message('Disabling deprecated GLib API')
217 add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
220 cast_checks = get_option('gobject-cast-checks')
221 if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
222 message('Disabling GLib cast checks')
223 add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
226 glib_asserts = get_option('glib-asserts')
227 if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
228 message('Disabling GLib asserts')
229 add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
232 glib_checks = get_option('glib-checks')
233 if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
234 message('Disabling GLib checks')
235 add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
238 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
240 pkgconfig = import('pkgconfig')
241 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
242 if get_option('default_library') == 'shared'
243 # If we don't build static plugins there is no need to generate pc files
244 plugins_pkgconfig_install_dir = disabler()
251 # xgettext is optional (on Windows for instance)
252 if find_program('xgettext', required : get_option('nls')).found()
253 cdata.set('ENABLE_NLS', 1)
257 configure_file(output : 'config.h', configuration : cdata)
259 python3 = import('python').find_installation()
260 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')