Release 1.11.91
[platform/upstream/gstreamer.git] / meson.build
1 project('gst-omx', 'c',
2   version : '1.11.91',
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 soversion = 0
23 # maintaining compatibility with the previous libtool versioning
24 # current = minor * 100 + micro
25 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
26
27 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
28
29 cc = meson.get_compiler('c')
30
31 if cc.get_id() == 'msvc'
32   # Ignore several spurious warnings for things gstreamer does very commonly
33   # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
34   # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
35   # NOTE: Only add warnings here if you are sure they're spurious
36   add_project_arguments(
37       '/wd4018', # implicit signed/unsigned conversion
38       '/wd4146', # unary minus on unsigned (beware INT_MIN)
39       '/wd4244', # lossy type conversion (e.g. double -> int)
40       '/wd4305', # truncating type conversion (e.g. double -> float)
41       language : 'c')
42   # Disable SAFESEH with MSVC for plugins and libs that use external deps that
43   # are built with MinGW
44   noseh_link_args = ['/SAFESEH:NO']
45 else
46   noseh_link_args = []
47 endif
48
49 cdata = configuration_data()
50 check_headers = [
51 #  ['HAVE_DLFCN_H', 'dlfcn.h'],
52 #  ['HAVE_FCNTL_H', 'fcntl.h'],
53 #  ['HAVE_INTTYPES_H', 'inttypes.h'],
54 #  ['HAVE_MEMORY_H', 'memory.h'],
55 #  ['HAVE_MSACM_H', 'msacm.h'],
56 #  ['HAVE_PTHREAD_H', 'pthread.h'],
57 #  ['HAVE_STDINT_H', 'stdint.h'],
58 #  ['HAVE_STDLIB_H', 'stdlib.h'],
59 #  ['HAVE_STRINGS_H', 'strings.h'],
60 #  ['HAVE_STRING_H', 'string.h'],
61 #  ['HAVE_SYS_PARAM_H', 'sys/param.h'],
62 #  ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
63 #  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
64 #  ['HAVE_SYS_TIME_H', 'sys/time.h'],
65 #  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
66 #  ['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
67 #  ['HAVE_UNISTD_H', 'unistd.h'],
68 ]
69
70 foreach h : check_headers
71   if cc.has_header(h.get(1))
72     cdata.set(h.get(0), 1)
73   endif
74 endforeach
75
76 check_functions = [
77 # check token HAVE_CPU_ALPHA
78 # check token HAVE_CPU_ARM
79 # check token HAVE_CPU_CRIS
80 # check token HAVE_CPU_CRISV32
81 # check token HAVE_CPU_HPPA
82 # check token HAVE_CPU_I386
83 # check token HAVE_CPU_IA64
84 # check token HAVE_CPU_M68K
85 # check token HAVE_CPU_MIPS
86 # check token HAVE_CPU_PPC
87 # check token HAVE_CPU_PPC64
88 # check token HAVE_CPU_S390
89 # check token HAVE_CPU_SPARC
90 # check token HAVE_CPU_X86_64
91 #  ['HAVE_DCGETTEXT', 'dcgettext'],
92 # check token HAVE_EXPERIMENTAL
93 # check token HAVE_EXTERNAL
94 #  ['HAVE_GETPAGESIZE', 'getpagesize'],
95 # check token HAVE_GETTEXT
96 ]
97
98 foreach f : check_functions
99   if cc.has_function(f.get(1))
100     cdata.set(f.get(0), 1)
101   endif
102 endforeach
103
104 #cdata.set('SIZEOF_CHAR', cc.sizeof('char'))
105 #cdata.set('SIZEOF_INT', cc.sizeof('int'))
106 #cdata.set('SIZEOF_LONG', cc.sizeof('long'))
107 #cdata.set('SIZEOF_SHORT', cc.sizeof('short'))
108 #cdata.set('SIZEOF_VOIDP', cc.sizeof('void*'))
109
110 cdata.set('VERSION', '"@0@"'.format(gst_version))
111 cdata.set('PACKAGE', '"gst-omx"')
112 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
113 cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
114 cdata.set('PACKAGE_NAME', '"GStreamer OMX Plugins"')
115 cdata.set('GETTEXT_PACKAGE', '"gst-omx-1.0"')
116 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
117 cdata.set('GST_PACKAGE_NAME', '"GStreamer OpenMX Plug-ins"')
118 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
119 cdata.set('GST_LICENSE', '"LGPL"')
120 cdata.set('LIBDIR', '"@0@"'.format(get_option('libdir')))
121
122 # FIXME: This should be exposed as a configuration option
123 host_system = host_machine.system()
124 if host_system == 'linux'
125   cdata.set('DEFAULT_VIDEOSRC', '"v4l2src"')
126 elif host_system == 'osx'
127   cdata.set('DEFAULT_VIDEOSRC', '"avfvideosrc"')
128 else
129   cdata.set('DEFAULT_VIDEOSRC', '"videotestsrc"')
130 endif
131
132 # Mandatory GST deps
133 gst_dep = dependency('gstreamer-1.0', version : gst_req,
134   fallback : ['gstreamer', 'gst_dep'])
135 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
136   fallback : ['gstreamer', 'gst_base_dep'])
137 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
138   fallback : ['gstreamer', 'gst_controller_dep'])
139
140 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
141     fallback : ['gst-plugins-base', 'pbutils_dep'])
142 gstaudio_dep = dependency('gstreamer-audio-1.0', version : gst_req,
143     fallback : ['gst-plugins-base', 'audio_dep'])
144 gstfft_dep = dependency('gstreamer-fft-1.0', version : gst_req,
145     fallback : ['gst-plugins-base', 'fft_dep'])
146 gsttag_dep = dependency('gstreamer-tag-1.0', version : gst_req,
147     fallback : ['gst-plugins-base', 'tag_dep'])
148 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
149     fallback : ['gst-plugins-base', 'video_dep'])
150
151 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
152     fallback : ['gst-plugins-bad', 'gstgl_dep'], required : false)
153
154 libm = cc.find_library('m', required : false)
155 glib_dep = dependency('glib-2.0', version : glib_req)
156 gio_dep = dependency('gio-2.0', version : glib_req)
157 gmodule_dep = dependency('gmodule-2.0', version : glib_req)
158
159 gst_omx_args = ['-DHAVE_CONFIG_H']
160 configinc = include_directories('.')
161 omx_header_path = get_option('with_omx_header_path')
162 if omx_header_path != ''
163   gst_omx_args += ['-I' + omx_header_path]
164 endif
165
166 have_external_omx = cc.has_header(
167     'OMX_Core.h',
168     args : gst_omx_args,
169     required : false)
170 extra_video_headers = ''
171 if have_external_omx
172   have_video_ext = cc.has_header (
173       'OMX_VideoExt.h',
174       args : gst_omx_args,
175       required : false)
176   if have_video_ext
177     extra_video_headers += '''
178 #include <OMX_VideoExt.h>'''
179   endif
180 endif
181
182 have_omx_vp8 = cc.has_header_symbol(
183     'OMX_Video.h',
184     'OMX_VIDEO_CodingVP8',
185     prefix : extra_video_headers, 
186     args : gst_omx_args,
187     required : false)
188 if have_omx_vp8
189   cdata.set('HAVE_VP8', 1)
190 endif
191
192 have_omx_theora = cc.has_header_symbol(
193     'OMX_Video.h',
194     'OMX_VIDEO_CodingTheora',
195     prefix : extra_video_headers,
196     args : gst_omx_args,
197     required : false)
198 if have_omx_theora
199   cdata.set('HAVE_THEORA', 1)
200 endif
201
202 default_omx_struct_packing = 0
203 omx_target = get_option ('with_omx_target')
204 if omx_target == 'generic'
205   cdata.set('USE_OMX_TARGET_GENERIC', 1)
206 elif omx_target == 'rpi'
207   cdata.set('USE_OMX_TARGET_RPI', 1)
208   cdata.set('OMX_SKIP64BIT', 1)
209   default_omx_struct_packing = 4
210
211   if gstgl_dep.found()
212     if gstgl_dep.type_name() == 'pkgconfig'
213       gl_winsys = gstgl_dep.get_pkgconfig_variable('gl_winsys').split(',')
214       gl_platforms = gstgl_dep.get_pkgconfig_variable('gl_platforms').split(',')
215     elif gstgl_dep.type_name() == 'internal'
216       # XXX assume gst-plugins-bad was built with dispmanx and egl support
217       gl_winsys = ['dispmanx']
218       gl_platforms = ['egl']
219     else
220       error ('unreachable dependency type')
221     endif
222
223     if not gl_winsys.contains('dispmanx') or not gl_platforms.contains ('egl')
224       gstgl_dep = dependency('', required : false)
225     endif
226   endif
227 elif omx_target == 'bellagio'
228   cdata.set('USE_OMX_TARGET_BELLAGIO', 1)
229 else
230   error ('Unsupported omx target specified. Use the -Dwith_omx_target option')
231 endif
232
233 if gstgl_dep.found()
234   cdata.set ('HAVE_GST_GL', 1)
235 endif
236
237 omx_struct_packing = get_option ('with_omx_struct_packing').to_int()
238 if omx_struct_packing == 0
239   omx_struct_packing = default_omx_struct_packing
240 endif
241 if omx_struct_packing != 0
242   cdata.set('GST_OMX_STRUCT_PACKING', omx_struct_packing)
243 endif
244
245 omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
246 cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
247
248 configure_file(input : 'config.h.meson',
249   output : 'config.h',
250   configuration : cdata)
251
252 subdir('config')
253 subdir('examples')
254 subdir('omx')
255 #subdir('tools')
256
257 python3 = find_program('python3')
258 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')