1 project('gst-plugins-good', '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]
10 gst_version_minor = version_arr[1]
11 gst_version_micro = version_arr[2]
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3]
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
23 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
25 cc = meson.get_compiler('c')
27 if cc.get_id() == 'msvc'
28 # Ignore several spurious warnings for things gstreamer does very commonly
29 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
30 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
31 # NOTE: Only add warnings here if you are sure they're spurious
32 add_project_arguments(
33 '/wd4018', # implicit signed/unsigned conversion
34 '/wd4146', # unary minus on unsigned (beware INT_MIN)
35 '/wd4244', # lossy type conversion (e.g. double -> int)
36 '/wd4305', # truncating type conversion (e.g. double -> float)
38 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
39 # are built with MinGW
40 noseh_link_args = ['/SAFESEH:NO']
46 if cc.has_argument('-fvisibility=hidden')
47 add_project_arguments('-fvisibility=hidden', language: 'c')
50 cdata = configuration_data()
53 ['HAVE_DLFCN_H', 'dlfcn.h'],
54 ['HAVE_FCNTL_H', 'fcntl.h'],
55 ['HAVE_INTTYPES_H', 'inttypes.h'],
56 ['HAVE_MEMORY_H', 'memory.h'],
57 ['HAVE_PROCESS_H', 'process.h'],
58 ['HAVE_STDINT_H', 'stdint.h'],
59 ['HAVE_STDLIB_H', 'stdlib.h'],
60 ['HAVE_STRINGS_H', 'strings.h'],
61 ['HAVE_STRING_H', 'string.h'],
62 ['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'],
63 ['HAVE_SYS_PARAM_H', 'sys/param.h'],
64 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
65 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
66 ['HAVE_SYS_TIME_H', 'sys/time.h'],
67 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
68 ['HAVE_UNISTD_H', 'unistd.h'],
71 foreach h : check_headers
72 if cc.has_header(h.get(1))
73 cdata.set(h.get(0), 1)
78 ['HAVE_ASINH', 'asinh', '#include<math.h>'],
79 ['HAVE_CLOCK_GETTIME', 'clock_gettime', '#include<time.h>'],
80 ['HAVE_COSH', 'cosh', '#include<math.h>'],
81 # check token HAVE_CPU_ALPHA
82 # check token HAVE_CPU_ARM
83 # check token HAVE_CPU_CRIS
84 # check token HAVE_CPU_CRISV32
85 # check token HAVE_CPU_HPPA
86 # check token HAVE_CPU_I386
87 # check token HAVE_CPU_IA64
88 # check token HAVE_CPU_M68K
89 # check token HAVE_CPU_MIPS
90 # check token HAVE_CPU_PPC
91 # check token HAVE_CPU_PPC64
92 # check token HAVE_CPU_S390
93 # check token HAVE_CPU_SPARC
94 # check token HAVE_CPU_X86_64
95 ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'],
96 # check token HAVE_DIRECTSOUND
97 # check token HAVE_EXPERIMENTAL
98 # check token HAVE_EXTERNAL
99 # check token HAVE_FPCLASS
100 # check token HAVE_GCC_ASM
101 ['HAVE_GETPAGESIZE', 'getpagesize', '#include<unistd.h>'],
102 # check token HAVE_GETTEXT
103 # check token HAVE_GST_V4L2
104 # check token HAVE_IOS
105 ['HAVE_ISINF', 'isinf', '#include<math.h>'],
106 # check token HAVE_LIBV4L2
107 ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'],
108 # check token HAVE_OSX_AUDIO
109 # check token HAVE_OSX_VIDEO
110 # check token HAVE_RDTSC
111 ['HAVE_SINH', 'sinh', '#include<math.h>'],
112 # check token HAVE_WAVEFORM
115 libm = cc.find_library('m', required : false)
117 foreach f : check_functions
118 if cc.has_function(f.get(1), prefix : f.get(2), dependencies : libm)
119 cdata.set(f.get(0), 1)
123 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
124 cdata.set('SIZEOF_INT', cc.sizeof('int'))
125 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
126 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
127 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
130 # FIXME: check if this is correct
131 cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64')
132 cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc')
133 cdata.set('VERSION', '"@0@"'.format(gst_version))
134 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
135 cdata.set('GST_LICENSE', '"LGPL"')
136 cdata.set('PACKAGE', '"gst-plugins-good"')
137 cdata.set('GETTEXT_PACKAGE', '"gst-plugins-good-1.0"')
139 # GStreamer package name and origin url
140 gst_package_name = get_option('with-package-name')
141 if gst_package_name == ''
142 if gst_version_nano == 0
143 gst_package_name = 'GStreamer Good Plug-ins source release'
144 elif gst_version_nano == 1
145 gst_package_name = 'GStreamer Good Plug-ins git'
147 gst_package_name = 'GStreamer Good Plug-ins prerelease'
150 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
151 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('with-package-origin'))
154 gst_dep = dependency('gstreamer-1.0', version : gst_req,
155 fallback : ['gstreamer', 'gst_dep'])
156 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
157 fallback : ['gstreamer', 'gst_base_dep'])
158 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
159 fallback : ['gstreamer', 'gst_net_dep'])
160 if host_machine.system() != 'windows'
161 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
162 fallback : ['gstreamer', 'gst_check_dep'])
164 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
165 fallback : ['gstreamer', 'gst_controller_dep'])
167 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
168 fallback : ['gst-plugins-base', 'pbutils_dep'])
169 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
170 fallback : ['gst-plugins-base', 'allocators_dep'])
171 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
172 fallback : ['gst-plugins-base', 'app_dep'])
173 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
174 fallback : ['gst-plugins-base', 'audio_dep'])
175 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
176 fallback : ['gst-plugins-base', 'fft_dep'])
177 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
178 fallback : ['gst-plugins-base', 'riff_dep'])
179 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
180 fallback : ['gst-plugins-base', 'rtp_dep'])
181 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
182 fallback : ['gst-plugins-base', 'rtsp_dep'])
183 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
184 fallback : ['gst-plugins-base', 'sdp_dep'])
185 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
186 fallback : ['gst-plugins-base', 'tag_dep'])
187 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
188 fallback : ['gst-plugins-base', 'video_dep'])
190 zlib_dep = dependency('zlib')
191 bz2lib = cc.find_library('bz2', required : false)
192 glib_deps = [dependency('glib-2.0', version : glib_req, fallback: ['glib', 'libglib_dep']),
193 dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])]
194 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
196 cdata.set('HAVE_ZLIB', 1)
198 cdata.set('HAVE_BZ2', 1)
201 # Check all of the things.
202 # TODO: None of these are actually used yet because
203 # the build files haven't been written
205 ['gtk_dep','gtk+-3.0', '', ''],
206 ['gtkx_dep','gtk+-x11-3.0', '', ''],
207 ['caca_dep','caca', '', ''],
208 ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
209 ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
218 curdep = dependency(depname, required : false)
220 curdep = dependency(depname, required : false, version : version)
222 set_variable(varname, curdep)
223 if curdep.found() and confhname != ''
224 cdata.set(confhname, 1)
228 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
229 configinc = include_directories('.')
230 libsinc = include_directories('gst-libs')
234 if get_option('use_orc') != 'no'
235 need_orc = get_option('use_orc') == 'yes'
236 # Used by various libraries/elements that use Orc code
237 orc_dep = dependency('orc-0.4', version : '>= 0.4.17', required : need_orc)
238 orcc = find_program('orcc', required : need_orc)
239 if orc_dep.found() and orcc.found()
241 orcc_args = [orcc, '--include', 'glib.h']
242 cdata.set('HAVE_ORC', 1)
244 message('Orc Compiler not found, will use backup C code')
245 cdata.set('DISABLE_ORC', 1)
248 cdata.set('DISABLE_ORC', 1)
251 if gst_dep.type_name() == 'internal'
252 gst_proj = subproject('gstreamer')
254 if gst_proj.get_variable('disable_gst_debug')
255 message('GStreamer debug system is disabled')
256 add_project_arguments('-Wno-unused', language: 'c')
258 message('GStreamer debug system is enabled')
261 # We can't check that in the case of subprojects as we won't
262 # be able to build against an internal dependency (which is not built yet)
263 if not cc.compiles('''
264 #include <gst/gstconfig.h>
265 #ifdef GST_DISABLE_GST_DEBUG
266 #error "debugging disabled, make compiler fail"
267 #endif''' , dependencies: gst_dep)
268 message('GStreamer debug system is disabled')
269 add_project_arguments('-Wno-unused', language: 'c')
271 message('GStreamer debug system is enabled')
275 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
284 configure_file(output : 'config.h', configuration : cdata)
286 python3 = import('python3').find_python()
287 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')