From patchwork Mon Nov 8 06:01:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 14468 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 43FDEBDB1C for ; Mon, 8 Nov 2021 06:01:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 768426034F; Mon, 8 Nov 2021 07:01:47 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KfK7r0F9"; dkim-atps=neutral Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 80D5260234 for ; Mon, 8 Nov 2021 07:01:45 +0100 (CET) Received: by mail-pf1-x42a.google.com with SMTP id c126so6514216pfb.0 for ; Sun, 07 Nov 2021 22:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w6ecWqyvcQ2TYthdt2PKKg7w7Wi1QhkV/Uoj8/5+oM=; b=KfK7r0F9v2NpOvyCi9Jt51p+TRg9AJdvvD+iP2LfJrfoNoEKeQUZf0wOSkPFmrGYuf p99JxvRUpsLZ/tNEsdSaaJY0DnpMG43/J/dCvexZwVKqaA/8VPM4XA/EBML9fFI5iS8e FrS9ITwI4ER6ts8ZfI/MBJIAUsyUutghKL/Wk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w6ecWqyvcQ2TYthdt2PKKg7w7Wi1QhkV/Uoj8/5+oM=; b=dpgRF5BW/+V8xR4BrVIyr+pE2g6osIcIOB9PJtbif7Unmr/DeH5X2zU7LJCi6pWyvM 7uiGaGbrlK+1HHT8+NQs57mdvSvkhAItCuFFQ6KtSs0SuY1eDzU1DrLfGVgMoxTUMhPb JsWtdz0HHgSh6dk3iS75rmOgxjplu/AkBvNPwpZtxpJ2Q6dvFu+f8BAJq8purUk3MZyi tS9G6d/9nlwMvpjM33BWAfPht/ZSFdJZzM4TylvFDyip6sJf4RgZYD2242DNW+zIqnHL /MHprypheptDU9eZw+Nk5pvnfNduXgLZOvTf6nmIb0erUX5OB9jRYwCus3CAIVC1Gxts XUNg== X-Gm-Message-State: AOAM530mZTfjKPVXafvLkuJhL9zrTmoCyG83mhwo1j9pNhrmfsM8oxth tnkv2zr9ZeQtjxZPVs846cKueih93d0dkA== X-Google-Smtp-Source: ABdhPJyPra9B3FwvXMINrevVE5mJ93prKCV0uBesdYadE6Nyq8RgJofoEs5VIkhhucPXRCRsqckQww== X-Received: by 2002:a63:2066:: with SMTP id r38mr57829304pgm.389.1636351303554; Sun, 07 Nov 2021 22:01:43 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:c3da:4e21:7720:afe7]) by smtp.gmail.com with ESMTPSA id j15sm14379654pfh.35.2021.11.07.22.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 22:01:43 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Nov 2021 15:01:35 +0900 Message-Id: <20211108060135.370781-1-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.rc0.344.g81b53c2807-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] lc-compliance: Build with googltest in subproject 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" libgtest-dev is provided as a static library. The compiler and linker to create the static library might be different from ones used for libcamera. This causes a problem upon linking. This puts googltest code to subprojects, builds the code and link it for lc-compliance. However, libgtest is locally built as a library on ChromeOS and thus the used compiler and linker are the same as one used for libcamera. We don't do these on ChromeOS build environment. Signed-off-by: Hirokazu Honda Tested-by: Jacopo Mondi --- README.rst | 2 +- src/lc-compliance/meson.build | 14 ++++++++++---- subprojects/.gitignore | 4 +++- subprojects/gtest.wrap | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 subprojects/gtest.wrap diff --git a/README.rst b/README.rst index 8af5f118..c48b4dba 100644 --- a/README.rst +++ b/README.rst @@ -99,7 +99,7 @@ for android: [optional] libexif-dev libjpeg-dev libyaml-dev for lc-compliance: [optional] - libevent-dev libgtest-dev + libevent-dev Using GStreamer plugin ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build index aa5852f6..4d13ad00 100644 --- a/src/lc-compliance/meson.build +++ b/src/lc-compliance/meson.build @@ -1,15 +1,21 @@ # SPDX-License-Identifier: CC0-1.0 -libevent = dependency('libevent_pthreads', required : get_option('lc-compliance')) -libgtest = dependency('gtest', required : get_option('lc-compliance')) - -if not (libevent.found() and libgtest.found()) +if not get_option('lc-compliance').enabled() lc_compliance_enabled = false subdir_done() endif lc_compliance_enabled = true +libevent = dependency('libevent_pthreads', required : true) + +if get_option('android_platform') == 'cros' + libgtest = dependency('gtest', required : true) +else + libgtest_sp = subproject('gtest') + libgtest = libgtest_sp.get_variable('gtest_dep') +endif + lc_compliance_sources = files([ '../cam/event_loop.cpp', '../cam/options.cpp', diff --git a/subprojects/.gitignore b/subprojects/.gitignore index 410b8bd6..82ef2c83 100644 --- a/subprojects/.gitignore +++ b/subprojects/.gitignore @@ -1 +1,3 @@ -/libyuv \ No newline at end of file +/libyuv +/googletest-release* +/packagecache \ No newline at end of file diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap new file mode 100644 index 00000000..8513793f --- /dev/null +++ b/subprojects/gtest.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = googletest-release-1.11.0 +source_url = https://github.com/google/googletest/archive/release-1.11.0.zip +source_filename = gtest-1.11.0.zip +source_hash = 353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a +patch_filename = gtest_1.11.0-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.11.0-1/get_patch +patch_hash = d38c39184384608b08419be52aed1d0f9d9d1b5ed71c0c35e51cccbdddab7084 + +[provide] +gtest = gtest_dep +gtest_main = gtest_main_dep +gmock = gmock_dep +gmock_main = gmock_main_dep +