Bump pygobject dependency to 3.8
[platform/upstream/gstreamer.git] / meson.build
1 project('gst-python', 'c', 'cpp',
2   version : '1.15.0.1',
3   meson_version : '>= 0.36.0',
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]
11 gst_version_minor = version_arr[1]
12 api_version = '@0@.0'.format(gst_version_major)
13
14 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
15
16 gst_dep = dependency('gstreamer-1.0', version : gst_req,
17   fallback : ['gstreamer', 'gst_dep'])
18 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
19   fallback : ['gstreamer', 'gst_base_dep'])
20 gmodule_dep = dependency('gmodule-2.0')
21 pygobject_dep = dependency('pygobject-3.0', version : '>= 3.8')
22 python_dep = dependency('python3')
23
24 python3 = import('python3').find_python()
25 pythondetector = find_program('scripts/pythondetector')
26
27 cres = run_command(pythondetector, '--sosuffix')
28 if cres.returncode() != 0
29     error('Could not detect python sosuffix' + cres.stdout() + cres.stderr())
30 endif
31 py_so_suffix = cres.stdout().strip()
32
33 cres = run_command(pythondetector, '--abiflags')
34 if cres.returncode() != 0
35     error('Could not detect python abiflags' + cres.stdout() + cres.stderr())
36 endif
37 python_abi_flags = cres.stdout().strip()
38
39 cres = run_command(pythondetector, '--libloc')
40 if cres.returncode() != 0
41     error('Could not detect python library location' + cres.stdout() + cres.stderr())
42 endif
43 pylib_loc = cres.stdout().strip()
44
45 assert(pylib_loc != 'None', 'Python dynamic library path could not be determined')
46 pygi_override_dir = get_option('pygi-overrides-dir')
47 if pygi_override_dir == ''
48     cres = run_command(pythondetector, '--pygi-overridedir',
49             get_option('prefix'))
50     if cres.returncode() != 0
51         error('Could not detect PyGObject overrides location' + cres.stdout() + cres.stderr())
52     endif
53     pygi_override_dir = cres.stdout().strip()
54     if cres.stderr() != ''
55         message(cres.stderr())
56     endif
57 endif
58 message('pygobject overrides directory ' + pygi_override_dir)
59
60 pylib_suffix = 'so'
61 if host_machine.system() == 'windows'
62   pylib_suffix = 'dll'
63 elif host_machine.system() == 'darwin'
64   pylib_suffix = 'dylib'
65 endif
66 cdata = configuration_data()
67 cdata.set('PACKAGE', '"gst-python"')
68 cdata.set('VERSION', '"@0@"'.format(gst_version))
69 cdata.set('GST_PACKAGE_NAME', '"GStreamer Python"')
70 cdata.set('PACKAGE_NAME', '"GStreamer Python"')
71 cdata.set('GST_API_VERSION', '"@0@"'.format(api_version))
72 cdata.set('PLUGINDIR', '"@0@/gstreamer-1.0"'.format(get_option('libdir')))
73 cdata.set('PY_LIB_LOC', '"@0@"'.format(pylib_loc))
74 cdata.set('PY_ABI_FLAGS', '"@0@"'.format(python_abi_flags))
75 cdata.set('PY_LIB_SUFFIX', '"@0@"'.format(pylib_suffix))
76 cdata.set('PYTHON_VERSION', '"@0@"'.format(python_dep.version()))
77 configure_file(input : 'config.h.meson',
78   output : 'config.h',
79   configuration : cdata)
80 configinc = include_directories('.')
81
82 subdir('gi')
83 subdir('plugin')
84 subdir('testsuite')
85
86 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')