1 project('gst-devtools', 'c',
3 meson_version : '>= 0.54',
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 if gst_version_minor.is_even()
14 TESTSUITE_VERSION = '@0@.@1@'.format(gst_version_major, gst_version_minor)
16 TESTSUITE_VERSION = 'master'
21 # maintaining compatibility with the previous libtool versioning
22 # current = minor * 100 + micro
23 curversion = gst_version_minor * 100 + gst_version_micro
24 libversion = '@0@.@1@.0'.format(soversion, curversion)
25 osxversion = curversion + 1
27 prefix = get_option('prefix')
29 glib_req = '>= 2.56.0'
30 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
32 cc = meson.get_compiler('c')
34 if cc.get_id() == 'msvc'
36 # Ignore several spurious warnings for things gstreamer does very commonly
37 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
38 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
39 # NOTE: Only add warnings here if you are sure they're spurious
40 '/wd4018', # implicit signed/unsigned conversion
41 '/wd4146', # unary minus on unsigned (beware INT_MIN)
42 '/wd4244', # lossy type conversion (e.g. double -> int)
43 '/wd4305', # truncating type conversion (e.g. double -> float)
44 cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
46 # Enable some warnings on MSVC to match GCC/Clang behaviour
47 '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
48 '/w14101', # 'identifier' : unreferenced local variable
49 '/w14189', # 'identifier' : local variable is initialized but not referenced
51 add_project_arguments(msvc_args, language: 'c')
52 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
53 # are built with MinGW
54 noseh_link_args = ['/SAFESEH:NO']
60 if cc.has_argument('-fvisibility=hidden')
61 add_project_arguments('-fvisibility=hidden', language: 'c')
64 # Disable strict aliasing
65 if cc.has_argument('-fno-strict-aliasing')
66 add_project_arguments('-fno-strict-aliasing', language: 'c')
69 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
70 fallback : ['gstreamer', 'gst_dep'])
71 gstbase_dep = dependency('gstreamer-base-' + apiversion, version : gst_req,
72 fallback : ['gstreamer', 'gst_base_dep'])
73 gst_pbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
74 fallback : ['gst-plugins-base', 'pbutils_dep'])
75 gst_video_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
76 fallback : ['gst-plugins-base', 'video_dep'])
77 gst_controller_dep = dependency('gstreamer-controller-' + apiversion, version : gst_req,
78 fallback : ['gstreamer', 'gst_controller_dep'])
79 gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
80 required : get_option('validate'),
81 fallback : ['gstreamer', 'gst_check_dep'])
83 glib_dep = dependency('glib-2.0', version : '>=2.32.0',
84 fallback: ['glib', 'libglib_dep'])
85 gmodule_dep = dependency('gmodule-2.0',
86 fallback: ['glib', 'libgmodule_dep'])
87 gio_dep = dependency('gio-2.0',
88 fallback: ['glib', 'libgio_dep'])
90 gtk_dep = dependency('gtk+-3.0', required: false)
91 mathlib = cc.find_library('m', required : false)
92 dl = cc.find_library('dl', required : false)
93 json_dep = dependency('json-glib-1.0',
94 fallback : ['json-glib', 'json_glib_dep'])
96 gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API']
98 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
99 'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
100 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
101 'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
102 'gst_init(NULL,NULL);', '--quiet']
103 gir = find_program('g-ir-scanner', required : get_option('introspection'))
104 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
105 gnome = import('gnome')
107 if gst_dep.type_name() == 'internal'
108 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
110 # We can't check that in the case of subprojects as we won't
111 # be able to build against an internal dependency (which is not built yet)
112 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
115 if gst_debug_disabled and cc.has_argument('-Wno-unused')
116 add_project_arguments('-Wno-unused', language: 'c')
120 '-Wmissing-declarations',
121 '-Wmissing-prototypes',
128 '-Wmissing-include-dirs',
131 '-Wdeclaration-after-statement',
136 foreach extra_arg : warning_flags
137 if cc.has_argument (extra_arg)
138 add_project_arguments([extra_arg], language: 'c')
142 pkgconfig = import('pkgconfig')
143 plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0')
144 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
145 if get_option('default_library') == 'shared'
146 # If we don't build static plugins there is no need to generate pc files
147 plugins_pkgconfig_install_dir = disabler()
149 pkgconfig_subdirs = ['gstreamer-1.0']
153 i18n = import('i18n')
155 python_mod = import('python')
156 python3 = python_mod.find_installation()
158 if not get_option('validate').disabled()
162 if not get_option('debug_viewer').disabled()
163 subdir('debug-viewer')
167 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/multi-pre-commit.hook", ".git/hooks/pre-commit")')