[libcamera-devel] [PATCH v2] meson: Define python3 and python3-yaml required dependencies
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Nov 21 02:37:28 CET 2019
Hi Ezequiel,
Thank you for the patch.
On Wed, Nov 20, 2019 at 08:45:49AM -0300, Ezequiel Garcia wrote:
> With this change, meson will complain specifically about missing
> python3 and missing python3-yaml. As specified by meson
> documentation: https://mesonbuild.com/Python-module.html,
> this change requires meson v0.51.
>
> Signed-off-by: Ezequiel Garcia <ezequiel at collabora.com>
> ---
> v2:
> * Make it optional and rework how it's done.
>
> meson.build | 15 +++++++++++++++
> src/libcamera/meson.build | 2 ++
> 2 files changed, 17 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index 72ad7c8b493b..b7cfbd072421 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -62,6 +62,11 @@ add_project_link_arguments(cpp_arguments, language : 'cpp')
>
> libcamera_includes = include_directories('include')
>
> +# Sub-directories fill py_modules with their
> +# dependencies.
I think this can fit on a single line. Apart from this, and a similar
comment below, the patch looked good to me, until I tried it:
WARNING: Project targetting '>= 0.40' but tried to use feature introduced in '0.46.0': Python Module
WARNING: Project targetting '>= 0.40' but tried to use feature introduced in '0.51.0': modules arg in python.find_installation
Program python3 (yaml) found: YES (/usr/bin/python3) modules: yaml
Build targets in project: 66
WARNING: Project specifies a minimum meson_version '>= 0.40' but uses features which were added in newer versions:
* 0.46.0: {'Python Module'}
* 0.51.0: {'modules arg in python.find_installation'}
Does the issue not occur for you ?
> +
> +py_modules = []
> +
> subdir('include')
> subdir('src')
> subdir('utils')
> @@ -85,3 +90,13 @@ pkg_mod.generate(libraries : libcamera,
> name : 'libcamera',
> filebase : 'camera',
> description : 'Complex Camera Support Library')
> +
> +# Check for python installation and modules.
> +#
> +# This feature requires v0.51, but since we don't
> +# want to force users to upgrade to meson v0.51+,
> +# let's do this optionally.
> +if meson.version().version_compare('>=0.51')
> + py_mod = import('python')
> + py_mod.find_installation('python3', modules: py_modules)
> +endif
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index afbca76968f9..02f5157b7975 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -61,6 +61,8 @@ if libudev.found()
> ])
> endif
>
> +py_modules += ['yaml']
> +
> gen_controls = files('gen-controls.py')
>
> control_ids_cpp = custom_target('control_ids_cpp',
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list