meson: update version
[platform/upstream/gst-plugins-base.git] / meson.build
1 project('gst-plugins-base', 'c', 'cpp',
2   version : '1.11.0.1',
3   meson_version : '>= 0.35.0',
4   default_options : [ 'warning_level=1',
5                       'buildtype=debugoptimized' ])
6
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]
14 else
15   gst_version_nano = 0
16 endif
17
18 glib_req = '>= 2.40.0'
19 orc_req = '>= 0.4.24'
20 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
21
22 api_version = '1.0'
23 soversion = 0
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())
28
29 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
30
31 cc = meson.get_compiler('c')
32
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_global_arguments('/wd4018', '/wd4244', '/wd4996', language : 'c')
39   # Disable SAFESEH with MSVC for plugins and libs that use external deps that
40   # are built with MinGW
41   noseh_link_args = ['/SAFESEH:NO']
42 else
43   noseh_link_args = []
44 endif
45
46 core_conf = configuration_data()
47 check_headers = [
48   ['HAVE_DLFCN_H', 'dlfcn.h'],
49   ['HAVE_EMMINTRIN_H', 'emmintrin.h'],
50   ['HAVE_INTTYPES_H', 'inttypes.h'],
51   ['HAVE_MEMORY_H', 'memory.h'],
52   ['HAVE_PROCESS_H', 'process.h'],
53   ['HAVE_SMMINTRIN_H', 'smmintrin.h'],
54   ['HAVE_STDINT_H', 'stdint.h'],
55   ['HAVE_STDLIB_H', 'stdlib.h'],
56   ['HAVE_STRINGS_H', 'strings.h'],
57   ['HAVE_STRING_H', 'string.h'],
58   ['HAVE_SYS_SOCKET_H', 'sys/socket.h'],
59   ['HAVE_SYS_STAT_H', 'sys/stat.h'],
60   ['HAVE_SYS_TYPES_H', 'sys/types.h'],
61   ['HAVE_SYS_WAIT_H', 'sys/wait.h'],
62   ['HAVE_UNISTD_H', 'unistd.h'],
63   ['HAVE_WINSOCK2_H', 'winsock2.h'],
64   ['HAVE_XMMINTRIN_H', 'xmmintrin.h'],
65 ]
66 foreach h : check_headers
67   if cc.has_header(h.get(1))
68     core_conf.set(h.get(0), 1)
69   endif
70 endforeach
71
72 check_functions = [
73   ['HAVE_DCGETTEXT', 'dcgettext'],
74   ['HAVE_GMTIME_R', 'gmtime_r'],
75   ['HAVE_LRINTF', 'lrintf'],
76   ['HAVE_MMAP', 'mmap'],
77 ]
78
79 foreach f : check_functions
80   if cc.has_function(f.get(1))
81     core_conf.set(f.get(0), 1)
82   endif
83 endforeach
84
85 core_conf.set('SIZEOF_CHAR', cc.sizeof('char'))
86 core_conf.set('SIZEOF_INT', cc.sizeof('int'))
87 core_conf.set('SIZEOF_LONG', cc.sizeof('long'))
88 core_conf.set('SIZEOF_SHORT', cc.sizeof('short'))
89 core_conf.set('SIZEOF_VOIDP', cc.sizeof('void*'))
90
91 core_conf.set('GETTEXT_PACKAGE', '"gst-plugins-base-1.0"')
92 core_conf.set('PACKAGE', '"gst-plugins-base"')
93 core_conf.set('VERSION', '"@0@"'.format(gst_version))
94 core_conf.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
95 core_conf.set('GST_PACKAGE_NAME', '"GStreamer Base Plug-ins"')
96 core_conf.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
97 core_conf.set('GST_API_VERSION', '"@0@"'.format(api_version))
98 core_conf.set('GST_INSTALL_PLUGINS_HELPER', '"/FIXME"')
99 core_conf.set('GST_DATADIR', '"/FIXME"')
100 core_conf.set('GST_LICENSE', '"LGPL"')
101 # FIXME: These should be configure options
102 core_conf.set('DEFAULT_VIDEOSINK', '"autovideosink"')
103 core_conf.set('DEFAULT_AUDIOSINK', '"autoaudiosink"')
104
105 # Set whether the audioresampling method should be detected at runtime
106 core_conf.set('AUDIORESAMPLE_FORMAT_' + get_option('audioresample_format').to_upper(), true)
107
108 gst_plugins_base_args = ['-DHAVE_CONFIG_H']
109 if get_option('default_library') == 'static'
110   gst_plugins_base_args += ['-DGST_STATIC_COMPILATION']
111 endif
112
113 libm = cc.find_library('m', required : false)
114 # X11 checks are for sys/ and tests/
115 x11_dep = dependency('x11', required : false)
116 # GLib checks are for the entire project
117 giounix_dep = dependency('gio-unix-2.0', version : glib_req, required : false)
118 # Almost everything that uses glib also uses gobject
119 glib_deps = [dependency('glib-2.0', version : glib_req),
120              dependency('gobject-2.0', version : glib_req)]
121 gio_dep = dependency('gio-2.0', version : glib_req)
122
123 core_conf.set('HAVE_X', x11_dep.found())
124 core_conf.set('HAVE_GIO_UNIX_2_0', giounix_dep.found())
125
126 runcmd = run_command('pkg-config', '--variable=giomoduledir', 'gio-2.0')
127 if runcmd.returncode() == 0
128   core_conf.set('GIO_MODULE_DIR', '"@0@"'.format(runcmd.stdout().strip()))
129 endif
130 runcmd = run_command('pkg-config', '--variable=libdir', 'gio-2.0')
131 if runcmd.returncode() == 0
132   core_conf.set('GIO_LIBDIR', '"@0@"'.format(runcmd.stdout().strip()))
133 endif
134 runcmd = run_command('pkg-config', '--variable=prefix', 'gio-2.0')
135 if runcmd.returncode() == 0
136   core_conf.set('GIO_PREFIX', '"@0@"'.format(runcmd.stdout().strip()))
137 endif
138
139 configinc = include_directories('.')
140 libsinc = include_directories('gst-libs')
141
142 # To use the subproject make subprojects directory
143 # and put gstreamer meson git there (symlinking is fine)
144 gst_dep = dependency('gstreamer-1.0', version : gst_req,
145   fallback : ['gstreamer', 'gst_dep'])
146 gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req,
147   fallback : ['gstreamer', 'gst_base_dep'])
148 gst_net_dep = dependency('gstreamer-net-1.0', version : gst_req,
149   fallback : ['gstreamer', 'gst_net_dep'])
150 if host_machine.system() != 'windows'
151   gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
152     fallback : ['gstreamer', 'gst_check_dep'])
153 endif
154 gst_controller_dep = dependency('gstreamer-controller-1.0', version : gst_req,
155   fallback : ['gstreamer', 'gst_controller_dep'])
156
157 vs_module_defs_dir = meson.current_source_dir() + '/win32/common/'
158
159 # Used by the *_mkenum.py helper scripts
160 glib_mkenums = find_program('glib-mkenums')
161
162 have_orcc = false
163 orcc_args = []
164 if get_option('use_orc') != 'no'
165   need_orc = get_option('use_orc') == 'yes'
166   # Used by various libraries/elements that use Orc code
167   orc_dep = dependency('orc-0.4', version : orc_req, required : need_orc)
168   orcc = find_program('orcc', required : need_orc)
169   if orc_dep.found() and orcc.found()
170     have_orcc = true
171     orcc_args = [orcc, '--include', 'glib.h']
172     core_conf.set('HAVE_ORC', 1)
173   else
174     message('Orc Compiler not found, will use backup C code')
175     core_conf.set('DISABLE_ORC', 1)
176   endif
177 else
178   core_conf.set('DISABLE_ORC', 1)
179 endif
180
181 # Used to build SSE* things in audio-resampler
182 sse_args = '-msse'
183 sse2_args = '-msse2'
184 sse41_args = '-msse4.1'
185
186 have_sse = cc.has_argument(sse_args)
187 have_sse2 = cc.has_argument(sse2_args)
188 have_sse41 = cc.has_argument(sse41_args)
189
190 # FIXME: Meson should have a way for portably adding -fPIC when needed for use
191 # with static libraries that are linked into shared libraries. Or, it should
192 # add it by default with an option to turn it off if needed.
193 pic_args = ['-fPIC']
194 if host_machine.system() == 'windows'
195   pic_args = []
196 endif
197
198 subdir('gst-libs')
199 subdir('gst')
200 subdir('ext')
201 subdir('sys')
202 subdir('tools')
203 subdir('tests')
204 subdir('pkgconfig')
205
206 # Use core_conf after all subdirs have set values
207 configure_file(input : 'config.h.meson',
208   output : 'config.h',
209   configuration : core_conf)
210
211 python3 = find_program('python3')
212 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')