From patchwork Thu Feb 6 16:15:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 22747 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 76F6AC32EF for ; Thu, 6 Feb 2025 16:16:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 366EE685EB; Thu, 6 Feb 2025 17:16:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="ZhBVUX1k"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4519F685E2 for ; Thu, 6 Feb 2025 17:16:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738858582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WxFIVXVVfrtAQxxqseK7jA86EHcOiqdq3NDpDLZc52I=; b=ZhBVUX1keSvOPWGRgEsEP2RQgiS2edSYxSfNKVwdmw00q3h+PjjCOm9isTPZA+k/ZnLsHP EOfFp85uypj/cCYxbLIqCyLrSuxIAWQkuLgyY9FWMtROCVblKnxF089y0LfA+PCEn1OyqE WDjMIxHplgF973bxVyx8CsJafI1glIQ= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-59-9lzlyDb8MRS7APu50aogsA-1; Thu, 06 Feb 2025 11:16:20 -0500 X-MC-Unique: 9lzlyDb8MRS7APu50aogsA-1 X-Mimecast-MFC-AGG-ID: 9lzlyDb8MRS7APu50aogsA Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5AE7D1955D63; Thu, 6 Feb 2025 16:16:19 +0000 (UTC) Received: from mzamazal-thinkpadp1gen3.tpbc.com (unknown [10.43.17.31]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2C116180035E; Thu, 6 Feb 2025 16:16:16 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham , Naushir Patuck , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Laurent Pinchart Subject: [PATCH v7 01/15] yaml: Move yaml_parser.cpp to base Date: Thu, 6 Feb 2025 17:15:52 +0100 Message-ID: <20250206161607.50738-2-mzamazal@redhat.com> In-Reply-To: <20250206161607.50738-1-mzamazal@redhat.com> References: <20250206161607.50738-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jE-gSh6Vd_s_5H42m8n24g8e5aCgibGPbfUlnWE4mkM_1738858579 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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" Global configuration, which uses the YAML parser, will be in base. Thus YAML parser must be moved to base too. Indentation is changed in one place of the moved file to make the autoformatter and checkstyle.py happy. Signed-off-by: Milan Zamazal --- src/libcamera/base/meson.build | 14 ++++++++++++++ src/libcamera/{ => base}/yaml_parser.cpp | 13 ++++++------- src/libcamera/meson.build | 14 -------------- 3 files changed, 20 insertions(+), 21 deletions(-) rename src/libcamera/{ => base}/yaml_parser.cpp (98%) diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build index a742dfdf..94843eb9 100644 --- a/src/libcamera/base/meson.build +++ b/src/libcamera/base/meson.build @@ -24,10 +24,12 @@ libcamera_base_internal_sources = files([ 'thread.cpp', 'timer.cpp', 'utils.cpp', + 'yaml_parser.cpp', ]) libdw = dependency('libdw', required : false) libunwind = dependency('libunwind', required : false) +libyaml = dependency('yaml-0.1', required : false) if cc.has_header_symbol('execinfo.h', 'backtrace') config_h.set('HAVE_BACKTRACE', 1) @@ -41,11 +43,23 @@ if libunwind.found() config_h.set('HAVE_UNWIND', 1) endif +# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP. +if not libyaml.found() + cmake = import('cmake') + + libyaml_vars = cmake.subproject_options() + libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) + libyaml_vars.append_compile_args('c', '-Wno-unused-value') + libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars) + libyaml = libyaml_wrap.dependency('yaml') +endif + libcamera_base_deps = [ libatomic, libdw, libthreads, libunwind, + libyaml, ] # Internal components must use the libcamera_base_private dependency to enable diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/base/yaml_parser.cpp similarity index 98% rename from src/libcamera/yaml_parser.cpp rename to src/libcamera/base/yaml_parser.cpp index a5e42461..13111faa 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/base/yaml_parser.cpp @@ -149,13 +149,12 @@ YamlObject::Getter::get(const YamlObject &obj) const template struct YamlObject::Getter || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v>> -{ + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v>> { std::optional get(const YamlObject &obj) const { if (obj.type_ != Type::Value) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 57fde8a8..c2d112a9 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -53,7 +53,6 @@ libcamera_internal_sources = files([ 'v4l2_pixelformat.cpp', 'v4l2_subdevice.cpp', 'v4l2_videodevice.cpp', - 'yaml_parser.cpp', ]) includes = [ @@ -81,7 +80,6 @@ if not cc.has_function('dlopen') libdl = cc.find_library('dl') endif libudev = dependency('libudev', required : get_option('udev')) -libyaml = dependency('yaml-0.1', required : false) # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first. libcrypto = dependency('gnutls', required : false) @@ -117,17 +115,6 @@ if libudev.found() ]) endif -# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP. -if not libyaml.found() - cmake = import('cmake') - - libyaml_vars = cmake.subproject_options() - libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) - libyaml_vars.append_compile_args('c', '-Wno-unused-value') - libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars) - libyaml = libyaml_wrap.dependency('yaml') -endif - control_sources = [] controls_mode_files = { @@ -187,7 +174,6 @@ libcamera_deps += [ libdl, liblttng, libudev, - libyaml, ] # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.