1 project('gst-plugins-base', 'c', 'cpp',
3 meson_version : '>= 0.36.0',
4 default_options : [ 'warning_level=1',
5 'buildtype=debugoptimized' ])
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0]
10 gst_version_minor = version_arr[1]
11 gst_version_micro = version_arr[2]
12 if version_arr.length() == 4
13 gst_version_nano = version_arr[3]
18 glib_req = '>= 2.40.0'
20 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
24 # maintaining compatibility with the previous libtool versioning
25 # current = minor * 100 + micro
26 # FIXME: should be able to convert string to int somehow so we can just do maths
27 libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
29 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
31 cc = meson.get_compiler('c')
33 if cc.get_id() == 'msvc'
34 # Ignore several spurious warnings for things gstreamer does very commonly
35 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
36 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
37 # NOTE: Only add warnings here if you are sure they're spurious
38 add_project_arguments(
39 '/wd4018', # implicit signed/unsigned conversion
40 '/wd4146', # unary minus on unsigned (beware INT_MIN)
41 '/wd4244', # lossy type conversion (e.g. double -> int)
42 '/wd4305', # truncating type conversion (e.g. double -> float)
44 # Disable SAFESEH with MSVC for plugins and libs that use external deps that
45 # are built with MinGW
46 noseh_link_args = ['/SAFESEH:NO']
51 core_conf = configuration_data()
53 ['HAVE_DLFCN_H', 'dlfcn.h'],
54 ['HAVE_EMMINTRIN_H', 'emmintrin.h'],
55 ['HAVE_INTTYPES_H', 'inttypes.h'],
56 ['HAVE_MEMORY_H', 'memory.h'],
57 ['HAVE_PROCESS_H', 'process.h'],
58 ['HAVE_SMMINTRIN_H', 'smmintrin.h'],
59 ['HAVE_STDINT_H', 'stdint.h'],
60 ['HAVE_STDLIB_H', 'stdlib.h'],
61 ['HAVE_STRINGS_H', 'strings.h'],
62 ['HAVE_STRING_H', 'string.h'],
63 ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
64 ['HAVE_SYS_STAT_H', 'sys/stat.h'],
65 ['HAVE_SYS_TYPES_H', 'sys/types.h'],
66 ['HAVE_SYS_WAIT_H', 'sys/wait.h'],
67 ['HAVE_UNISTD_H', 'unistd.h'],
68 ['HAVE_WINSOCK2_H', 'winsock2.h'],
69 ['HAVE_XMMINTRIN_H', 'xmmintrin.h'],
71 foreach h : check_headers
72 if cc.has_header(h.get(1))
73 core_conf.set(h.get(0), 1)
78 ['HAVE_DCGETTEXT', 'dcgettext'],
79 ['HAVE_GMTIME_R', 'gmtime_r'],
80 ['HAVE_LRINTF', 'lrintf'],
81 ['HAVE_MMAP', 'mmap'],
84 foreach f : check_functions
85 if cc.has_function(f.get(1))
86 core_conf.set(f.get(0), 1)
90 core_conf.set('SIZEOF_CHAR', cc.sizeof('char'))
91 core_conf.set('SIZEOF_INT', cc.sizeof('int'))
92 core_conf.set('SIZEOF_LONG', cc.sizeof('long'))
93 core_conf.set('SIZEOF_SHORT', cc.sizeof('short'))
94 core_conf.set('SIZEOF_VOIDP', cc.sizeof('void*'))
96 core_conf.set('GETTEXT_PACKAGE', '"gst-plugins-base-1.0"')
97 core_conf.set('PACKAGE', '"gst-plugins-base"')
98 core_conf.set('VERSION', '"@0@"'.format(gst_version))
99 core_conf.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
100 core_conf.set('GST_PACKAGE_NAME', '"GStreamer Base Plug-ins"')
101 core_conf.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
102 core_conf.set('GST_API_VERSION', '"@0@"'.format(api_version))
103 core_conf.set('GST_INSTALL_PLUGINS_HELPER', '"/FIXME"')
104 core_conf.set('GST_DATADIR', '"/FIXME"')
105 core_conf.set('GST_LICENSE', '"LGPL"')
106 # FIXME: These should be configure options
107 core_conf.set('DEFAULT_VIDEOSINK', '"autovideosink"')
108 core_conf.set('DEFAULT_AUDIOSINK', '"autoaudiosink"')
110 # Set whether the audioresampling method should be detected at runtime
111 core_conf.set('AUDIORESAMPLE_FORMAT_' + get_option('audioresample_format').to_upper(), true)
113 gst_plugins_base_args = ['-DHAVE_CONFIG_H']
114 if get_option('default_library') == 'static'
115 gst_plugins_base_args += ['-DGST_STATIC_COMPILATION']
118 libm = cc.find_library('m', required : false)
119 # X11 checks are for sys/ and tests/
120 x11_dep = dependency('x11', required : false)
121 # GLib checks are for the entire project
122 giounix_dep = dependency('gio-unix-2.0', version : glib_req, required : false)
123 # Almost everything that uses glib also uses gobject
124 glib_deps = [dependency('glib-2.0', version : glib_req),
125 dependency('gobject-2.0', version : glib_req)]
126 gio_dep = dependency('gio-2.0', version : glib_req)
128 core_conf.set('HAVE_X', x11_dep.found())
129 core_conf.set('HAVE_GIO_UNIX_2_0', giounix_dep.found())
131 runcmd = run_command('pkg-config', '--variable=giomoduledir', 'gio-2.0')
132 if runcmd.returncode() == 0
133 core_conf.set('GIO_MODULE_DIR', '"@0@"'.format(runcmd.stdout().strip()))
135 runcmd = run_command('pkg-config', '--variable=libdir', 'gio-2.0')
136 if runcmd.returncode() == 0
137 core_conf.set('GIO_LIBDIR', '"@0@"'.format(runcmd.stdout().strip()))
139 runcmd = run_command('pkg-config', '--variable=prefix', 'gio-2.0')
140 if runcmd.returncode() == 0
141 core_conf.set('GIO_PREFIX', '"@0@"'.format(runcmd.stdout().strip()))
144 configinc = include_directories('.')
145 libsinc = include_directories('gst-libs')
147 # To use the subproject make subprojects directory
148 # and put gstreamer meson git there (symlinking is fine)
149 gst_dep = dependency('gstreamer-1.0', version : gst_req,
150 fallback : ['gstreamer', 'gst_dep'])
151 gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req,
152 fallback : ['gstreamer', 'gst_base_dep'])
153 gst_net_dep = dependency('gstreamer-net-1.0', version : gst_req,
154 fallback : ['gstreamer', 'gst_net_dep'])
155 if host_machine.system() != 'windows'
156 gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
157 fallback : ['gstreamer', 'gst_check_dep'])
159 gst_controller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
160 fallback : ['gstreamer', 'gst_controller_dep'])
162 vs_module_defs_dir = meson.current_source_dir() + '/win32/common/'
164 # Used by the *_mkenum.py helper scripts
165 glib_mkenums = find_program('glib-mkenums')
169 if get_option('use_orc') != 'no'
170 need_orc = get_option('use_orc') == 'yes'
171 # Used by various libraries/elements that use Orc code
172 orc_dep = dependency('orc-0.4', version : orc_req, required : need_orc)
173 orcc = find_program('orcc', required : need_orc)
174 if orc_dep.found() and orcc.found()
176 orcc_args = [orcc, '--include', 'glib.h']
177 core_conf.set('HAVE_ORC', 1)
179 message('Orc Compiler not found, will use backup C code')
180 core_conf.set('DISABLE_ORC', 1)
183 core_conf.set('DISABLE_ORC', 1)
186 # Used to build SSE* things in audio-resampler
189 sse41_args = '-msse4.1'
191 have_sse = cc.has_argument(sse_args)
192 have_sse2 = cc.has_argument(sse2_args)
193 have_sse41 = cc.has_argument(sse41_args)
195 # FIXME: Meson should have a way for portably adding -fPIC when needed for use
196 # with static libraries that are linked into shared libraries. Or, it should
197 # add it by default with an option to turn it off if needed.
199 if host_machine.system() == 'windows'
203 gir = find_program('g-ir-scanner', required : false)
204 gnome = import('gnome')
205 build_gir = gir.found() and not meson.is_cross_build() and not get_option('disable_introspection')
206 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
207 'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
208 'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
209 'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
210 'gst_init(NULL,NULL);' ]
220 # Use core_conf after all subdirs have set values
221 configure_file(input : 'config.h.meson',
223 configuration : core_conf)
225 python3 = find_program('python3')
226 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')