From patchwork Fri Feb 7 13:50:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 22774 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2ACB6C32F5 for ; Fri, 7 Feb 2025 13:50:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 30A8468608; Fri, 7 Feb 2025 14:50:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FvGHsPYv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B84D685AF for ; Fri, 7 Feb 2025 14:50:39 +0100 (CET) Received: from Monstersaurus.tail69b4.ts.net (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D8E60F0C; Fri, 7 Feb 2025 14:49:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1738936165; bh=0L03oTaR/DiiCs4KwLpjXFYVepY7ewwMHZB3VwbVUAM=; h=From:To:Cc:Subject:Date:From; b=FvGHsPYvgiOuK35+ujW68pa9P9WPohq2PUcHZaNA6n/TZsFHmUuAiRe9GFnHrr0o+ 6C2QRY5TYz7l0vupJ3iOnXFMVCyThO/YrrO0nNO5l5AsmE6AcJYjyAnPLOFTyrdoaD F7TYxxRQBa1tlCoVY2RGGWnoGmTSVzuxAztOZL/Y= From: Kieran Bingham To: libcamera devel Cc: =?utf-8?q?Dylan_A=C3=AFssi?= , Kieran Bingham Subject: [PATCH v2] libcamera: meson: Fix libyuv detection Date: Fri, 7 Feb 2025 13:50:35 +0000 Message-ID: <20250207135035.1104174-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Dylan Aïssi We already fall back to a subproject to support the libyuv package when it can not be discovered through the usual dependency() mechanism. Unfortunately libyuv may be packaged without any corresponding pkg-config support as can be seen at [0], so further extend the dependency search by using an explicit cxx.find_library() call. [0] https://packages.debian.org/bookworm/amd64/libyuv-dev/filelist Signed-off-by: Dylan Aïssi Tested-by: Kieran Bingham Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- v2: Handle review/suggestion from Barnabás: - include yuv.h explicitly as a header check - support the force_fallback_for option. Signed-off-by: Kieran Bingham src/meson.build | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/meson.build b/src/meson.build index 76198e9535db..b664448699aa 100644 --- a/src/meson.build +++ b/src/meson.build @@ -27,10 +27,20 @@ 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) +# 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. Where libyuv is provided by a distribution, it +# may not always supply a pkg-config implementation, requiring cxx.find_library() +# to search for it. +if not get_option('force_fallback_for').contains('libyuv') + libyuv_dep = dependency('libyuv', required : false) + if not libyuv_dep.found() + libyuv_dep = cxx.find_library('yuv', has_headers : 'libyuv.h', + required : false) + endif +else + libyuv_dep = dependency('', required : false) +endif if (pipelines.contains('virtual') or get_option('android').allowed()) and \ not libyuv_dep.found()