xref: /aosp_15_r20/external/libkmsxx/py/pykms/meson.build (revision f0687c8a10b3e371dbe09214db6664e37c283cca)
1py3_dep = dependency('python3', required : get_option('pykms'))
2
3if py3_dep.found() == false
4    subdir_done()
5endif
6
7if get_option('system-pybind11').enabled()
8    pybind11_dep = dependency('pybind11')
9elif get_option('system-pybind11').disabled()
10    pybind11_proj = subproject('pybind11')
11    pybind11_dep = pybind11_proj.get_variable('pybind11_dep')
12else
13    pybind11_dep = dependency('pybind11', fallback : ['pybind11', 'pybind11_dep'])
14endif
15
16pykms_sources = files([
17    'pykmsbase.cpp',
18    'pykms.cpp',
19])
20
21if get_option('utils')
22    pykms_sources += files([
23        'pykmsutil.cpp',
24        'pyvid.cpp',
25    ])
26endif
27
28if libdrmomap_dep.found()
29    pykms_sources += files([
30        'pykmsomap.cpp',
31    ])
32endif
33
34pykms_deps = [
35    libkmsxx_dep,
36    py3_dep,
37    pybind11_dep,
38]
39
40if get_option('utils')
41    pykms_deps += [ libkmsxxutil_dep ]
42endif
43
44pykms_args = [ '-fvisibility=hidden' ]
45
46destdir = get_option('libdir') / 'python' + py3_dep.version() / 'site-packages/pykms'
47
48pykms = shared_module('pykms',
49                      pykms_sources,
50                      install : true,
51                      install_dir : destdir,
52                      name_prefix : '',
53                      dependencies : pykms_deps,
54                      cpp_args : pykms_args)
55
56# Copy __init__.py to build dir so that we can run without installing
57configure_file(input: '__init__.py', output: '__init__.py', copy: true,
58               install : true, install_dir : destdir)
59