1 project('gst-rtsp-server', 'c',
3 meson_version : '>= 0.59',
4 default_options : ['warning_level=1', 'buildtype=debugoptimized'])
6 gst_version = meson.project_version()
7 version_arr = gst_version.split('.')
8 gst_version_major = version_arr[0].to_int()
9 gst_version_minor = version_arr[1].to_int()
10 gst_version_micro = version_arr[2].to_int()
11 if version_arr.length() == 4
12 gst_version_nano = version_arr[3].to_int()
16 gst_version_is_stable = gst_version_minor.is_even()
17 gst_version_is_dev = gst_version_minor.is_odd() and gst_version_micro < 90
19 glib_req = '>= 2.56.0'
21 if gst_version_is_stable
22 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
24 gst_req = '>= ' + gst_version
29 # maintaining compatibility with the previous libtool versioning
30 # current = minor * 100 + micro
31 curversion = gst_version_minor * 100 + gst_version_micro
32 libversion = '@0@.@1@.0'.format(soversion, curversion)
33 osxversion = curversion + 1
35 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
37 cc = meson.get_compiler('c')
39 cdata = configuration_data()
41 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
42 add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
46 if cc.get_id() == 'msvc'
47 export_define = '__declspec(dllexport) extern'
48 elif cc.has_argument('-fvisibility=hidden')
49 add_project_arguments('-fvisibility=hidden', language: 'c')
50 export_define = 'extern __attribute__ ((visibility ("default")))'
52 export_define = 'extern'
55 # Passing this through the command line would be too messy
56 cdata.set('GST_API_EXPORT', export_define)
58 # Disable strict aliasing
59 if cc.has_argument('-fno-strict-aliasing')
60 add_project_arguments('-fno-strict-aliasing', language: 'c')
63 # Define G_DISABLE_DEPRECATED for development versions
65 message('Disabling deprecated GLib API')
66 add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
69 cast_checks = get_option('gobject-cast-checks')
70 if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
71 message('Disabling GLib cast checks')
72 add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
75 glib_asserts = get_option('glib-asserts')
76 if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
77 message('Disabling GLib asserts')
78 add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
81 glib_checks = get_option('glib-checks')
82 if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
83 message('Disabling GLib checks')
84 add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
87 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0')
88 cdata.set_quoted('PACKAGE', 'gst-rtsp-server')
89 cdata.set_quoted('VERSION', gst_version)
90 cdata.set_quoted('PACKAGE_VERSION', gst_version)
91 cdata.set_quoted('GST_API_VERSION', api_version)
92 cdata.set_quoted('GST_LICENSE', 'LGPL')
94 # FIXME: ENABLE_NLS (currently also missing from autotools build)
95 # cdata.set('ENABLE_NLS', true)
96 # cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
98 # GStreamer package name and origin url
99 gst_package_name = get_option('package-name')
100 if gst_package_name == ''
101 if gst_version_nano == 0
102 gst_package_name = 'GStreamer RTSP Server Library source release'
103 elif gst_version_nano == 1
104 gst_package_name = 'GStreamer RTSP Server Library git'
106 gst_package_name = 'GStreamer RTSP Server Library prerelease'
109 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
110 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
112 rtspserver_args = ['-DHAVE_CONFIG_H']
115 '-Wmissing-declarations',
116 '-Wmissing-prototypes',
121 '-Wformat-nonliteral',
123 '-Wold-style-definition',
124 '-Waggregate-return',
126 '-Wmissing-include-dirs',
129 '-Wdeclaration-after-statement',
134 foreach extra_arg : warning_flags
135 if cc.has_argument (extra_arg)
136 add_project_arguments([extra_arg], language: 'c')
140 rtspserver_incs = include_directories('gst/rtsp-server', '.')
142 glib_dep = dependency('glib-2.0', version : glib_req,
143 fallback: ['glib', 'libglib_dep'])
144 gst_dep = dependency('gstreamer-1.0', version : gst_req,
145 fallback : ['gstreamer', 'gst_dep'])
146 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
147 fallback : ['gst-plugins-base', 'rtsp_dep'])
148 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
149 fallback : ['gst-plugins-base', 'rtp_dep'])
150 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
151 fallback : ['gst-plugins-base', 'sdp_dep'])
152 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
153 fallback : ['gst-plugins-base', 'app_dep'])
154 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
155 fallback : ['gstreamer', 'gst_net_dep'])
156 if host_machine.system() != 'windows'
157 gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
158 required : get_option('tests'),
159 fallback : ['gstreamer', 'gst_check_dep'])
162 # Disable compiler warnings for unused variables and args if gst debug system is disabled
163 if gst_dep.type_name() == 'internal'
164 gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
166 # We can't check that in the case of subprojects as we won't
167 # be able to build against an internal dependency (which is not built yet)
168 gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
171 if gst_debug_disabled
172 message('GStreamer debug system is disabled')
173 add_project_arguments(cc.get_supported_arguments(['-Wno-unused']), language: 'c')
175 message('GStreamer debug system is enabled')
178 gir = find_program('g-ir-scanner', required : get_option('introspection'))
179 gnome = import('gnome')
180 build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())
181 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
182 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
183 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
184 'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
185 'gst_init(NULL,NULL);', '--quiet']
187 pkgconfig = import('pkgconfig')
188 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
189 if get_option('default_library') == 'shared'
190 # If we don't build static plugins there is no need to generate pc files
191 plugins_pkgconfig_install_dir = disabler()
195 pkgconfig_subdirs = ['gstreamer-1.0']
196 static_build = get_option('default_library') == 'static'
200 if not get_option('tests').disabled()
203 if not get_option('examples').disabled()
209 if gst_version_nano == 0
210 extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')
211 run_result = run_command(extract_release_date, gst_version, files('gst-rtsp-server.doap'), check: true)
212 release_date = run_result.stdout().strip()
213 cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date)
214 message('Package release date: ' + release_date)
217 configure_file(output: 'config.h', configuration: cdata)