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