1 project('gst-plugins-ugly', 'c',
3 meson_version : '>= 0.36.0',
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()
18 have_cxx = add_languages('cpp', required : false)
20 glib_req = '>= 2.40.0'
21 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
25 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
27 cc = meson.get_compiler('c')
29 if cc.get_id() == 'msvc'
30 # Ignore several spurious warnings for things gstreamer does very commonly
31 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
32 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
33 # NOTE: Only add warnings here if you are sure they're spurious
34 add_project_arguments(
35 '/wd4018', # implicit signed/unsigned conversion
36 '/wd4146', # unary minus on unsigned (beware INT_MIN)
37 '/wd4244', # lossy type conversion (e.g. double -> int)
38 '/wd4305', # truncating type conversion (e.g. double -> float)
40 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
41 # are built with MinGW
42 noseh_link_args = ['/SAFESEH:NO']
48 if cc.has_argument('-fvisibility=hidden')
49 add_project_arguments('-fvisibility=hidden', language: 'c')
52 # Disable strict aliasing
53 if cc.has_argument('-fno-strict-aliasing')
54 add_project_arguments('-fno-strict-aliasing', language: 'c')
57 cdata = configuration_data()
59 ['HAVE_DLFCN_H', 'dlfcn.h'],
60 ['HAVE_INTTYPES_H', 'inttypes.h'],
61 ['HAVE_MALLOC_H', 'malloc.h'],
62 ['HAVE_MEMORY_H', 'memory.h'],
63 ['HAVE_STDINT_H', 'stdint.h'],
64 ['HAVE_STDLIB_H', 'stdlib.h'],
65 ['HAVE_STRINGS_H', 'strings.h'],
66 ['HAVE_STRING_H', 'string.h'],
67 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
68 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
69 ['HAVE_UNISTD_H', 'unistd.h'],
70 ['HAVE_WINSOCK2_H', 'winsock2.h'],
73 foreach h : check_headers
74 if cc.has_header(h.get(1))
75 cdata.set(h.get(0), 1)
80 # check token HAVE_CPU_ALPHA
81 # check token HAVE_CPU_ARM
82 # check token HAVE_CPU_CRIS
83 # check token HAVE_CPU_CRISV32
84 # check token HAVE_CPU_HPPA
85 # check token HAVE_CPU_I386
86 # check token HAVE_CPU_IA64
87 # check token HAVE_CPU_M68K
88 # check token HAVE_CPU_MIPS
89 # check token HAVE_CPU_PPC
90 # check token HAVE_CPU_PPC64
91 # check token HAVE_CPU_S390
92 # check token HAVE_CPU_SPARC
93 # check token HAVE_CPU_X86_64
94 ['HAVE_DCGETTEXT', 'dcgettext'],
95 # check token HAVE_EXPERIMENTAL
96 # check token HAVE_EXTERNAL
97 # check token HAVE_GETTEXT
98 # check token HAVE_VALGRIND
101 foreach f : check_functions
102 if cc.has_function(f.get(1))
103 cdata.set(f.get(0), 1)
107 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
108 cdata.set('SIZEOF_INT', cc.sizeof('int'))
109 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
110 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
111 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
113 cdata.set('VERSION', '"@0@"'.format(gst_version))
114 cdata.set('PACKAGE', '"gst-plugins-ugly"')
115 cdata.set('GETTEXT_PACKAGE', '"gst-plugins-ugly-1.0"')
116 cdata.set('GST_LICENSE', '"LGPL"')
118 # GStreamer package name and origin url
119 gst_package_name = get_option('with-package-name')
120 if gst_package_name == ''
121 if gst_version_nano == 0
122 gst_package_name = 'GStreamer Ugly Plug-ins source release'
123 elif gst_version_nano == 1
124 gst_package_name = 'GStreamer Ugly Plug-ins git'
126 gst_package_name = 'GStreamer Ugly Plug-ins prerelease'
129 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
130 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('with-package-origin'))
133 gst_dep = dependency('gstreamer-1.0', version : gst_req,
134 fallback : ['gstreamer', 'gst_dep'])
135 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
136 fallback : ['gst-plugins-base', 'app_dep'])
137 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
138 fallback : ['gst-plugins-base', 'video_dep'])
139 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
140 fallback : ['gst-plugins-base', 'pbutils_dep'])
141 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
142 fallback : ['gst-plugins-base', 'tag_dep'])
143 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
144 fallback : ['gst-plugins-base', 'fft_dep'])
145 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
146 fallback : ['gst-plugins-base', 'audio_dep'])
147 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
148 fallback : ['gstreamer', 'gst_base_dep'])
149 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
150 fallback : ['gst-plugins-base', 'riff_dep'])
151 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
152 fallback : ['gst-plugins-base', 'rtp_dep'])
153 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
154 fallback : ['gstreamer', 'gst_net_dep'])
155 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
156 fallback : ['gst-plugins-base', 'sdp_dep'])
157 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
158 fallback : ['gst-plugins-base', 'rtsp_dep'])
159 if host_machine.system() != 'windows'
160 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
161 fallback : ['gstreamer', 'gst_check_dep'])
163 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
164 fallback : ['gstreamer', 'gst_controller_dep'])
166 orc_dep = dependency('orc-0.4', version : '>= 0.4.16', required : false)
168 cdata.set('HAVE_ORC', 1) # used by a52dec for cpu detection
170 cdata.set('DISABLE_ORC', 1)
173 configure_file(output : 'config.h', configuration : cdata)
175 ugly_args = ['-DHAVE_CONFIG_H']
176 configinc = include_directories('.')
177 libsinc = include_directories('gst-libs')
179 if gst_dep.type_name() == 'internal'
180 gst_debug_disabled = subproject('gstreamer').get_variable('disable_gst_debug')
182 # We can't check that in the case of subprojects as we won't
183 # be able to build against an internal dependency (which is not built yet)
184 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
187 if gst_debug_disabled and cc.has_argument('-Wno-unused')
188 add_project_arguments('-Wno-unused', language: 'c')
192 '-Wmissing-declarations',
196 '-Wformat-nonliteral',
199 '-Wmissing-include-dirs',
204 '-Waggregate-return',
208 '-Wmissing-prototypes',
209 '-Wold-style-definition',
210 '-Wdeclaration-after-statement',
215 cxx = meson.get_compiler('cpp')
218 foreach extra_arg : warning_flags
219 if cc.has_argument (extra_arg)
220 add_project_arguments([extra_arg], language: 'c')
222 if have_cxx and cxx.has_argument (extra_arg)
223 add_project_arguments([extra_arg], language: 'cpp')
227 foreach extra_arg : warning_c_flags
228 if cc.has_argument (extra_arg)
229 add_project_arguments([extra_arg], language: 'c')
233 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
238 # xgettext is optional (on Windows for instance)
239 if find_program('xgettext', required : false).found()
243 python3 = import('python3').find_python()
244 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')