meson.build 4.19 KB
Newer Older
1
project('gst-rtsp-server', 'c',
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
2
  version : '1.14.0',
3 4 5 6 7
  meson_version : '>= 0.33.0',
  default_options : ['warning_level=1', 'buildtype=debugoptimized'])

gst_version = meson.project_version()
version_arr = gst_version.split('.')
8 9 10 11 12
gst_version_major = version_arr[0].to_int()
gst_version_minor = version_arr[1].to_int()
gst_version_micro = version_arr[2].to_int()
 if version_arr.length() == 4
  gst_version_nano = version_arr[3].to_int()
13 14 15 16 17 18 19 20 21 22 23
else
  gst_version_nano = 0
endif

glib_req = '>= 2.40.0'
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

api_version = '1.0'
soversion = 0
# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro
24
libversion = '@0@.@1@.0'.format(soversion, gst_version_minor * 100 + gst_version_micro)
25 26 27

plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))

28 29 30 31 32 33 34
cc = meson.get_compiler('c')

# Symbol visibility
if cc.has_argument('-fvisibility=hidden')
  add_project_arguments('-fvisibility=hidden', language: 'c')
endif

35 36 37 38 39
# Disable strict aliasing
if cc.has_argument('-fno-strict-aliasing')
  add_project_arguments('-fno-strict-aliasing', language: 'c')
endif

40
cdata = configuration_data()
41 42 43 44 45 46 47 48 49 50
cdata.set_quoted('GETTEXT_PACKAGE', 'gst-rtsp-server-1.0')
cdata.set_quoted('PACKAGE', 'gst-rtsp-server')
cdata.set_quoted('VERSION', gst_version)
cdata.set_quoted('PACKAGE_VERSION', gst_version)
cdata.set_quoted('GST_API_VERSION', api_version)
cdata.set_quoted('GST_LICENSE', 'LGPL')

# FIXME: ENABLE_NLS (currently also missing from autotools build)
# cdata.set('ENABLE_NLS', true)
# cdata.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
51

52 53 54 55
# GStreamer package name and origin url
gst_package_name = get_option('with-package-name')
if gst_package_name == ''
  if gst_version_nano == 0
56
    gst_package_name = 'GStreamer RTSP Server Library source release'
57
  elif gst_version_nano == 1
58
    gst_package_name = 'GStreamer RTSP Server Library git'
59
  else
60
    gst_package_name = 'GStreamer RTSP Server Library prerelease'
61 62
  endif
endif
63
cdata.set_quoted('GST_PACKAGE_NAME', gst_package_name)
64 65
cdata.set_quoted('GST_PACKAGE_ORIGIN', get_option('with-package-origin'))

66
configure_file(output : 'config.h', configuration : cdata)
67 68 69

rtspserver_args = ['-DHAVE_CONFIG_H']

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
warning_flags = [
  '-Wmissing-declarations',
  '-Wmissing-prototypes',
  '-Wredundant-decls',
  '-Wundef',
  '-Wwrite-strings',
  '-Wformat',
  '-Wformat-nonliteral',
  '-Wformat-security',
  '-Wold-style-definition',
  '-Waggregate-return',
  '-Wnested-externs',
  '-Winit-self',
  '-Wmissing-include-dirs',
  '-Waddress',
  '-Wno-multichar',
  '-Wdeclaration-after-statement',
  '-Wvla',
  '-Wpointer-arith',
]

foreach extra_arg : warning_flags
  if cc.has_argument (extra_arg)
    add_project_arguments([extra_arg], language: 'c')
  endif
endforeach

97 98
rtspserver_incs = include_directories('gst/rtsp-server', '.')

99 100
glib_dep = dependency('glib-2.0', version : glib_req,
  fallback: ['glib', 'libglib_dep'])
101 102 103 104 105 106 107 108 109 110 111 112
gst_dep = dependency('gstreamer-1.0', version : gst_req,
  fallback : ['gstreamer', 'gst_dep'])
gstrtsp_dep = dependency('gstreamer-rtsp-1.0', version : gst_req,
  fallback : ['gst-plugins-base', 'rtsp_dep'])
gstrtp_dep = dependency('gstreamer-rtp-1.0', version : gst_req,
  fallback : ['gst-plugins-base', 'rtp_dep'])
gstsdp_dep = dependency('gstreamer-sdp-1.0', version : gst_req,
  fallback : ['gst-plugins-base', 'sdp_dep'])
gstapp_dep = dependency('gstreamer-app-1.0', version : gst_req,
  fallback : ['gst-plugins-base', 'app_dep'])
gstnet_dep = dependency('gstreamer-net-1.0', version : gst_req,
  fallback : ['gstreamer', 'gst_net_dep'])
113

Thibault Saunier's avatar
Thibault Saunier committed
114 115 116 117 118 119 120 121 122
gir = find_program('g-ir-scanner', required : false)
gnome = import('gnome')
build_gir = gir.found() and not meson.is_cross_build() and not get_option('disable_introspection')
gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
    'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
    'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
    'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
    'gst_init(NULL,NULL);' ]

123
subdir('gst')
124 125 126 127 128 129
if get_option('tests')
  subdir('tests')
endif
if get_option('examples')
  subdir('examples')
endif
130
subdir('pkgconfig')