Release 1.22.3
[platform/upstream/gstreamer.git] / subprojects / gst-devtools / meson.build
1 project('gst-devtools', 'c',
2   version : '1.22.3',
3   meson_version : '>= 0.62',
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].to_int()
11 gst_version_minor = version_arr[1].to_int()
12 gst_version_micro = version_arr[2].to_int()
13 gst_version_is_stable = gst_version_minor.is_even()
14 gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
15 if gst_version_is_stable
16   TESTSUITE_VERSION = '@0@.@1@'.format(gst_version_major, gst_version_minor)
17 else
18   TESTSUITE_VERSION = 'master' # FIXME: main?
19 endif
20
21 apiversion = '1.0'
22 soversion = 0
23 # maintaining compatibility with the previous libtool versioning
24 # current = minor * 100 + micro
25 curversion = gst_version_minor * 100 + gst_version_micro
26 libversion = '@0@.@1@.0'.format(soversion, curversion)
27 osxversion = curversion + 1
28
29 prefix = get_option('prefix')
30
31 glib_req = '>= 2.62.0'
32
33 if gst_version_is_stable
34   gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
35 else
36   gst_req = '>= ' + gst_version
37 endif
38
39 cc = meson.get_compiler('c')
40
41 if cc.get_id() == 'msvc'
42   msvc_args = [
43       # Ignore several spurious warnings for things gstreamer does very commonly
44       # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
45       # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
46       # NOTE: Only add warnings here if you are sure they're spurious
47       '/wd4018', # implicit signed/unsigned conversion
48       '/wd4146', # unary minus on unsigned (beware INT_MIN)
49       '/wd4244', # lossy type conversion (e.g. double -> int)
50       '/wd4305', # truncating type conversion (e.g. double -> float)
51       cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
52
53       # Enable some warnings on MSVC to match GCC/Clang behaviour
54       '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
55       '/w14101', # 'identifier' : unreferenced local variable
56       '/w14189', # 'identifier' : local variable is initialized but not referenced
57   ]
58   add_project_arguments(msvc_args, language: 'c')
59   # Disable SAFESEH with MSVC for plugins and libs that use external deps that
60   # are built with MinGW
61   noseh_link_args = ['/SAFESEH:NO']
62 else
63   noseh_link_args = []
64 endif
65
66 # glib doesn't support unloading, which means that unloading and reloading
67 # any library that registers static types will fail
68 if cc.has_link_argument('-Wl,-z,nodelete')
69   add_project_link_arguments('-Wl,-z,nodelete', language: 'c')
70 endif
71
72 # Symbol visibility
73 if cc.has_argument('-fvisibility=hidden')
74   add_project_arguments('-fvisibility=hidden', language: 'c')
75 endif
76
77 # Disable strict aliasing
78 if cc.has_argument('-fno-strict-aliasing')
79   add_project_arguments('-fno-strict-aliasing', language: 'c')
80 endif
81
82 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
83     fallback : ['gstreamer', 'gst_dep'])
84 gstbase_dep = dependency('gstreamer-base-' + apiversion, version : gst_req,
85     fallback : ['gstreamer', 'gst_base_dep'])
86 gst_pbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
87     fallback : ['gst-plugins-base', 'pbutils_dep'])
88 gst_video_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
89     fallback : ['gst-plugins-base', 'video_dep'])
90 gst_controller_dep = dependency('gstreamer-controller-' + apiversion, version : gst_req,
91     fallback : ['gstreamer', 'gst_controller_dep'])
92 gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
93   required : get_option('validate'),
94   fallback : ['gstreamer', 'gst_check_dep'])
95
96 gio_dep = dependency('gio-2.0', version: glib_req)
97 gmodule_dep = dependency('gmodule-no-export-2.0')
98
99 gtk_dep = dependency('gtk+-3.0', required: false)
100 mathlib = cc.find_library('m', required : false)
101 dl = cc.find_library('dl', required : false)
102 json_dep = dependency('json-glib-1.0',
103     fallback : ['json-glib', 'json_glib_dep'])
104
105 gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API']
106
107 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
108     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
109     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
110     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
111     'gst_init(NULL,NULL);', '--quiet']
112 gir = find_program('g-ir-scanner', required : get_option('introspection'))
113 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
114 gnome = import('gnome')
115
116 if gst_dep.type_name() == 'internal'
117   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
118 else
119   # We can't check that in the case of subprojects as we won't
120   # be able to build against an internal dependency (which is not built yet)
121   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
122 endif
123
124 if gst_debug_disabled and cc.has_argument('-Wno-unused')
125   add_project_arguments('-Wno-unused', language: 'c')
126 endif
127
128 warning_flags = [
129   '-Wmissing-declarations',
130   '-Wmissing-prototypes',
131   '-Wredundant-decls',
132   '-Wundef',
133   '-Wwrite-strings',
134   '-Wformat',
135   '-Wformat-security',
136   '-Winit-self',
137   '-Wmissing-include-dirs',
138   '-Waddress',
139   '-Wno-multichar',
140   '-Wvla',
141   '-Wpointer-arith',
142 ]
143
144 foreach extra_arg : warning_flags
145   if cc.has_argument (extra_arg)
146     add_project_arguments([extra_arg], language: 'c')
147   endif
148 endforeach
149
150 pkgconfig = import('pkgconfig')
151 plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0')
152 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
153 if get_option('default_library') == 'shared'
154   # If we don't build static plugins there is no need to generate pc files
155   plugins_pkgconfig_install_dir = disabler()
156 endif
157 pkgconfig_subdirs = ['gstreamer-1.0']
158
159 gst_plugins_doc_dep = []
160 plugins = []
161 i18n = import('i18n')
162
163 static_build = get_option('default_library') == 'static'
164 gst_libraries = []
165
166 python_mod = import('python')
167 python3 = python_mod.find_installation()
168 if not get_option('validate').disabled()
169   subdir('validate')
170 endif
171
172 if not get_option('debug_viewer').disabled()
173   subdir('debug-viewer')
174 endif
175 subdir('docs')
176
177 meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.20.0', meson.project_version())
178
179 plugin_names = []
180 gst_plugins = []
181 foreach plugin: plugins
182   pkgconfig.generate(plugin, install_dir: plugins_pkgconfig_install_dir)
183   dep = declare_dependency(link_with: plugin, variables: {'full_path': plugin.full_path()})
184   meson.override_dependency(plugin.name(), dep)
185   gst_plugins += [dep]
186   if plugin.name().startswith('gst')
187     plugin_names += [plugin.name().substring(3)]
188   else
189     plugin_names += [plugin.name()]
190   endif
191 endforeach
192
193 summary({
194     'Plugins': plugin_names,
195 }, list_sep: ', ')