New validate plugin: validateflow
[platform/upstream/gstreamer.git] / meson.build
1 project('gst-devtools', 'c',
2   version : '1.15.1',
3   meson_version : '>= 0.47',
4   default_options : [ 'warning_level=1',
5                       'c_std=gnu99',
6                       'buildtype=debugoptimized' ])
7
8 gst_version = meson.project_version()
9 version_arr = gst_version.split('.')
10 gst_version_major = version_arr[0].to_int()
11 gst_version_minor = version_arr[1].to_int()
12 gst_version_micro = version_arr[2].to_int()
13 if gst_version_minor.is_even()
14   TESTSUITE_VERSION = '@0@.@1@'.format(gst_version_major, gst_version_minor)
15 else
16   TESTSUITE_VERSION = 'master'
17 endif
18
19 apiversion = '1.0'
20 soversion = 0
21 # maintaining compatibility with the previous libtool versioning
22 # current = minor * 100 + micro
23 curversion = gst_version_minor * 100 + gst_version_micro
24 libversion = '@0@.@1@.0'.format(soversion, curversion)
25 osxversion = curversion + 1
26
27 prefix = get_option('prefix')
28
29 glib_req = '>= 2.40.0'
30 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
31
32 cc = meson.get_compiler('c')
33
34 if cc.get_id() == 'msvc'
35   # Ignore several spurious warnings for things gstreamer does very commonly
36   # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
37   # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
38   # NOTE: Only add warnings here if you are sure they're spurious
39   add_project_arguments(
40       '/wd4018', # implicit signed/unsigned conversion
41       '/wd4146', # unary minus on unsigned (beware INT_MIN)
42       '/wd4244', # lossy type conversion (e.g. double -> int)
43       '/wd4305', # truncating type conversion (e.g. double -> float)
44       language : 'c')
45   # Disable SAFESEH with MSVC for plugins and libs that use external deps that
46   # are built with MinGW
47   noseh_link_args = ['/SAFESEH:NO']
48 else
49   noseh_link_args = []
50 endif
51
52 # Symbol visibility
53 if cc.has_argument('-fvisibility=hidden')
54   add_project_arguments('-fvisibility=hidden', language: 'c')
55 endif
56
57 # Disable strict aliasing
58 if cc.has_argument('-fno-strict-aliasing')
59   add_project_arguments('-fno-strict-aliasing', language: 'c')
60 endif
61
62 gst_dep = dependency('gstreamer-' + apiversion, version : gst_req,
63     fallback : ['gstreamer', 'gst_dep'])
64 gst_pbutils_dep = dependency('gstreamer-pbutils-' + apiversion, version : gst_req,
65     fallback : ['gst-plugins-base', 'pbutils_dep'])
66 gst_video_dep = dependency('gstreamer-video-' + apiversion, version : gst_req,
67     fallback : ['gst-plugins-base', 'video_dep'])
68 if host_machine.system() != 'windows'
69   gst_check_dep = dependency('gstreamer-check-1.0', version : gst_req,
70     required : get_option('tests'),
71     fallback : ['gstreamer', 'gst_check_dep'])
72 endif
73
74 glib_dep = dependency('glib-2.0', version : '>=2.32.0',
75   fallback: ['glib', 'libglib_dep'])
76 gmodule_dep = dependency('gmodule-2.0',
77   fallback: ['glib', 'libgmodule_dep'])
78 gio_dep = dependency('gio-2.0',
79   fallback: ['glib', 'libgio_dep'])
80
81 gtk_dep = dependency('gtk+-3.0', required: false)
82 mathlib = cc.find_library('m', required : false)
83 dl = cc.find_library('dl', required : false)
84 json_dep = dependency('json-glib-1.0',
85     fallback : ['json-glib', 'json_glib_dep'])
86
87 gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API']
88
89 gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
90     'g_setenv("GST_REGISTRY_1.0", "/no/way/this/exists.reg", TRUE);' + \
91     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
92     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
93     'gst_init(NULL,NULL);' ]
94 gir = find_program('g-ir-scanner', required : get_option('introspection'))
95 build_gir = gir.found() and not meson.is_cross_build()
96 gnome = import('gnome')
97
98 if gst_dep.type_name() == 'internal'
99   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
100 else
101   # We can't check that in the case of subprojects as we won't
102   # be able to build against an internal dependency (which is not built yet)
103   gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
104 endif
105
106 if gst_debug_disabled and cc.has_argument('-Wno-unused')
107   add_project_arguments('-Wno-unused', language: 'c')
108 endif
109
110 warning_flags = [
111   '-Wmissing-declarations',
112   '-Wmissing-prototypes',
113   '-Wredundant-decls',
114   '-Wundef',
115   '-Wwrite-strings',
116   '-Wformat',
117   '-Wformat-nonliteral',
118   '-Wformat-security',
119   '-Winit-self',
120   '-Wmissing-include-dirs',
121   '-Waddress',
122   '-Wno-multichar',
123   '-Wdeclaration-after-statement',
124   '-Wvla',
125   '-Wpointer-arith',
126 ]
127
128 foreach extra_arg : warning_flags
129   if cc.has_argument (extra_arg)
130     add_project_arguments([extra_arg], language: 'c')
131   endif
132 endforeach
133
134 pkgconfig = import('pkgconfig')
135 plugins_install_dir = join_paths(get_option('libdir'), 'gstreamer-1.0')
136 plugins_pkgconfig_install_dir = join_paths(plugins_install_dir, 'pkgconfig')
137 if get_option('default_library') == 'shared'
138   # If we don't build static plugins there is no need to generate pc files
139   plugins_pkgconfig_install_dir = disabler()
140 endif
141
142 i18n = import('i18n')
143 python3 = import('python3')
144 if get_option('validate')
145   subdir('validate')
146 endif
147
148 if get_option('debug_viewer')
149   subdir('debug-viewer')
150 endif
151
152 run_command(python3.find_python(), '-c', 'import shutil; shutil.copy("hooks/multi-pre-commit.hook", ".git/hooks/pre-commit")')