Merge remote-tracking branch 'upstream/master' into tizen
[platform/upstream/gstreamer.git] / meson.build
index 910009f..bed8c4e 100644 (file)
@@ -1,6 +1,6 @@
 project('gstreamer', 'c',
-  version : '1.17.90',
-  meson_version : '>= 0.48',
+  version : '1.19.2',
+  meson_version : '>= 0.54',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized' ])
 
@@ -36,18 +36,24 @@ cc = meson.get_compiler('c')
 
 cdata = configuration_data()
 
-# Ignore several spurious warnings for things gstreamer does very commonly
-# If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
-# If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
-# NOTE: Only add warnings here if you are sure they're spurious
 if cc.get_id() == 'msvc'
-  add_project_arguments(
+  msvc_args = [
+      # Ignore several spurious warnings for things gstreamer does very commonly
+      # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
+      # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
+      # NOTE: Only add warnings here if you are sure they're spurious
       '/wd4018', # implicit signed/unsigned conversion
       '/wd4146', # unary minus on unsigned (beware INT_MIN)
       '/wd4244', # lossy type conversion (e.g. double -> int)
       '/wd4305', # truncating type conversion (e.g. double -> float)
       cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8
-      language : 'c')
+
+      # Enable some warnings on MSVC to match GCC/Clang behaviour
+      '/w14062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled
+      '/w14101', # 'identifier' : unreferenced local variable
+      '/w14189', # 'identifier' : local variable is initialized but not referenced
+  ]
+  add_project_arguments(msvc_args, language: 'c')
 elif cc.has_link_argument('-Wl,-Bsymbolic-functions')
   # FIXME: Add an option for this if people ask for it
   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
@@ -172,7 +178,7 @@ host_defines = [
   [ 's390', 'HAVE_CPU_S390' ],
 ]
 foreach h : host_defines
-  if h.get(0) == host_machine.cpu()
+  if h.get(0) == host_machine.cpu_family()
     cdata.set(h.get(1), 1)
   endif
 endforeach
@@ -200,7 +206,6 @@ check_headers = [
   'sys/wait.h',
   'ucontext.h',
   'unistd.h',
-  'valgrind/valgrind.h',
   'sys/resource.h',
   'sys/uio.h',
 ]
@@ -231,6 +236,7 @@ check_functions = [
   'pselect',
   'getpagesize',
   'clock_gettime',
+  'clock_nanosleep',
   'strnlen',
   # These are needed by libcheck
   'getline',
@@ -367,15 +373,32 @@ if host_system == 'windows'
   platform_deps = [cc.find_library('ws2_32')]
 endif
 
+building_for_uwp = false
+if host_system == 'windows'
+  # Check whether we're building for UWP apps
+  code = '''
+  #include <windows.h>
+  #if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
+  #error "Not building for UWP"
+  #endif'''
+  if cc.compiles(code, name : 'building for UWP')
+    building_for_uwp = true
+  endif
+endif
+
 backtrace_deps = []
 unwind_dep = dependency('libunwind', required : get_option('libunwind'))
 dw_dep = dependency('libdw', required: get_option('libdw'))
-dbghelp_dep = dependency('DbgHelp', required : get_option('dbghelp'))
-backtrace_deps = [unwind_dep, dw_dep, dbghelp_dep]
+dbghelp_option = get_option('dbghelp')
+if dbghelp_option.enabled() and building_for_uwp
+  error('DbgHelp is not supported for UWP')
+endif
+have_dbghelp = cc.has_header('dbghelp.h', required: dbghelp_option) and cc.has_header('tlhelp32.h', required: dbghelp_option)
+backtrace_deps = [unwind_dep, dw_dep]
 backtrace_source_info = false
 backtrace_minimal = false
 # MSVC debug stack trace support
-if host_system == 'windows' and dbghelp_dep.found()
+if host_system == 'windows' and have_dbghelp and not building_for_uwp
   cdata.set('HAVE_DBGHELP', 1)
   backtrace_source_info = true
 # DWARF stack trace support with libunwind and elf-utils
@@ -462,7 +485,7 @@ libsinc = include_directories('libs')
 privinc = include_directories('gst')
 
 # Find dependencies
-glib_dep = dependency('glib-2.0', version : '>=2.44.0',
+glib_dep = dependency('glib-2.0', version : '>=2.56.0',
   fallback: ['glib', 'libglib_dep'])
 gobject_dep = dependency('gobject-2.0',
   fallback: ['glib', 'libgobject_dep'])
@@ -547,6 +570,20 @@ if get_option('default_library') == 'shared'
   # If we don't build static plugins there is no need to generate pc files
   plugins_pkgconfig_install_dir = disabler()
 endif
+pkgconfig_variables = ['exec_prefix=${prefix}',
+    'toolsdir=${exec_prefix}/bin',
+    'pluginsdir=${libdir}/gstreamer-1.0',
+    'datarootdir=${prefix}/share',
+    'datadir=${datarootdir}',
+    'girdir=${datadir}/gir-1.0',
+    'typelibdir=${libdir}/girepository-1.0',
+    'libexecdir=${prefix}/libexec',
+    'pluginscannerdir=${libexecdir}/gstreamer-1.0']
+pkgconfig_uninstalled_variables = ['exec_prefix=${prefix}',
+       'gstreamerdir=${prefix}/subprojects/gstreamer',
+    'bashhelpersdir=${gstreamerdir}/data/bash-completion/helpers',
+    'helpersdir=${gstreamerdir}/libs/gst/helpers']
+pkgconfig_subdirs = ['gstreamer-1.0']
 
 subdir('gst')
 subdir('libs')
@@ -554,7 +591,6 @@ subdir('plugins')
 if not get_option('tools').disabled()
   subdir('tools')
 endif
-subdir('pkgconfig')
 subdir('tests')
 subdir('data')
 subdir('docs')
@@ -565,6 +601,8 @@ if find_program('xgettext', required : get_option('nls')).found()
   subdir('po')
 endif
 
+subdir('scripts')
+
 # Set release date
 if gst_version_nano == 0
   extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py')