[libcamera-devel] [PATCH v2] android: Split HAL to it's own shared library

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Jun 14 21:23:33 CEST 2021


Hi Kieran,

Thank you for the patch.

s/it's/its/ in the subject line.

On Mon, Jun 14, 2021 at 01:05:06PM +0100, Kieran Bingham wrote:
> The libcamera Android HAL implementation should not be an integral part
> of libcamera, but a support library that utilises the libcamera public
> API.
> 
> Move the implementation to it's own distinct library.

And here too :-)

> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  src/android/meson.build   | 12 +++++++++++-
>  src/libcamera/meson.build | 11 -----------
>  src/meson.build           |  7 +++----
>  3 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/src/android/meson.build b/src/android/meson.build
> index 3893e5b5b832..6edaa1185905 100644
> --- a/src/android/meson.build
> +++ b/src/android/meson.build
> @@ -4,6 +4,7 @@ android_deps = [
>      dependency('libexif', required : get_option('android')),
>      dependency('libjpeg', required : get_option('android')),
>      dependency('yaml-0.1', required : get_option('android')),
> +    libcamera_dep,
>  ]
>  
>  android_enabled = true
> @@ -37,7 +38,7 @@ endif
>  android_deps += [libyuv_dep]
>  
>  if get_option('android_platform') == 'cros'
> -   libcamera_cpp_args += [ '-DOS_CHROMEOS']
> +    libcamera_cpp_args += ['-DOS_CHROMEOS']
>  endif
>  
>  subdir('cros')
> @@ -68,3 +69,12 @@ android_camera_metadata = static_library('camera_metadata',
>                                           android_camera_metadata_sources,
>                                           c_args : '-Wno-shadow',
>                                           include_directories : android_includes)
> +
> +libcamera_hal = shared_library('libcamera-hal',
> +                               android_hal_sources,
> +                               name_prefix : '',
> +                               link_with : android_camera_metadata,
> +                               install : true,
> +                               cpp_args : libcamera_cpp_args,
> +                               include_directories : android_includes,
> +                               dependencies : android_deps)
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index 7e19a1774a59..54512652272c 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -130,16 +130,6 @@ libcamera_deps = [
>      dependency('threads'),
>  ]
>  
> -libcamera_link_with = []
> -
> -if android_enabled
> -    libcamera_sources += android_hal_sources
> -    includes += android_includes
> -    libcamera_link_with += android_camera_metadata
> -
> -    libcamera_deps += android_deps
> -endif
> -
>  # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.
>  # The build_rpath is stripped at install time by meson, so we determine at
>  # runtime if the library is running from an installed location by checking
> @@ -148,7 +138,6 @@ endif
>  libcamera = shared_library('camera',
>                             libcamera_sources,
>                             install : true,
> -                           link_with : libcamera_link_with,
>                             cpp_args : libcamera_cpp_args,
>                             include_directories : includes,
>                             objects : libcamera_objects,
> diff --git a/src/meson.build b/src/meson.build
> index edb7ce14f7a6..a6e4eb21b796 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -23,11 +23,10 @@ endif
>  libcamera_cpp_args = []
>  libcamera_objects = []
>  
> -# The 'android' subdir must be processed first, and the build targets
> -# are included directly into the libcamera library when this is enabled.
> -subdir('android')
> -
> +# libcamera must be built first as a dependency to the other components.
>  subdir('libcamera')
> +
> +subdir('android')
>  subdir('ipa')
>  
>  subdir('lc-compliance')

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list