meson: add unit tests
[platform/upstream/gst-plugins-good.git] / meson.build
1 project('gst-plugins-good', 'c', 'cpp',
2   version : '1.9.2.1',
3   meson_version : '>= 0.32.0',
4   default_options : [ 'warning_level=1',
5                       'c_std=gnu99',
6                       'buildtype=debugoptimized' ])
7
8 gst_version = meson.project_version()
9 version_arr = gst_version.split('.')
10 gst_version_major = version_arr[0]
11 gst_version_minor = version_arr[1]
12 gst_version_micro = version_arr[2]
13 if version_arr.length() == 4
14   gst_version_nano = version_arr[3]
15 else
16   gst_version_nano = 0
17 endif
18
19 glib_req = '>= 2.40.0'
20 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
21
22 api_version = '1.0'
23
24 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
25
26 cc = meson.get_compiler('c')
27
28 if cc.get_id() == 'msvc'
29   # Ignore several spurious warnings for things gstreamer does very commonly
30   # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
31   # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
32   # NOTE: Only add warnings here if you are sure they're spurious
33   add_global_arguments('/wd4018', '/wd4244', '/wd4996', language : 'c')
34   # Disable SAFESEH with MSVC for plugins and libs that use external deps that
35   # are built with MinGW
36   noseh_link_args = ['/SAFESEH:NO']
37 else
38   noseh_link_args = []
39 endif
40
41 cdata = configuration_data()
42
43 check_headers = [
44   ['HAVE_DLFCN_H', 'dlfcn.h'],
45   ['HAVE_FCNTL_H', 'fcntl.h'],
46   ['HAVE_INTTYPES_H', 'inttypes.h'],
47   ['HAVE_MEMORY_H', 'memory.h'],
48   ['HAVE_PROCESS_H', 'process.h'],
49   ['HAVE_STDINT_H', 'stdint.h'],
50   ['HAVE_STDLIB_H', 'stdlib.h'],
51   ['HAVE_STRINGS_H', 'strings.h'],
52   ['HAVE_STRING_H', 'string.h'],
53   ['HAVE_SYS_IOCTL_H', 'sys/ioctl.h'],
54   ['HAVE_SYS_PARAM_H', 'sys/param.h'],
55   ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
56   ['HAVE_SYS_STAT_H', 'sys/stat.h'],
57   ['HAVE_SYS_TIME_H', 'sys/time.h'],
58   ['HAVE_SYS_TYPES_H', 'sys/types.h'],
59   ['HAVE_UNISTD_H', 'unistd.h'],
60 ]
61
62 foreach h : check_headers
63   if cc.has_header(h.get(1))
64     cdata.set(h.get(0), 1)
65   endif
66 endforeach
67
68 check_functions = [
69   ['HAVE_ASINH', 'asinh', '#include<math.h>'],
70   ['HAVE_CLOCK_GETTIME', 'clock_gettime', '#include<time.h>'],
71   ['HAVE_COSH', 'cosh', '#include<math.h>'],
72 # check token HAVE_CPU_ALPHA
73 # check token HAVE_CPU_ARM
74 # check token HAVE_CPU_CRIS
75 # check token HAVE_CPU_CRISV32
76 # check token HAVE_CPU_HPPA
77 # check token HAVE_CPU_I386
78 # check token HAVE_CPU_IA64
79 # check token HAVE_CPU_M68K
80 # check token HAVE_CPU_MIPS
81 # check token HAVE_CPU_PPC
82 # check token HAVE_CPU_PPC64
83 # check token HAVE_CPU_S390
84 # check token HAVE_CPU_SPARC
85 # check token HAVE_CPU_X86_64
86   ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'],
87 # check token HAVE_DIRECTSOUND
88 # check token HAVE_EXPERIMENTAL
89 # check token HAVE_EXTERNAL
90 # check token HAVE_FPCLASS
91 # check token HAVE_GCC_ASM
92   ['HAVE_GETPAGESIZE', 'getpagesize', '#include<unistd.h>'],
93 # check token HAVE_GETTEXT
94 # check token HAVE_GST_V4L2
95 # check token HAVE_IOS
96   ['HAVE_ISINF', 'isinf', '#include<math.h>'],
97 # check token HAVE_LIBV4L2
98   ['HAVE_MMAP', 'mmap', '#include<sys/mman.h>'],
99 # check token HAVE_OSS
100 # check token HAVE_OSS4
101 # check token HAVE_OSS_INCLUDE_IN_MACHINE
102 # check token HAVE_OSS_INCLUDE_IN_ROOT
103 # check token HAVE_OSS_INCLUDE_IN_SYS
104 # check token HAVE_OSX_AUDIO
105 # check token HAVE_OSX_VIDEO
106 # check token HAVE_RDTSC
107   ['HAVE_SINH', 'sinh', '#include<math.h>'],
108 # check token HAVE_SUNAUDIO
109 # check token HAVE_WAVEFORM
110 ]
111
112 foreach f : check_functions
113   if cc.has_function(f.get(1), prefix : f.get(2))
114     cdata.set(f.get(0), 1)
115   endif
116 endforeach
117
118 cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
119 cdata.set('SIZEOF_INT', cc.sizeof('int'))
120 cdata.set('SIZEOF_LONG', cc.sizeof('long'))
121 cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
122 cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
123
124 # Here be fixmes.
125 # FIXME: check if this is correct
126 cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64')
127 cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc')
128 cdata.set('VERSION', '"@0@"'.format(gst_version))
129 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
130 cdata.set('GST_LICENSE', '"LGPL"')
131 cdata.set('PACKAGE', '"gst-plugins-good"')
132 cdata.set('GETTEXT_PACKAGE', '"gst-plugins-good-1.0"')
133 cdata.set('PACKAGE_NAME', '"GStreamer Good Plug-ins"')
134 cdata.set('GST_PACKAGE_NAME', '"GStreamer Good Plug-ins"')
135 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"') # FIXME: make configurable
136
137 # Mandatory GST deps
138 gst_dep = dependency('gstreamer-1.0', version : gst_req,
139   fallback : ['gstreamer', 'gst_dep'])
140 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
141   fallback : ['gstreamer', 'gst_base_dep'])
142 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
143   fallback : ['gstreamer', 'gst_net_dep'])
144 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
145   fallback : ['gstreamer', 'gst_check_dep'])
146 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
147   fallback : ['gstreamer', 'gst_controller_dep'])
148
149 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
150     fallback : ['gst-plugins-base', 'pbutils_dep'])
151 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
152     fallback : ['gst-plugins-base', 'allocators_dep'])
153 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
154     fallback : ['gst-plugins-base', 'app_dep'])
155 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
156     fallback : ['gst-plugins-base', 'audio_dep'])
157 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
158     fallback : ['gst-plugins-base', 'fft_dep'])
159 gstriff_dep = dependency('gstreamer-riff-1.0', version : gst_req,
160     fallback : ['gst-plugins-base', 'riff_dep'])
161 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
162     fallback : ['gst-plugins-base', 'rtp_dep'])
163 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
164     fallback : ['gst-plugins-base', 'rtsp_dep'])
165 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
166     fallback : ['gst-plugins-base', 'sdp_dep'])
167 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
168     fallback : ['gst-plugins-base', 'tag_dep'])
169 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
170     fallback : ['gst-plugins-base', 'video_dep'])
171
172 libm = cc.find_library('m', required : false)
173 zlib_dep = dependency('zlib')
174 bz2lib = cc.find_library('bz2', required : false)
175 gio_dep = dependency('gio-2.0', version : glib_req)
176 glib_deps = [dependency('glib-2.0', version : glib_req),
177              dependency('gobject-2.0', version : glib_req)]
178
179 cdata.set('HAVE_ZLIB', 1)
180 if bz2lib.found()
181   cdata.set('HAVE_BZ2', 1)
182 endif
183
184 # Check all of the things.
185 # TODO: None of these are actually used yet because
186 # the build files haven't been written
187 deps = [
188   ['gtk_dep','gtk+-3.0', '', ''],
189   ['gtkx_dep','gtk+-x11-3.0', '', ''],
190   ['jack_dep','jack', '>=1.9.7', 'HAVE_JACK_1_9_7'],
191   ['caca_dep','caca', '', ''],
192   ['libdv_dep','libdv', '>=0.100', ''],
193   ['libraw1394_dep','libraw1394', '>=2.0.0', ''],
194   ['libiec61883_dep','libiec61883', '>=1.0.0', ''],
195   ['libraw1394_dep','libraw1394', '>=1.1.0', ''],
196   ['shout_dep','shout', '>=2.0', ''],
197   ['taglib_dep','taglib', '>=1.5', ''],
198   ['wavpack_dep','wavpack', '>= 4.20', 'HAVE_WAVPACK'],
199 ]
200
201 foreach d : deps
202   varname = d[0]
203   depname = d[1]
204   version = d[2]
205   confhname = d[3]
206   if version == ''
207     curdep = dependency(depname, required : false)
208   else
209     curdep = dependency(depname, required : false, version : version)
210   endif
211   set_variable(varname, curdep)
212   if curdep.found() and confhname != ''
213     cdata.set(confhname, 1)
214   endif
215 endforeach
216
217 gst_plugins_good_args = ['-DHAVE_CONFIG_H']
218 configinc = include_directories('.')
219 libsinc = include_directories('gst-libs')
220
221 have_orcc = false
222 orcc_args = []
223 if get_option('use_orc') != 'no'
224   need_orc = get_option('use_orc') == 'yes'
225   # Used by various libraries/elements that use Orc code
226   orc_dep = dependency('orc-0.4', version : '>= 0.4.17', required : need_orc)
227   orcc = find_program('orcc', required : need_orc)
228   if orc_dep.found() and orcc.found()
229     have_orcc = true
230     orcc_args = [orcc, '--include', 'glib.h']
231     cdata.set('HAVE_ORC', 1)
232   else
233     message('Orc Compiler not found, will use backup C code')
234     cdata.set('DISABLE_ORC', 1)
235   endif
236 else
237   cdata.set('DISABLE_ORC', 1)
238 endif
239
240 subdir('gst')
241 subdir('sys')
242 subdir('ext')
243 subdir('tests')
244 subdir('po')
245
246 configure_file(input : 'config.h.meson',
247   output : 'config.h',
248   configuration : cdata)