Release 1.19.90
[platform/upstream/gstreamer.git] / subprojects / gst-devtools / meson.build
1 project('gst-devtools', 'c',
2   version : '1.19.90',
3   meson_version : '>= 0.59',
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.56.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 # Symbol visibility
67 if cc.has_argument('-fvisibility=hidden')
68   add_project_arguments('-fvisibility=hidden', language: 'c')
69 endif
70
71 # Disable strict aliasing
72 if cc.has_argument('-fno-strict-aliasing')
73   add_project_arguments('-fno-strict-aliasing', language: 'c')
74 endif
75
76 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
77     fallback : ['gstreamer', 'gst_dep'])
78 gstbase_dep = dependency('gstreamer-base-' + apiversion, version : gst_req,
79     fallback : ['gstreamer', 'gst_base_dep'])
80 gst_pbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
81     fallback : ['gst-plugins-base', 'pbutils_dep'])
82 gst_video_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
83     fallback : ['gst-plugins-base', 'video_dep'])
84 gst_controller_dep = dependency('gstreamer-controller-' + apiversion, version : gst_req,
85     fallback : ['gstreamer', 'gst_controller_dep'])
86 gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
87   required : get_option('validate'),
88   fallback : ['gstreamer', 'gst_check_dep'])
89
90 glib_dep = dependency('glib-2.0', version : '>=2.32.0',
91   fallback: ['glib', 'libglib_dep'])
92 gmodule_dep = dependency('gmodule-2.0',
93   fallback: ['glib', 'libgmodule_dep'])
94 gio_dep = dependency('gio-2.0',
95   fallback: ['glib', 'libgio_dep'])
96
97 gtk_dep = dependency('gtk+-3.0', required: false)
98 mathlib = cc.find_library('m', required : false)
99 dl = cc.find_library('dl', required : false)
100 json_dep = dependency('json-glib-1.0',
101     fallback : ['json-glib', 'json_glib_dep'])
102
103 gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API']
104
105 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
106     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
107     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
108     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
109     'gst_init(NULL,NULL);', '--quiet']
110 gir = find_program('g-ir-scanner', required : get_option('introspection'))
111 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
112 gnome = import('gnome')
113
114 if gst_dep.type_name() == 'internal'
115   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
116 else
117   # We can't check that in the case of subprojects as we won't
118   # be able to build against an internal dependency (which is not built yet)
119   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
120 endif
121
122 if gst_debug_disabled and cc.has_argument('-Wno-unused')
123   add_project_arguments('-Wno-unused', language: 'c')
124 endif
125
126 warning_flags = [
127   '-Wmissing-declarations',
128   '-Wmissing-prototypes',
129   '-Wredundant-decls',
130   '-Wundef',
131   '-Wwrite-strings',
132   '-Wformat',
133   '-Wformat-security',
134   '-Winit-self',
135   '-Wmissing-include-dirs',
136   '-Waddress',
137   '-Wno-multichar',
138   '-Wdeclaration-after-statement',
139   '-Wvla',
140   '-Wpointer-arith',
141 ]
142
143 foreach extra_arg : warning_flags
144   if cc.has_argument (extra_arg)
145     add_project_arguments([extra_arg], language: 'c')
146   endif
147 endforeach
148
149 pkgconfig = import('pkgconfig')
150 plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0')
151 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
152 if get_option('default_library') == 'shared'
153   # If we don't build static plugins there is no need to generate pc files
154   plugins_pkgconfig_install_dir = disabler()
155 endif
156 pkgconfig_subdirs = ['gstreamer-1.0']
157
158 plugins_doc_dep = []
159 plugins = []
160 i18n = import('i18n')
161
162 static_build = get_option('default_library') == 'static'
163 libraries = []
164
165 python_mod = import('python')
166 python3 = python_mod.find_installation()
167 if not get_option('validate').disabled()
168   subdir('validate')
169 endif
170
171 if not get_option('debug_viewer').disabled()
172   subdir('debug-viewer')
173 endif
174 subdir('docs')