Set GLib log domain to GES
[platform/upstream/gstreamer.git] / meson.build
1 project('gst-editing-services', 'c',
2   version : '1.15.0.1',
3   meson_version : '>= 0.46.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 = 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 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor * 100 + gst_version_micro)
25
26 glib_req = '>= 2.40.0'
27 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
28
29 cc = meson.get_compiler('c')
30 # Ignore several spurious warnings for things gstreamer does very commonly
31 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
32 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
33 # NOTE: Only add warnings here if you are sure they're spurious
34 if cc.get_id() == 'msvc'
35   add_project_arguments(
36       '/wd4018', # implicit signed/unsigned conversion
37       '/wd4146', # unary minus on unsigned (beware INT_MIN)
38       '/wd4244', # lossy type conversion (e.g. double -> int)
39       '/wd4305', # truncating type conversion (e.g. double -> float)
40       language : 'c')
41 endif
42
43 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
44   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
45 endif
46
47 # Symbol visibility
48 if cc.has_argument('-fvisibility=hidden')
49   add_project_arguments('-fvisibility=hidden', language: 'c')
50 endif
51
52 # Disable strict aliasing
53 if cc.has_argument('-fno-strict-aliasing')
54   add_project_arguments('-fno-strict-aliasing', language: 'c')
55 endif
56
57 cdata = configuration_data()
58 cdata.set('VERSION', '"@0@"'.format(gst_version))
59 cdata.set('PACKAGE', '"gst-editing-services"')
60 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
61 cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
62 cdata.set('PACKAGE_NAME', '"GStreamer Editing Services"')
63 cdata.set('GST_PACKAGE_NAME', '"GStreamer Editing Services"')
64 cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
65 cdata.set('GST_LICENSE', '"LGPL"')
66
67 # Mandatory GST deps
68 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
69     fallback : ['gstreamer', 'gst_dep'])
70 gstpbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
71     fallback : ['gst-plugins-base', 'pbutils_dep'])
72 gstvideo_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
73     fallback : ['gst-plugins-base', 'video_dep'])
74 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
75     fallback : ['gstreamer', 'gst_base_dep'])
76 if host_machine.system() != 'windows'
77   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
78     fallback : ['gstreamer', 'gst_check_dep'], required: false)
79 endif
80 gstcontroller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
81   fallback : ['gstreamer', 'gst_controller_dep'])
82 gstvalidate_dep = dependency('gst-validate-1.0', version : gst_req, required : false,
83   fallback : ['gst-devtools', 'validate_dep'])
84
85 gio_dep = dependency('gio-2.0', fallback: ['glib', 'libgio_dep'])
86 libxml_dep = dependency('libxml-2.0')
87
88 # TODO Properly port to Gtk 3
89 # gtk_dep = dependency('gtk+-3.0', required : false)
90
91 libges_deps = [gst_dep, gstbase_dep, gstvideo_dep, gstpbutils_dep,
92                gstcontroller_dep, gio_dep, libxml_dep]
93
94 if gstvalidate_dep.found()
95     libges_deps = libges_deps + [gstvalidate_dep]
96     cdata.set('HAVE_GST_VALIDATE', 1)
97 endif
98
99 configure_file(output : 'config.h', configuration : cdata)
100
101
102 gir = find_program('g-ir-scanner', required : false)
103 gnome = import('gnome')
104
105 # Fixme, not very elegant.
106 build_gir = gir.found() and not meson.is_cross_build() and get_option('introspection')
107 gir_init_section = [ '--add-init-section=' + \
108     'extern void gst_init(gint*,gchar**);' + \
109     'extern void ges_init(void);' + \
110     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
111     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
112     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
113     'g_setenv("GST_DEBUG", "0", TRUE);' + \
114     'gst_init(NULL,NULL);' + \
115     'ges_init();' ]
116
117 ges_c_args = ['-DHAVE_CONFIG_H', '-DG_LOG_DOMAIN="GES"']
118 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
119
120 if gst_dep.type_name() == 'internal'
121   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
122 else
123   # We can't check that in the case of subprojects as we won't
124   # be able to build against an internal dependency (which is not built yet)
125   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
126 endif
127
128 if gst_debug_disabled and cc.has_argument('-Wno-unused')
129   add_project_arguments('-Wno-unused', language: 'c')
130 endif
131
132 warning_flags = [
133   '-Wmissing-declarations',
134   '-Wmissing-prototypes',
135   '-Wredundant-decls',
136   '-Wundef',
137   '-Wwrite-strings',
138   '-Wformat',
139   '-Wformat-security',
140   '-Winit-self',
141   '-Wmissing-include-dirs',
142   '-Waddress',
143   '-Wno-multichar',
144   '-Wdeclaration-after-statement',
145   '-Wvla',
146   '-Wpointer-arith',
147 ]
148
149 foreach extra_arg : warning_flags
150   if cc.has_argument (extra_arg)
151     add_project_arguments([extra_arg], language: 'c')
152   endif
153 endforeach
154
155 configinc = include_directories('.')
156 subdir('ges')
157 subdir('plugins')
158 subdir('tools')
159 subdir('pkgconfig')
160 subdir('tests')
161 subdir('examples')
162
163 if build_machine.system() == 'windows'
164   message('Disabling gtk-doc while building on Windows')
165 elif not get_option('gtk_doc')
166   message('gtk-doc is disabled via options')
167 else
168   if find_program('gtkdoc-scan', required : false).found()
169     subdir('docs')
170   else
171     message('Not building documentation as gtk-doc was not found')
172   endif
173 endif
174
175 python3 = import('python3').find_python()
176 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')