Commit 42af2d66 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan Committed by Tim-Philipp Müller

Add support for Meson as alternative/parallel build system

https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
parent 7e2b68fe
......@@ -85,3 +85,7 @@ Build
/sys/bluez/bluez.c
/sys/bluez/bluez.h
# Meson
/build
/subprojects
This diff is collapsed.
ass_dep = dependency('libass', version : '>= 0.10.2', required : false)
if ass_dep.found()
gstassrender = library('gstassrender',
'gstassrender.c',
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, ass_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
bz2_sources = [
'gstbz2.c',
'gstbz2dec.c',
'gstbz2enc.c',
]
bz2_dep = cc.find_library('bz2', required : false)
if bz2_dep.found() and cc.has_header_symbol('bzlib.h', 'BZ2_bzlibVersion')
gstbz2 = library('gstbz2',
bz2_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, bz2_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
chromaprint_dep = dependency('libchromaprint', required : false)
if chromaprint_dep.found()
gstchromaprint = library('gstchromaprint',
'gstchromaprint.c',
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, chromaprint_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
curl_sources = [
'gstcurlbasesink.c',
'gstcurl.c',
'gstcurlfilesink.c',
'gstcurlftpsink.c',
'gstcurlhttpsink.c',
'gstcurlsftpsink.c',
'gstcurlsmtpsink.c',
'gstcurlsshsink.c',
'gstcurltlssink.c',
]
curl_dep = dependency('libcurl', version : '>= 7.35.0', required : false)
if curl_dep.found()
gstcurl = library('gstcurl',
curl_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstbase_dep, curl_dep] + winsock2,
install : true,
install_dir : plugins_install_dir,
)
endif
dash_sources = [
'gstdashdemux.c',
'gstisoff.c',
'gstmpdparser.c',
'gstplugin.c',
]
xml2_dep = dependency('libxml-2.0', version : '>= 2.8', required : false)
if xml2_dep.found()
gstsouphttpsrc = library('gstdashdemux',
dash_sources,
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
link_args : noseh_link_args,
include_directories : [configinc, libsinc],
dependencies : [gstadaptivedemux_dep, gsturidownloader_dep, gsttag_dep,
gstnet_dep, gstbase_dep, gio_dep, xml2_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
directfb_dep = dependency('directfb', version : '>= 0.9.24', required : false)
if directfb_dep.found()
gstdirectfb = library('gstdirectfb',
'dfbvideosink.c',
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, directfb_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
dtls_sources = [
'gstdtlsagent.c',
'gstdtlscertificate.c',
'gstdtlsconnection.c',
'gstdtlsdec.c',
'gstdtlsenc.c',
'gstdtlssrtpbin.c',
'gstdtlssrtpdec.c',
'gstdtlssrtpdemux.c',
'gstdtlssrtpenc.c',
'plugin.c',
]
libcrypto_dep = dependency('libcrypto', required : false)
if openssl_dep.found() and libcrypto_dep.found()
gstdtls = library('gstdtls',
dtls_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gst_dep, libcrypto_dep, openssl_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
dca_dep = dependency('libdca', required : false)
if not dca_dep.found() and cc.has_header_symbol('dca.h', 'dca_init')
dca_dep = cc.find_library('dca', required : false)
endif
if dca_dep.found()
gstdtsdec = library('gstdtsdec',
'gstdtsdec.c',
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc, libsinc],
dependencies : [gstaudio_dep, orc_dep, dca_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
faac_dep = cc.find_library('faac', required : false)
if faac_dep.found() and cc.has_header_symbol('faac.h', 'faacEncOpen')
gstfaac = library('gstfaac',
'gstfaac.c',
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, gstpbutils_dep, gsttag_dep, faac_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
faad_args = [ ]
have_faad = cc.has_header_symbol('neaacdec.h', 'NeAACDecOpen')
have_faad_2_7 = have_faad and cc.has_header_symbol('neaacdec.h', 'LATM')
if have_faad and not have_faad_2_7
message('Found faad2, but too old (< v2.7.0)')
endif
faad_dep = cc.find_library('faad', required : false)
if faad_dep.found() and have_faad_2_7
gstfaad = library('gstfaad',
'gstfaad.c',
c_args : gst_plugins_bad_args + [ '-DFAAD2_MINOR_VERSION=7', '-DFAAD_IS_NEAAC' ],
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, gstpbutils_dep, gsttag_dep, faad_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
flite_sources = [
'gstflite.c',
'gstflitetestsrc.c',
]
flite_libs = [
'flite',
'flite_cmu_us_kal',
'flite_usenglish',
'flite_cmulex'
]
flite_deps = [ ]
foreach flite_lib : flite_libs
flite_lib_dep = cc.find_library(flite_lib, required : false)
if flite_lib_dep.found()
flite_deps += [flite_lib_dep]
endif
endforeach
if flite_deps.length() == flite_libs.length() and cc.has_header_symbol('flite/flite.h', 'flite_init')
gstflite = library('gstflite',
flite_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep] + flite_deps,
install : true,
install_dir : plugins_install_dir,
)
endif
fluidsynth_dep = dependency('fluidsynth', version : '>= 1.0', required : false)
if fluidsynth_dep.found()
gstfluidsynth = library('gstfluidsynth',
'gstfluiddec.c',
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, gst_dep, fluidsynth_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
hls_sources = [
'gsthlsdemux.c',
'gsthlsdemux-util.c',
'gsthlsplugin.c',
'gsthlssink.c',
'gstm3u8playlist.c',
'm3u8.c',
]
hls_cargs = ['-DGST_USE_UNSTABLE_API']
# FIXME: Add an option for selecting the library, and fail if it's not found
hls_crypto_dep = dependency('nettle', required : false)
if hls_crypto_dep.found()
hls_cargs += ['-DHAVE_NETTLE']
else
hls_crypto_dep = cc.find_library('gcrypt', required : false)
if hls_crypto_dep.found()
hls_cargs += ['-DHAVE_LIBGCRYPT']
else
hls_crypto_dep = openssl_dep
if hls_crypto_dep.found()
hls_cargs += ['-DHAVE_OPENSSL']
endif
endif
endif
gsthls = library('gsthls',
hls_sources,
c_args : gst_plugins_bad_args + hls_cargs,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstpbutils_dep, gsttag_dep, gstvideo_dep,
gstadaptivedemux_dep, gsturidownloader_dep,
hls_crypto_dep],
install : true,
install_dir : plugins_install_dir,
)
kate_sources = [
'gstkate.c',
'gstkatedec.c',
'gstkateenc.c',
'gstkateparse.c',
'gstkatetag.c',
'gstkateutil.c',
'gstkatespu.c',
]
kate_dep = dependency('kate', version : '>=0.1.7', required : false)
# Not used
#tiger_dep = dependency('tiger', version : '>=0.3.2', required : false)
if kate_dep.found()
gstkate = library('gstkate',
kate_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gsttag_dep, kate_dep],
install : true,
install_dir : plugins_install_dir)
endif
de265_sources = [
'gstlibde265.c',
'libde265-dec.c',
]
de265_dep = dependency('libde265', version : '>= 0.9', required : false)
if de265_dep.found()
gstde265 = library('gstde265',
de265_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, de265_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
mms_dep = dependency('libmms', version : '>= 0.4', required : false)
if mms_dep.found()
gstmms = library('gstmms',
'gstmms.c',
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstbase_dep, mms_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
#subdir('apexsink')
subdir('assrender')
#subdir('bs2b')
subdir('bz2')
subdir('chromaprint')
subdir('curl')
#subdir('daala')
subdir('dash')
#subdir('dc1394')
subdir('directfb')
subdir('dtls')
subdir('dts')
subdir('faac')
subdir('faad')
subdir('flite')
subdir('fluidsynth')
#subdir('gl')
#subdir('gme')
#subdir('gsm')
#subdir('gtk')
subdir('hls')
subdir('kate')
#subdir('ladspa')
subdir('libde265')
subdir('libmms')
#subdir('libvisual')
#subdir('lv2')
#subdir('mimic')
#subdir('modplug')
#subdir('mpeg2enc')
#subdir('mplex')
#subdir('musepack')
#subdir('nas')
#subdir('neon')
#subdir('ofa')
#subdir('openal')
#subdir('opencv')
#subdir('openexr')
subdir('openh264')
subdir('openjpeg')
#subdir('openni2')
subdir('opus')
#subdir('qt')
subdir('resindvd')
subdir('rsvg')
subdir('rtmp')
subdir('sbc')
subdir('schroedinger')
#subdir('sdl')
subdir('smoothstreaming')
#subdir('sndfile')
#subdir('sndio')
if cc.get_id() != 'msvc'
# soundtouch doesn't do exporting of symbols for DLLs and I'm not sure how to
# do that for C++ classes. -- Nirbheek
subdir('soundtouch')
# libspandsp has a bunch of portability issues in the headers
# If someone really wants to use this, it shouldn't be hard to port
subdir('spandsp')
endif
#subdir('spc')
subdir('srtp')
#subdir('teletextdec')
#subdir('timidity')
subdir('voaacenc')
#subdir('voamrwbenc')
#subdir('wayland')
#subdir('webrtcdsp')
subdir('webp')
subdir('x265')
#subdir('xvid')
subdir('zbar')
mpg123_sources = [
'gstmpg123audiodec.c',
]
mpg123_dep = dependency('libmpg123', version : '>= 1.3', required : false)
if mpg123_dep.found()
gstmpg123 = library('gstmpg123',
mpg123_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, mpg123_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
openh264_sources = [
'gstopenh264dec.cpp',
'gstopenh264enc.cpp',
'gstopenh264plugin.c',
]
openh264_dep = dependency('openh264', version : '>= 1.3.0', required : false)
# FIXME: check if C++ compiler is available via new add_languages() semantics in meson git (~v30)
if openh264_dep.found()
gstopenh264 = library('gstopenh264',
openh264_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, openh264_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
openjpeg_sources = [
'gstopenjpeg.c',
'gstopenjpegdec.c',
'gstopenjpegenc.c',
]
openjpeg_cargs = []
# Check for 2.1, then 2.0
openjpeg_dep = dependency('libopenjp2', version : '>=2.1', required : false)
if openjpeg_dep.found()
openjpeg_cargs += ['-DHAVE_OPENJPEG_2_1']
else
openjpeg_dep = dependency('libopenjp2', required : false)
# Fallback to 1.5
if not openjpeg_dep.found()
openjpeg_dep = dependency('libopenjpeg1', required : false)
openjpeg_cargs += ['-DHAVE_OPENJPEG_1']
endif
endif
if openjpeg_dep.found()
gstopenjpeg = library('gstopenjpeg',
openjpeg_sources,
c_args : gst_plugins_bad_args + openjpeg_cargs,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gst_dep, gstvideo_dep, openjpeg_dep,
gstcodecparsers_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
opus_sources = [
'gstopus.c',
'gstopusheader.c',
'gstopusparse.c',
]
opus_dep = dependency('opus', version : '>= 0.9.4', required : false)
if opus_dep.found()
gstopus = library('gstopusparse',
opus_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstrtp_dep, gstpbutils_dep, gstaudio_dep,
gsttag_dep, opus_dep, libm],
install : true,
install_dir : plugins_install_dir,
)
endif
resindvd_sources = [
'gstmpegdemux.c',
'gstmpegdesc.c',
'gstpesfilter.c',
'plugin.c',
'resindvdbin.c',
'resindvdsrc.c',
'rsndec.c',
'rsninputselector.c',
'rsnparsetter.c',
]
dvdnav_dep = dependency('dvdnav', version : '>= 4.1.2', required : false)
dvdread_dep = dependency('dvdread', version : '>= 4.1.2', required : false)
if dvdnav_dep.found() and dvdread_dep.found()
gstresindvd = library('gstresindvd',
resindvd_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc, libsinc],
dependencies : [gstvideo_dep, gstpbutils_dep, gsttag_dep,
dvdnav_dep, dvdread_dep, gmodule_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
rsvg_sources = [
'gstrsvg.c',
'gstrsvgdec.c',
'gstrsvgoverlay.c',
]
rsvg_dep = dependency('librsvg-2.0', version : '>= 2.36.2', required : false)
if rsvg_dep.found()
gstrsvg = library('gstrsvg',
rsvg_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, rsvg_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
rtmp_sources = [
'gstrtmp.c',
'gstrtmpsink.c',
'gstrtmpsrc.c',
]
rtmp_dep = dependency('librtmp', required : false)
if rtmp_dep.found()
gstrtmp = library('gstrtmp',
rtmp_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstbase_dep, rtmp_dep] + winsock2,
install : true,
install_dir : plugins_install_dir,
)
endif
sbc_sources = [
'sbc-plugin.c',
'gstsbcdec.c',
'gstsbcenc.c',
]
sbc_dep = dependency('sbc', version : '>= 1.0', required : false)
if sbc_dep.found()
gstsbc = library('gstsbc',
sbc_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstaudio_dep, sbc_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
schro_sources = [
'gstschro.c',
'gstschrodec.c',
'gstschroenc.c',
'gstschroutils.c',
]
schro_dep = dependency('schroedinger-1.0', version : '>= 1.0.10', required : false)
if schro_dep.found()
gstschro = library('gstschro',
schro_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, schro_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
smoothstreaming_sources = [
'gstmssdemux.c',
'gstmssmanifest.c',
'gstsmoothstreaming-plugin.c',
]
xml28_dep = dependency('libxml-2.0', version : '>= 2.8', required : false)
if xml28_dep.found()
gstmss = library('gstsmoothstreaming',
smoothstreaming_sources,
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
link_args : noseh_link_args,
include_directories : [configinc, libsinc],
dependencies : [gst_dep, gstadaptivedemux_dep, gstcodecparsers_dep,
gsturidownloader_dep, xml28_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
soundtouch_sources = [
'plugin.c',
'gstpitch.cc',
'gstbpmdetect.cc',
]
soundtouch_cargs = ['-DHAVE_SOUNDTOUCH']
soundtouch_dep = dependency('soundtouch', required : false)
if soundtouch_dep.found()
soundtouch_cargs += ['-DHAVE_SOUNDTOUCH_1_4']
else
soundtouch_dep = dependency('soundtouch-1.4', required : false)
if soundtouch_dep.found()
soundtouch_cargs += ['-DHAVE_SOUNDTOUCH_1_4']
else
soundtouch_dep = dependency('soundtouch-1.0', required : false)
# NOTE: I removed the checks for libSoundTouch.pc and so on.
# Add them back once we know which distros use them.
endif
endif
if soundtouch_dep.found()
gstsoundtouch = library('gstsoundtouch',
soundtouch_sources,
c_args : gst_plugins_bad_args + soundtouch_cargs,
cpp_args : gst_plugins_bad_args + soundtouch_cargs,
include_directories : [configinc],
dependencies : [gstaudio_dep, soundtouch_dep],
install : true,
install_dir : plugins_install_dir)
endif
spandsp_sources = [
'gstdtmfdetect.c',
'gstdtmfdetect.h',
'gstspandsp.c',
'gstspanplc.c',
'gstspanplc.h',
'gsttonegeneratesrc.c',
'gsttonegeneratesrc.h',
]
spandsp_dep = dependency('spandsp', version : '>= 0.0.6', required : false)
if spandsp_dep.found()
gstspandsp = library('gstspandsp',
spandsp_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstvideo_dep, spandsp_dep],
install : true,
install_dir : plugins_install_dir,
)
endif
srtp_sources = [
'gstsrtp.c',
'gstsrtpdec.c',
'gstsrtpenc.c',
]
srtp_dep = dependency('libsrtp', required : false)
if not srtp_dep.found() and cc.has_header_symbol('srtp/srtp.h', 'srtp_init')
srtp_dep = cc.find_library('srtp', required : false)
endif
if srtp_dep.found()
mkenums = find_program('srtp_mkenum.py')
gstsrtp_h = custom_target('gstsrtpenum_h',
output : 'gstsrtp-enumtypes.h',
input : 'gstsrtp.h',
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
gstsrtp_c = custom_target('gstsrtpenum_c',
output : 'gstsrtp-enumtypes.c',
input : 'gstsrtp.h',
depends : [gstsrtp_h],
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
gstsrtp = library('gstsrtp',
srtp_sources, gstsrtp_c, gstsrtp_h,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
dependencies : [gstrtp_dep, gstvideo_dep, srtp_dep],
install : true,