aacparse: Add codec_data in caps, even if stream-format is adts
[platform/upstream/gst-plugins-good.git] / meson.build
1 project('gst-plugins-good', 'c', 'cpp',
2   version : '1.12.2',
3   meson_version : '>= 0.36.0',
4   default_options : [ 'warning_level=1',
5                       'buildtype=debugoptimized' ])
6
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]
14 else
15   gst_version_nano = 0
16 endif
17
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
20
21 api_version = '1.0'
22
23 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
24
25 cc = meson.get_compiler('c')
26
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)
37       language : 'c')
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']
41 else
42   noseh_link_args = []
43 endif
44
45 cdata = configuration_data()
46
47 check_headers = [
48   ['HAVE_DLFCN_H', 'dlfcn.h'],
49   ['HAVE_FCNTL_H', 'fcntl.h'],
50   ['HAVE_INTTYPES_H', 'inttypes.h'],
51   ['HAVE_MEMORY_H', 'memory.h'],
52   ['HAVE_PROCESS_H', 'process.h'],
53   ['HAVE_STDINT_H', 'stdint.h'],
54   ['HAVE_STDLIB_H', 'stdlib.h'],
55   ['HAVE_STRINGS_H', 'strings.h'],
56   ['HAVE_STRING_H', 'string.h'],
57   ['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'],
58   ['HAVE_SYS_PARAM_H', 'sys/param.h'],
59   ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
60   ['HAVE_SYS_STAT_H', 'sys/stat.h'],
61   ['HAVE_SYS_TIME_H', 'sys/time.h'],
62   ['HAVE_SYS_TYPES_H', 'sys/types.h'],
63   ['HAVE_UNISTD_H', 'unistd.h'],
64 ]
65
66 foreach h : check_headers
67   if cc.has_header(h.get(1))
68     cdata.set(h.get(0), 1)
69   endif
70 endforeach
71
72 check_functions = [
73   ['HAVE_ASINH', 'asinh', '#include<math.h>'],
74   ['HAVE_CLOCK_GETTIME', 'clock_gettime', '#include<time.h>'],
75   ['HAVE_COSH', 'cosh', '#include<math.h>'],
76 # check token HAVE_CPU_ALPHA
77 # check token HAVE_CPU_ARM
78 # check token HAVE_CPU_CRIS
79 # check token HAVE_CPU_CRISV32
80 # check token HAVE_CPU_HPPA
81 # check token HAVE_CPU_I386
82 # check token HAVE_CPU_IA64
83 # check token HAVE_CPU_M68K
84 # check token HAVE_CPU_MIPS
85 # check token HAVE_CPU_PPC
86 # check token HAVE_CPU_PPC64
87 # check token HAVE_CPU_S390
88 # check token HAVE_CPU_SPARC
89 # check token HAVE_CPU_X86_64
90   ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'],
91 # check token HAVE_DIRECTSOUND
92 # check token HAVE_EXPERIMENTAL
93 # check token HAVE_EXTERNAL
94 # check token HAVE_FPCLASS
95 # check token HAVE_GCC_ASM
96   ['HAVE_GETPAGESIZE', 'getpagesize', '#include<unistd.h>'],
97 # check token HAVE_GETTEXT
98 # check token HAVE_GST_V4L2
99 # check token HAVE_IOS
100   ['HAVE_ISINF', 'isinf', '#include<math.h>'],
101 # check token HAVE_LIBV4L2
102   ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'],
103 # check token HAVE_OSS
104 # check token HAVE_OSS4
105 # check token HAVE_OSS_INCLUDE_IN_MACHINE
106 # check token HAVE_OSS_INCLUDE_IN_ROOT
107 # check token HAVE_OSS_INCLUDE_IN_SYS
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_SUNAUDIO
113 # check token HAVE_WAVEFORM
114 ]
115
116 libm = cc.find_library('m', required : false)
117
118 foreach f : check_functions
119   if cc.has_function(f.get(1), prefix : f.get(2), dependencies : libm)
120     cdata.set(f.get(0), 1)
121   endif
122 endforeach
123
124 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
125 cdata.set('SIZEOF_INT', cc.sizeof('int'))
126 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
127 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
128 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
129
130 # Here be fixmes.
131 # FIXME: check if this is correct
132 cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64')
133 cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc')
134 cdata.set('VERSION', '"@0@"'.format(gst_version))
135 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
136 cdata.set('GST_LICENSE', '"LGPL"')
137 cdata.set('PACKAGE', '"gst-plugins-good"')
138 cdata.set('GETTEXT_PACKAGE', '"gst-plugins-good-1.0"')
139 cdata.set('PACKAGE_NAME', '"GStreamer Good Plug-ins"')
140 cdata.set('GST_PACKAGE_NAME', '"GStreamer Good Plug-ins"')
141 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"') # FIXME: make configurable
142
143 # Mandatory GST deps
144 gst_dep = dependency('gstreamer-1.0', version : gst_req,
145   fallback : ['gstreamer', 'gst_dep'])
146 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
147   fallback : ['gstreamer', 'gst_base_dep'])
148 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
149   fallback : ['gstreamer', 'gst_net_dep'])
150 if host_machine.system() != 'windows'
151   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
152     fallback : ['gstreamer', 'gst_check_dep'])
153 endif
154 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
155   fallback : ['gstreamer', 'gst_controller_dep'])
156
157 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
158     fallback : ['gst-plugins-base', 'pbutils_dep'])
159 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
160     fallback : ['gst-plugins-base', 'allocators_dep'])
161 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
162     fallback : ['gst-plugins-base', 'app_dep'])
163 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
164     fallback : ['gst-plugins-base', 'audio_dep'])
165 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
166     fallback : ['gst-plugins-base', 'fft_dep'])
167 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
168     fallback : ['gst-plugins-base', 'riff_dep'])
169 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
170     fallback : ['gst-plugins-base', 'rtp_dep'])
171 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
172     fallback : ['gst-plugins-base', 'rtsp_dep'])
173 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
174     fallback : ['gst-plugins-base', 'sdp_dep'])
175 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
176     fallback : ['gst-plugins-base', 'tag_dep'])
177 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
178     fallback : ['gst-plugins-base', 'video_dep'])
179
180 zlib_dep = dependency('zlib')
181 bz2lib = cc.find_library('bz2', required : false)
182 gio_dep = dependency('gio-2.0', version : glib_req)
183 glib_deps = [dependency('glib-2.0', version : glib_req),
184              dependency('gobject-2.0', version : glib_req)]
185
186 cdata.set('HAVE_ZLIB', 1)
187 if bz2lib.found()
188   cdata.set('HAVE_BZ2', 1)
189 endif
190
191 # Check all of the things.
192 # TODO: None of these are actually used yet because
193 # the build files haven't been written
194 deps = [
195   ['gtk_dep','gtk+-3.0', '', ''],
196   ['gtkx_dep','gtk+-x11-3.0', '', ''],
197   ['caca_dep','caca', '', ''],
198   ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
199   ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
200 ]
201
202 foreach d : deps
203   varname = d[0]
204   depname = d[1]
205   version = d[2]
206   confhname = d[3]
207   if version == ''
208     curdep = dependency(depname, required : false)
209   else
210     curdep = dependency(depname, required : false, version : version)
211   endif
212   set_variable(varname, curdep)
213   if curdep.found() and confhname != ''
214     cdata.set(confhname, 1)
215   endif
216 endforeach
217
218 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
219 configinc = include_directories('.')
220 libsinc = include_directories('gst-libs')
221
222 have_orcc = false
223 orcc_args = []
224 if get_option('use_orc') != 'no'
225   need_orc = get_option('use_orc') == 'yes'
226   # Used by various libraries/elements that use Orc code
227   orc_dep = dependency('orc-0.4', version : '>= 0.4.17', required : need_orc)
228   orcc = find_program('orcc', required : need_orc)
229   if orc_dep.found() and orcc.found()
230     have_orcc = true
231     orcc_args = [orcc, '--include', 'glib.h']
232     cdata.set('HAVE_ORC', 1)
233   else
234     message('Orc Compiler not found, will use backup C code')
235     cdata.set('DISABLE_ORC', 1)
236   endif
237 else
238   cdata.set('DISABLE_ORC', 1)
239 endif
240
241 if gst_dep.type_name() == 'internal'
242     gst_proj = subproject('gstreamer')
243
244     if gst_proj.get_variable('disable_gst_debug')
245         message('GStreamer debug system is disabled')
246         add_project_arguments('-Wno-unused', language: 'c')
247     else
248         message('GStreamer debug system is enabled')
249     endif
250 else
251     # We can't check that in the case of subprojects as we won't
252     # be able to build against an internal dependency (which is not built yet)
253     if not cc.compiles('''
254 #include <gst/gstconfig.h>
255 #ifdef GST_DISABLE_GST_DEBUG
256 #error "debugging disabled, make compiler fail"
257 #endif''' , dependencies: gst_dep)
258         message('GStreamer debug system is disabled')
259         add_project_arguments('-Wno-unused', language: 'c')
260     else
261         message('GStreamer debug system is enabled')
262     endif
263 endif
264
265 presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
266
267 subdir('gst')
268 subdir('sys')
269 subdir('ext')
270 subdir('tests')
271 subdir('po')
272 subdir('pkgconfig')
273
274 configure_file(input : 'config.h.meson',
275   output : 'config.h',
276   configuration : cdata)
277
278 python3 = find_program('python3')
279 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')