meson: Use feature option for tests option
[platform/upstream/gstreamer.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
17 glib_req = '>= 2.40.0'
18 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
19
20 api_version = '1.0'
21 soversion = 0
22 # maintaining compatibility with the previous libtool versioning
23 # current = minor * 100 + micro
24 curversion = gst_version_minor * 100 + gst_version_micro
25 libversion = '@0@.@1@.0'.format(soversion, curversion)
26 osxversion = curversion + 1
27
28 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
29
30 cc = meson.get_compiler('c')
31
32 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
33   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
34 endif
35
36 # Symbol visibility
37 if cc.has_argument('-fvisibility=hidden')
38   add_project_arguments('-fvisibility=hidden', language: 'c')
39 endif
40
41 # Disable strict aliasing
42 if cc.has_argument('-fno-strict-aliasing')
43   add_project_arguments('-fno-strict-aliasing', language: 'c')
44 endif
45
46 cdata = configuration_data()
47 cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0')
48 cdata.set_quoted('PACKAGE', 'gst-rtsp-server')
49 cdata.set_quoted('VERSION', gst_version)
50 cdata.set_quoted('PACKAGE_VERSION', gst_version)
51 cdata.set_quoted('GST_API_VERSION', api_version)
52 cdata.set_quoted('GST_LICENSE', 'LGPL')
53
54 # FIXME: ENABLE_NLS (currently also missing from autotools build)
55 # cdata.set('ENABLE_NLS', true)
56 # cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
57
58 # GStreamer package name and origin url
59 gst_package_name = get_option('package-name')
60 if gst_package_name == ''
61   if gst_version_nano == 0
62     gst_package_name = 'GStreamer RTSP Server Library source release'
63   elif gst_version_nano == 1
64     gst_package_name = 'GStreamer RTSP Server Library git'
65   else
66     gst_package_name = 'GStreamer RTSP Server Library prerelease'
67   endif
68 endif
69 cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
70 cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin'))
71
72 configure_file(output : 'config.h', configuration : cdata)
73
74 rtspserver_args = ['-DHAVE_CONFIG_H']
75
76 warning_flags = [
77   '-Wmissing-declarations',
78   '-Wmissing-prototypes',
79   '-Wredundant-decls',
80   '-Wundef',
81   '-Wwrite-strings',
82   '-Wformat',
83   '-Wformat-nonliteral',
84   '-Wformat-security',
85   '-Wold-style-definition',
86   '-Waggregate-return',
87   '-Wnested-externs',
88   '-Winit-self',
89   '-Wmissing-include-dirs',
90   '-Waddress',
91   '-Wno-multichar',
92   '-Wdeclaration-after-statement',
93   '-Wvla',
94   '-Wpointer-arith',
95 ]
96
97 foreach extra_arg : warning_flags
98   if cc.has_argument (extra_arg)
99     add_project_arguments([extra_arg], language: 'c')
100   endif
101 endforeach
102
103 rtspserver_incs = include_directories('gst/rtsp-server', '.')
104
105 glib_dep = dependency('glib-2.0', version : glib_req,
106   fallback: ['glib', 'libglib_dep'])
107 gst_dep = dependency('gstreamer-1.0', version : gst_req,
108   fallback : ['gstreamer', 'gst_dep'])
109 gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
110   fallback : ['gst-plugins-base', 'rtsp_dep'])
111 gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
112   fallback : ['gst-plugins-base', 'rtp_dep'])
113 gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
114   fallback : ['gst-plugins-base', 'sdp_dep'])
115 gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
116   fallback : ['gst-plugins-base', 'app_dep'])
117 gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
118   fallback : ['gstreamer', 'gst_net_dep'])
119 if host_machine.system() != 'windows'
120   gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
121     required : get_option('tests'),
122     fallback : ['gstreamer', 'gst_check_dep'])
123 endif
124
125 gir = find_program('g-ir-scanner', required : get_option('introspection'))
126 gnome = import('gnome')
127 build_gir = gir.found() and not meson.is_cross_build()
128 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
129     'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
130     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
131     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
132     'gst_init(NULL,NULL);' ]
133
134 pkgconfig = import('pkgconfig')
135 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
136 if get_option('default_library') == 'shared'
137   # If we don't build static plugins there is no need to generate pc files
138   plugins_pkgconfig_install_dir = disabler()
139 endif
140
141 subdir('gst')
142 if not get_option('tests').disabled()
143   subdir('tests')
144 endif
145 if not get_option('examples').disabled()
146   subdir('examples')
147 endif
148 subdir('pkgconfig')