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