1 project('gst-devtools', 'c',
3 meson_version : '>= 0.62',
4 default_options : [ 'warning_level=1',
6 'buildtype=debugoptimized' ])
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)
18 TESTSUITE_VERSION = 'master' # FIXME: main?
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
29 prefix = get_option('prefix')
31 glib_req = '>= 2.62.0'
33 if gst_version_is_stable
34 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
36 gst_req = '>= ' + gst_version
39 cc = meson.get_compiler('c')
41 if cc.get_id() == 'msvc'
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
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
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']
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')
73 if cc.has_argument('-fvisibility=hidden')
74 add_project_arguments('-fvisibility=hidden', language: 'c')
77 # Disable strict aliasing
78 if cc.has_argument('-fno-strict-aliasing')
79 add_project_arguments('-fno-strict-aliasing', language: 'c')
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'])
96 gio_dep = dependency('gio-2.0', version: glib_req)
97 gmodule_dep = dependency('gmodule-no-export-2.0')
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'])
105 gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API']
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')
116 if gst_dep.type_name() == 'internal'
117 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
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)
124 if gst_debug_disabled and cc.has_argument('-Wno-unused')
125 add_project_arguments('-Wno-unused', language: 'c')
129 '-Wmissing-declarations',
130 '-Wmissing-prototypes',
137 '-Wmissing-include-dirs',
144 foreach extra_arg : warning_flags
145 if cc.has_argument (extra_arg)
146 add_project_arguments([extra_arg], language: 'c')
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()
157 pkgconfig_subdirs = ['gstreamer-1.0']
159 gst_plugins_doc_dep = []
161 i18n = import('i18n')
163 static_build = get_option('default_library') == 'static'
166 python_mod = import('python')
167 python3 = python_mod.find_installation()
168 if not get_option('validate').disabled()
172 if not get_option('debug_viewer').disabled()
173 subdir('debug-viewer')
177 meson.add_dist_script('scripts/gen-changelog.py', meson.project_name(), '1.20.0', meson.project_version())
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)
186 if plugin.name().startswith('gst')
187 plugin_names += [plugin.name().substring(3)]
189 plugin_names += [plugin.name()]
194 'Plugins': plugin_names,