summaryrefslogtreecommitdiff
path: root/src/py/libcamera/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'src/py/libcamera/meson.build')
-rw-r--r--src/py/libcamera/meson.build52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build
index eb884538..4807ca7d 100644
--- a/src/py/libcamera/meson.build
+++ b/src/py/libcamera/meson.build
@@ -7,42 +7,56 @@ if not py3_dep.found()
subdir_done()
endif
-pycamera_enabled = true
+pybind11_dep = dependency('pybind11', required : get_option('pycamera'))
+
+if not pybind11_dep.found()
+ pycamera_enabled = false
+ subdir_done()
+endif
-pybind11_proj = subproject('pybind11')
-pybind11_dep = pybind11_proj.get_variable('pybind11_dep')
+pycamera_enabled = true
pycamera_sources = files([
+ 'py_camera_manager.cpp',
+ 'py_color_space.cpp',
'py_enums.cpp',
'py_geometry.cpp',
+ 'py_helpers.cpp',
'py_main.cpp',
+ 'py_transform.cpp',
])
# Generate controls
-gen_py_controls_input_files = files([
- '../../libcamera/control_ids.yaml',
- 'py_controls_generated.cpp.in',
-])
+gen_py_controls_input_files = []
+gen_py_controls_template = files('py_controls_generated.cpp.in')
gen_py_controls = files('gen-py-controls.py')
+foreach file : controls_files
+ gen_py_controls_input_files += files('../../libcamera/' + file)
+endforeach
+
pycamera_sources += custom_target('py_gen_controls',
input : gen_py_controls_input_files,
output : ['py_controls_generated.cpp'],
- command : [gen_py_controls, '--mode', 'controls', '-o', '@OUTPUT@', '@INPUT@'])
+ command : [gen_py_controls, '--mode', 'controls', '-o', '@OUTPUT@',
+ '-t', gen_py_controls_template, '@INPUT@'])
# Generate properties
-gen_py_property_enums_input_files = files([
- '../../libcamera/property_ids.yaml',
- 'py_properties_generated.cpp.in',
-])
+gen_py_property_enums_input_files = []
+gen_py_properties_template = files('py_properties_generated.cpp.in')
+
+foreach file : properties_files
+ gen_py_property_enums_input_files += files('../../libcamera/' + file)
+endforeach
pycamera_sources += custom_target('py_gen_properties',
input : gen_py_property_enums_input_files,
output : ['py_properties_generated.cpp'],
- command : [gen_py_controls, '--mode', 'properties', '-o', '@OUTPUT@', '@INPUT@'])
+ command : [gen_py_controls, '--mode', 'properties', '-o', '@OUTPUT@',
+ '-t', gen_py_properties_template, '@INPUT@'])
# Generate formats
@@ -59,7 +73,7 @@ pycamera_sources += custom_target('py_gen_formats',
command : [gen_py_formats, '-o', '@OUTPUT@', '@INPUT@'])
pycamera_deps = [
- libcamera_public,
+ libcamera_private,
py3_dep,
pybind11_dep,
]
@@ -68,7 +82,6 @@ pycamera_args = [
'-fvisibility=hidden',
'-Wno-shadow',
'-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT',
- '-DLIBCAMERA_BASE_PRIVATE',
]
destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'
@@ -77,6 +90,7 @@ pycamera = shared_module('_libcamera',
pycamera_sources,
install : true,
install_dir : destdir,
+ install_tag : 'python-runtime',
name_prefix : '',
dependencies : pycamera_deps,
cpp_args : pycamera_args)
@@ -86,13 +100,15 @@ pycamera = shared_module('_libcamera',
run_command('ln', '-fsrT', files('__init__.py'),
meson.current_build_dir() / '__init__.py',
- check: true)
+ check : true)
run_command('ln', '-fsrT', meson.current_source_dir() / 'utils',
meson.current_build_dir() / 'utils',
- check: true)
+ check : true)
-install_data(['__init__.py'], install_dir : destdir)
+install_data(['__init__.py'],
+ install_dir : destdir,
+ install_tag : 'python-runtime')
# \todo Generate stubs when building. See https://peps.python.org/pep-0484/#stub-files
# Note: Depends on pybind11-stubgen. To generate pylibcamera stubs: