Add a way to disable xptv support
[platform/upstream/gstreamer.git] / meson.build
1 project('gst-editing-services', 'c',
2   version : '1.15.0.1',
3   meson_version : '>= 0.47',
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 = meson.project_version()
10 version_arr = gst_version.split('.')
11 gst_version_major = version_arr[0].to_int()
12 gst_version_minor = version_arr[1].to_int()
13 gst_version_micro = version_arr[2].to_int()
14  if version_arr.length() == 4
15   gst_version_nano = version_arr[3].to_int()
16 else
17   gst_version_nano = 0
18 endif
19
20 apiversion = '1.0'
21 soversion = 0
22 # maintaining compatibility with the previous libtool versioning
23 # current = minor * 100 + micro
24 curversion = gst_version_minor * 100 + gst_version_micro
25 libversion = '@0@.@1@.0'.format(soversion, curversion)
26 osxversion = curversion + 1
27
28 glib_req = '>= 2.40.0'
29 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
30
31 cc = meson.get_compiler('c')
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 if cc.get_id() == 'msvc'
37   add_project_arguments(
38       '/wd4018', # implicit signed/unsigned conversion
39       '/wd4146', # unary minus on unsigned (beware INT_MIN)
40       '/wd4244', # lossy type conversion (e.g. double -> int)
41       '/wd4305', # truncating type conversion (e.g. double -> float)
42       language : 'c')
43 endif
44
45 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
46   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
47 endif
48
49 # Symbol visibility
50 if cc.has_argument('-fvisibility=hidden')
51   add_project_arguments('-fvisibility=hidden', language: 'c')
52 endif
53
54 # Disable strict aliasing
55 if cc.has_argument('-fno-strict-aliasing')
56   add_project_arguments('-fno-strict-aliasing', language: 'c')
57 endif
58
59 cdata = configuration_data()
60 cdata.set('VERSION', '"@0@"'.format(gst_version))
61 cdata.set('PACKAGE', '"gst-editing-services"')
62 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
63 cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
64 cdata.set('PACKAGE_NAME', '"GStreamer Editing Services"')
65 cdata.set('GST_PACKAGE_NAME', '"GStreamer Editing Services"')
66 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
67 cdata.set('GST_LICENSE', '"LGPL"')
68
69 # Mandatory GST deps
70 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
71     fallback : ['gstreamer', 'gst_dep'])
72 gstpbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
73     fallback : ['gst-plugins-base', 'pbutils_dep'])
74 gstvideo_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
75     fallback : ['gst-plugins-base', 'video_dep'])
76 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
77     fallback : ['gstreamer', 'gst_base_dep'])
78 if host_machine.system() != 'windows'
79   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
80     required : get_option('tests'),
81     fallback : ['gstreamer', 'gst_check_dep'])
82 endif
83 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
84   fallback : ['gstreamer', 'gst_controller_dep'])
85 gstvalidate_dep = dependency('gst-validate-1.0', version : gst_req, required : false,
86   fallback : ['gst-devtools', 'validate_dep'])
87
88 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
89 libxml_dep = dependency('libxml-2.0', required: get_option('xptv'))
90 cdata.set('DISABLE_XPTV', not libxml_dep.found())
91
92 # TODO Properly port to Gtk 3
93 # gtk_dep = dependency('gtk+-3.0', required : false)
94
95 libges_deps = [gst_dep, gstbase_dep, gstvideo_dep, gstpbutils_dep,
96                gstcontroller_dep, gio_dep, libxml_dep]
97
98 if gstvalidate_dep.found()
99     libges_deps = libges_deps + [gstvalidate_dep]
100     cdata.set('HAVE_GST_VALIDATE', 1)
101 endif
102
103 configure_file(output : 'config.h', configuration : cdata)
104
105
106 gir = find_program('g-ir-scanner', required : get_option('introspection'))
107 gnome = import('gnome')
108
109 # Fixme, not very elegant.
110 build_gir = gir.found() and not meson.is_cross_build()
111 gir_init_section = [ '--add-init-section=' + \
112     'extern void gst_init(gint*,gchar**);' + \
113     'extern void ges_init(void);' + \
114     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
115     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
116     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
117     'g_setenv("GST_DEBUG", "0", TRUE);' + \
118     'gst_init(NULL,NULL);' + \
119     'ges_init();' ]
120
121 ges_c_args = ['-DHAVE_CONFIG_H', '-DG_LOG_DOMAIN="GES"']
122 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
123
124 pkgconfig = import('pkgconfig')
125 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
126 if get_option('default_library') == 'shared'
127   # If we don't build static plugins there is no need to generate pc files
128   plugins_pkgconfig_install_dir = disabler()
129 endif
130
131 if gst_dep.type_name() == 'internal'
132   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
133 else
134   # We can't check that in the case of subprojects as we won't
135   # be able to build against an internal dependency (which is not built yet)
136   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
137 endif
138
139 if gst_debug_disabled and cc.has_argument('-Wno-unused')
140   add_project_arguments('-Wno-unused', language: 'c')
141 endif
142
143 warning_flags = [
144   '-Wmissing-declarations',
145   '-Wmissing-prototypes',
146   '-Wredundant-decls',
147   '-Wundef',
148   '-Wwrite-strings',
149   '-Wformat',
150   '-Wformat-security',
151   '-Winit-self',
152   '-Wmissing-include-dirs',
153   '-Waddress',
154   '-Wno-multichar',
155   '-Wdeclaration-after-statement',
156   '-Wvla',
157   '-Wpointer-arith',
158 ]
159
160 foreach extra_arg : warning_flags
161   if cc.has_argument (extra_arg)
162     add_project_arguments([extra_arg], language: 'c')
163   endif
164 endforeach
165
166 configinc = include_directories('.')
167 subdir('ges')
168 subdir('plugins')
169 subdir('tools')
170 subdir('pkgconfig')
171 subdir('tests')
172 subdir('examples')
173
174 override_detector = '''
175 import sys
176 import os
177
178 prefix = sys.argv[1]
179 version = sys.version_info
180
181 # If we are installing in the same prefix as PyGobject
182 # make sure to install in the right place.
183 import gi.overrides
184
185 overrides_path = os.path.dirname(gi.overrides.__file__)
186 if os.path.commonprefix([overrides_path, prefix]) == prefix:
187     print(overrides_path)
188     exit(0)
189
190 # Otherwise follow python's way of install site packages inside
191 # the provided prefix
192 if os.name == 'posix':
193     print(os.path.join(
194         prefix, 'lib', 'python%d.%d' % (version.major, version.minor),
195         'site-packages', 'gi', 'overrides'))
196 else:
197     print(os.path.join(
198         prefix, 'Lib', 'Python%d%d' % (version.major, version.minor),
199         'site-packages', 'gi', 'overrides'))
200 '''
201 python3 = import('python').find_installation()
202 pygi_override_dir = get_option('pygi-overrides-dir')
203 if pygi_override_dir == ''
204     cres = run_command(python3, '-c', override_detector, get_option('prefix'))
205     if cres.returncode() == 0
206       pygi_override_dir = cres.stdout().strip()
207     endif
208     if cres.stderr() != ''
209         message(cres.stderr())
210     endif
211 endif
212
213 if pygi_override_dir != ''
214   message('pygobject overrides directory ' + pygi_override_dir)
215   subdir('bindings/python')
216 endif
217
218 if build_machine.system() == 'windows'
219   message('Disabling gtk-doc while building on Windows')
220 else
221   if find_program('gtkdoc-scan', required : get_option('gtk_doc')).found()
222     subdir('docs')
223   else
224     message('Not building documentation as gtk-doc was not found')
225   endif
226 endif
227
228 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')