meson: Don't unnecessarily fallback to libyuv wrap
diff mbox series

Message ID 20241125005228.24737-1-laurent.pinchart@ideasonboard.com
State New
Headers show
Series
  • meson: Don't unnecessarily fallback to libyuv wrap
Related show

Commit Message

Laurent Pinchart Nov. 25, 2024, 12:52 a.m. UTC
Before commit eeaa7de21b8c ("libcamera: pipeline: Add test pattern for
VirtualPipelineHandler") the libyuv dependency was only needed for the
Android adaptation layer. As libyuv isn't packaged by most distribution,
meson fell back to using a meson wrap if the Android adaptation layer
was enabled and the library wasn't found.

With commit eeaa7de21b8c, libyuv is also used by the virtual pipeline
handler, and the meson wrap fallback handling got centralized and became
unconditional, so the wrap is downloaded even if the components
depending on libyuv are all disabled. This causes unnecessary downloads
at setup time, which can be problematic on build systems without an
internet connection.

Fix this by making the wrap fallback conditional on the components that
use libyuv.

Fixes: eeaa7de21b8c ("libcamera: pipeline: Add test pattern for VirtualPipelineHandler")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/android/meson.build | 3 +--
 src/meson.build         | 8 +++++---
 2 files changed, 6 insertions(+), 5 deletions(-)


base-commit: 9a5f91c78abc8985baff89563992be3644f861b0

Comments

Cheng-Hao Yang Nov. 25, 2024, 6:08 a.m. UTC | #1
Hi Laurent,

Thanks for the fix.

On Mon, Nov 25, 2024 at 8:52 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Before commit eeaa7de21b8c ("libcamera: pipeline: Add test pattern for
> VirtualPipelineHandler") the libyuv dependency was only needed for the
> Android adaptation layer. As libyuv isn't packaged by most distribution,
> meson fell back to using a meson wrap if the Android adaptation layer
> was enabled and the library wasn't found.
>
> With commit eeaa7de21b8c, libyuv is also used by the virtual pipeline
> handler, and the meson wrap fallback handling got centralized and became
> unconditional, so the wrap is downloaded even if the components
> depending on libyuv are all disabled. This causes unnecessary downloads
> at setup time, which can be problematic on build systems without an
> internet connection.
>
> Fix this by making the wrap fallback conditional on the components that
> use libyuv.
>
> Fixes: eeaa7de21b8c ("libcamera: pipeline: Add test pattern for VirtualPipelineHandler")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/android/meson.build | 3 +--
>  src/meson.build         | 8 +++++---
>  2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/android/meson.build b/src/android/meson.build
> index 6341ee8b0bfb..7b226a4b5d35 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')),
>      libcamera_private,
> +    libyuv_dep,
>  ]
>
>  android_enabled = true
> @@ -15,8 +16,6 @@ foreach dep : android_deps
>      endif
>  endforeach
>
> -android_deps += [libyuv_dep]
> -
>  android_hal_sources = files([
>      'camera3_hal.cpp',
>      'camera_capabilities.cpp',
> diff --git a/src/meson.build b/src/meson.build
> index 91bea7753a2e..76198e9535db 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -27,11 +27,13 @@ else
>      ipa_sign_module = false
>  endif
>
> +# libyuv, used by the Android adaptation layer and the virtual pipeline handler.
> +# Fallback to a subproject if libyuv isn't found, as it's typically not provided
> +# by distributions.
>  libyuv_dep = dependency('libyuv', required : false)
>
> -# Fallback to a subproject if libyuv isn't found, as it's typically not
> -# provided by distributions.
> -if not libyuv_dep.found()
> +if (pipelines.contains('virtual') or get_option('android').allowed()) and \
> +   not libyuv_dep.found()
>      cmake = import('cmake')
>
>      libyuv_vars = cmake.subproject_options()
>
> base-commit: 9a5f91c78abc8985baff89563992be3644f861b0

Reviewed-by: Harvey Yang <chenghaoyang@chromium.org>

BR,
Harvey

> --
> Regards,
>
> Laurent Pinchart
>
Kieran Bingham Nov. 25, 2024, 9:06 a.m. UTC | #2
Quoting Laurent Pinchart (2024-11-25 00:52:28)
> Before commit eeaa7de21b8c ("libcamera: pipeline: Add test pattern for
> VirtualPipelineHandler") the libyuv dependency was only needed for the
> Android adaptation layer. As libyuv isn't packaged by most distribution,
> meson fell back to using a meson wrap if the Android adaptation layer
> was enabled and the library wasn't found.
> 
> With commit eeaa7de21b8c, libyuv is also used by the virtual pipeline
> handler, and the meson wrap fallback handling got centralized and became
> unconditional, so the wrap is downloaded even if the components
> depending on libyuv are all disabled. This causes unnecessary downloads
> at setup time, which can be problematic on build systems without an
> internet connection.
> 
> Fix this by making the wrap fallback conditional on the components that
> use libyuv.
> 
> Fixes: eeaa7de21b8c ("libcamera: pipeline: Add test pattern for VirtualPipelineHandler")
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  src/android/meson.build | 3 +--
>  src/meson.build         | 8 +++++---
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/src/android/meson.build b/src/android/meson.build
> index 6341ee8b0bfb..7b226a4b5d35 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')),
>      libcamera_private,
> +    libyuv_dep,
>  ]
>  
>  android_enabled = true
> @@ -15,8 +16,6 @@ foreach dep : android_deps
>      endif
>  endforeach
>  
> -android_deps += [libyuv_dep]
> -
>  android_hal_sources = files([
>      'camera3_hal.cpp',
>      'camera_capabilities.cpp',
> diff --git a/src/meson.build b/src/meson.build
> index 91bea7753a2e..76198e9535db 100644
> --- a/src/meson.build
> +++ b/src/meson.build
> @@ -27,11 +27,13 @@ else
>      ipa_sign_module = false
>  endif
>  
> +# libyuv, used by the Android adaptation layer and the virtual pipeline handler.
> +# Fallback to a subproject if libyuv isn't found, as it's typically not provided
> +# by distributions.
>  libyuv_dep = dependency('libyuv', required : false)
>  
> -# Fallback to a subproject if libyuv isn't found, as it's typically not
> -# provided by distributions.
> -if not libyuv_dep.found()
> +if (pipelines.contains('virtual') or get_option('android').allowed()) and \
> +   not libyuv_dep.found()
>      cmake = import('cmake')
>  
>      libyuv_vars = cmake.subproject_options()
> 
> base-commit: 9a5f91c78abc8985baff89563992be3644f861b0
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/android/meson.build b/src/android/meson.build
index 6341ee8b0bfb..7b226a4b5d35 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')),
     libcamera_private,
+    libyuv_dep,
 ]
 
 android_enabled = true
@@ -15,8 +16,6 @@  foreach dep : android_deps
     endif
 endforeach
 
-android_deps += [libyuv_dep]
-
 android_hal_sources = files([
     'camera3_hal.cpp',
     'camera_capabilities.cpp',
diff --git a/src/meson.build b/src/meson.build
index 91bea7753a2e..76198e9535db 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -27,11 +27,13 @@  else
     ipa_sign_module = false
 endif
 
+# libyuv, used by the Android adaptation layer and the virtual pipeline handler.
+# Fallback to a subproject if libyuv isn't found, as it's typically not provided
+# by distributions.
 libyuv_dep = dependency('libyuv', required : false)
 
-# Fallback to a subproject if libyuv isn't found, as it's typically not
-# provided by distributions.
-if not libyuv_dep.found()
+if (pipelines.contains('virtual') or get_option('android').allowed()) and \
+   not libyuv_dep.found()
     cmake = import('cmake')
 
     libyuv_vars = cmake.subproject_options()