Update git locations to gitlab
[platform/upstream/gst-rtsp-server.git] / meson.build
1 project('gst-rtsp-server', 'c',
2   version : '1.15.0.1',
3   meson_version : '>= 0.47',
4   default_options : ['warning_level=1', 'buildtype=debugoptimized'])
5
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()
13 else
14   gst_version_nano = 0
15 endif
16 gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90
17
18 glib_req = '>= 2.40.0'
19 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
20
21 api_version = '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 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
30
31 cc = meson.get_compiler('c')
32
33 cdata = configuration_data()
34
35 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
36   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
37 endif
38
39 # Symbol visibility
40 if cc.get_id() == 'msvc'
41   export_define = '__declspec(dllexport) extern'
42 elif cc.has_argument('-fvisibility=hidden')
43   add_project_arguments('-fvisibility=hidden', language: 'c')
44   export_define = 'extern __attribute__ ((visibility ("default")))'
45 else
46   export_define = 'extern'
47 endif
48
49 # Passing this through the command line would be too messy
50 cdata.set('GST_API_EXPORT', export_define)
51
52 # Disable strict aliasing
53 if cc.has_argument('-fno-strict-aliasing')
54   add_project_arguments('-fno-strict-aliasing', language: 'c')
55 endif
56
57 # Define G_DISABLE_DEPRECATED for development versions
58 if gst_version_is_dev
59   message('Disabling deprecated GLib API')
60   add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
61 endif
62
63 cast_checks = get_option('gobject-cast-checks')
64 if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
65   message('Disabling GLib cast checks')
66   add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
67 endif
68
69 glib_asserts = get_option('glib-asserts')
70 if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
71   message('Disabling GLib asserts')
72   add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
73 endif
74
75 glib_checks = get_option('glib-checks')
76 if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
77   message('Disabling GLib checks')
78   add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
79 endif
80
81 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0')
82 cdata.set_quoted('PACKAGE', 'gst-rtsp-server')
83 cdata.set_quoted('VERSION', gst_version)
84 cdata.set_quoted('PACKAGE_VERSION', gst_version)
85 cdata.set_quoted('GST_API_VERSION', api_version)
86 cdata.set_quoted('GST_LICENSE', 'LGPL')
87
88 # FIXME: ENABLE_NLS (currently also missing from autotools build)
89 # cdata.set('ENABLE_NLS', true)
90 # cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
91
92 # GStreamer package name and origin url
93 gst_package_name = get_option('package-name')
94 if gst_package_name == ''
95   if gst_version_nano == 0
96     gst_package_name = 'GStreamer RTSP Server Library source release'
97   elif gst_version_nano == 1
98     gst_package_name = 'GStreamer RTSP Server Library git'
99   else
100     gst_package_name = 'GStreamer RTSP Server Library prerelease'
101   endif
102 endif
103 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
104 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
105
106 configure_file(output : 'config.h', configuration : cdata)
107
108 rtspserver_args = ['-DHAVE_CONFIG_H']
109
110 warning_flags = [
111   '-Wmissing-declarations',
112   '-Wmissing-prototypes',
113   '-Wredundant-decls',
114   '-Wundef',
115   '-Wwrite-strings',
116   '-Wformat',
117   '-Wformat-nonliteral',
118   '-Wformat-security',
119   '-Wold-style-definition',
120   '-Waggregate-return',
121   '-Wnested-externs',
122   '-Winit-self',
123   '-Wmissing-include-dirs',
124   '-Waddress',
125   '-Wno-multichar',
126   '-Wdeclaration-after-statement',
127   '-Wvla',
128   '-Wpointer-arith',
129 ]
130
131 foreach extra_arg : warning_flags
132   if cc.has_argument (extra_arg)
133     add_project_arguments([extra_arg], language: 'c')
134   endif
135 endforeach
136
137 rtspserver_incs = include_directories('gst/rtsp-server', '.')
138
139 glib_dep = dependency('glib-2.0', version : glib_req,
140   fallback: ['glib', 'libglib_dep'])
141 gst_dep = dependency('gstreamer-1.0', version : gst_req,
142   fallback : ['gstreamer', 'gst_dep'])
143 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
144   fallback : ['gst-plugins-base', 'rtsp_dep'])
145 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
146   fallback : ['gst-plugins-base', 'rtp_dep'])
147 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
148   fallback : ['gst-plugins-base', 'sdp_dep'])
149 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
150   fallback : ['gst-plugins-base', 'app_dep'])
151 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
152   fallback : ['gstreamer', 'gst_net_dep'])
153 if host_machine.system() != 'windows'
154   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
155     required : get_option('tests'),
156     fallback : ['gstreamer', 'gst_check_dep'])
157 endif
158
159 gir = find_program('g-ir-scanner', required : get_option('introspection'))
160 gnome = import('gnome')
161 build_gir = gir.found() and not meson.is_cross_build()
162 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
163     'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
164     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
165     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
166     'gst_init(NULL,NULL);' ]
167
168 pkgconfig = import('pkgconfig')
169 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
170 if get_option('default_library') == 'shared'
171   # If we don't build static plugins there is no need to generate pc files
172   plugins_pkgconfig_install_dir = disabler()
173 endif
174
175 subdir('gst')
176 if not get_option('tests').disabled()
177   subdir('tests')
178 endif
179 if not get_option('examples').disabled()
180   subdir('examples')
181 endif
182 subdir('pkgconfig')