[{"id":20747,"web_url":"https://patchwork.libcamera.org/comment/20747/","msgid":"<163645737474.1317171.12450065060742657646@Monstersaurus>","date":"2021-11-09T11:29:34","subject":"Re: [libcamera-devel] [PATCH v2] lc-compliance: Build with\n\tgoogltest in subproject","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Should it be googletest or gtest in $SUBJECT?\n\nQuoting Hirokazu Honda (2021-11-09 05:32:19)\n> libgtest-dev is provided as a static library at least Debian 10.\n> The compiler and linker to create the static library might be\n> different from ones used for libcamera. This causes a problem\n> upon linking.\n> \n> This puts googltest code to subprojects, builds the code and link it\n\nSame here.\n\n> for lc-compliance. However, libgtest is locally built as a library on\n> ChromeOS and thus the used compiler and linker are the same as one\n> used for libcamera. We don't do these on ChromeOS build environment.\n> \n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Tested-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  README.rst                    |  2 +-\n>  src/lc-compliance/meson.build | 16 ++++++++++++++--\n>  subprojects/.gitignore        |  4 +++-\n>  subprojects/gtest.wrap        | 14 ++++++++++++++\n>  4 files changed, 32 insertions(+), 4 deletions(-)\n>  create mode 100644 subprojects/gtest.wrap\n> \n> diff --git a/README.rst b/README.rst\n> index 8af5f118..c48b4dba 100644\n> --- a/README.rst\n> +++ b/README.rst\n> @@ -99,7 +99,7 @@ for android: [optional]\n>          libexif-dev libjpeg-dev libyaml-dev\n>  \n>  for lc-compliance: [optional]\n> -        libevent-dev libgtest-dev\n> +        libevent-dev\n>  \n>  Using GStreamer plugin\n>  ~~~~~~~~~~~~~~~~~~~~~~\n> diff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build\n> index aa5852f6..8c43ef12 100644\n> --- a/src/lc-compliance/meson.build\n> +++ b/src/lc-compliance/meson.build\n> @@ -1,15 +1,27 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>  \n>  libevent = dependency('libevent_pthreads', required : get_option('lc-compliance'))\n> -libgtest = dependency('gtest', required : get_option('lc-compliance'))\n>  \n> -if not (libevent.found() and libgtest.found())\n> +if not libevent.found()\n>      lc_compliance_enabled = false\n>      subdir_done()\n>  endif\n>  \n>  lc_compliance_enabled = true\n>  \n> +if get_option('android_platform') == 'cros'\n> +    libgtest = dependency('gtest', required : get_option('lc-compliance'))\n> +\n> +    if not libgtest.found()\n> +        lc_compliance_enabled = false\n\nThis could also be made to fall through and use the wrap somehow - but\nas it's not expected, and not essential I'm fine with this as it is.\n\n> +        subdir_done()\n> +    endif\n> +\n> +else\n> +    libgtest_sp = subproject('gtest')\n> +    libgtest = libgtest_sp.get_variable('gtest_dep')\n> +endif\n> +\n>  lc_compliance_sources = files([\n>      '../cam/event_loop.cpp',\n>      '../cam/options.cpp',\n> diff --git a/subprojects/.gitignore b/subprojects/.gitignore\n> index 410b8bd6..82ef2c83 100644\n> --- a/subprojects/.gitignore\n> +++ b/subprojects/.gitignore\n> @@ -1 +1,3 @@\n> -/libyuv\n> \\ No newline at end of file\n> +/libyuv\n> +/googletest-release*\n> +/packagecache\n\nI bet I know someone who would ask for those to be alphabetical sort\norder ;-)\n\nMinors aside,\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \\ No newline at end of file\n> diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap\n> new file mode 100644\n> index 00000000..40128b35\n> --- /dev/null\n> +++ b/subprojects/gtest.wrap\n> @@ -0,0 +1,14 @@\n> +[wrap-file]\n> +directory = googletest-release-1.11.0\n> +source_url = https://github.com/google/googletest/archive/release-1.11.0.zip\n> +source_filename = gtest-1.11.0.zip\n> +source_hash = 353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a\n> +patch_filename = gtest_1.11.0-1_patch.zip\n> +patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.11.0-1/get_patch\n> +patch_hash = d38c39184384608b08419be52aed1d0f9d9d1b5ed71c0c35e51cccbdddab7084\n> +\n> +[provide]\n> +gtest = gtest_dep\n> +gtest_main = gtest_main_dep\n> +gmock = gmock_dep\n> +gmock_main = gmock_main_dep\n> -- \n> 2.34.0.rc0.344.g81b53c2807-goog\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7879FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Nov 2021 11:29:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 940346034E;\n\tTue,  9 Nov 2021 12:29:39 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3627D600BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Nov 2021 12:29:37 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B419CFD1;\n\tTue,  9 Nov 2021 12:29:36 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NGQ77+kE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636457376;\n\tbh=WQQUCQj1SHbu0NRq3lxFOtmD6F0QBHR1jWn7yJHbpDA=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=NGQ77+kEhSpM7/ANSMR72Wdq4uRfLAA1PKylFF6E9+VlhjMspcIL+XrUPhRhyDALq\n\tkp604f5H/DpL8hVqpG6cmkWh8cSGckxXsrz7SrsbX/ld8R/x1L2IOBzyIs64+mVO9w\n\tPEgT9FbX//19DnIO4pssDCfgIXfDPv0JGPwblzms=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211109053219.2682711-1-hiroh@chromium.org>","References":"<20211109053219.2682711-1-hiroh@chromium.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>, libcamera-devel@lists.libcamera.org","Date":"Tue, 09 Nov 2021 11:29:34 +0000","Message-ID":"<163645737474.1317171.12450065060742657646@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH v2] lc-compliance: Build with\n\tgoogltest in subproject","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20887,"web_url":"https://patchwork.libcamera.org/comment/20887/","msgid":"<YY2rH9kJpLHx4wH9@pendragon.ideasonboard.com>","date":"2021-11-11T23:45:35","subject":"Re: [libcamera-devel] [PATCH v2] lc-compliance: Build with\n\tgoogltest in subproject","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Nov 09, 2021 at 11:29:34AM +0000, Kieran Bingham wrote:\n> Should it be googletest or gtest in $SUBJECT?\n> \n> Quoting Hirokazu Honda (2021-11-09 05:32:19)\n> > libgtest-dev is provided as a static library at least Debian 10.\n\ns/least/least by/\n\n> > The compiler and linker to create the static library might be\n> > different from ones used for libcamera. This causes a problem\n> > upon linking.\n> > \n> > This puts googltest code to subprojects, builds the code and link it\n> \n> Same here.\n> \n> > for lc-compliance. However, libgtest is locally built as a library on\n> > ChromeOS and thus the used compiler and linker are the same as one\n> > used for libcamera. We don't do these on ChromeOS build environment.\n> > \n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > Tested-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  README.rst                    |  2 +-\n> >  src/lc-compliance/meson.build | 16 ++++++++++++++--\n> >  subprojects/.gitignore        |  4 +++-\n> >  subprojects/gtest.wrap        | 14 ++++++++++++++\n> >  4 files changed, 32 insertions(+), 4 deletions(-)\n> >  create mode 100644 subprojects/gtest.wrap\n> > \n> > diff --git a/README.rst b/README.rst\n> > index 8af5f118..c48b4dba 100644\n> > --- a/README.rst\n> > +++ b/README.rst\n> > @@ -99,7 +99,7 @@ for android: [optional]\n> >          libexif-dev libjpeg-dev libyaml-dev\n> >  \n> >  for lc-compliance: [optional]\n> > -        libevent-dev libgtest-dev\n> > +        libevent-dev\n> >  \n> >  Using GStreamer plugin\n> >  ~~~~~~~~~~~~~~~~~~~~~~\n> > diff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build\n> > index aa5852f6..8c43ef12 100644\n> > --- a/src/lc-compliance/meson.build\n> > +++ b/src/lc-compliance/meson.build\n> > @@ -1,15 +1,27 @@\n> >  # SPDX-License-Identifier: CC0-1.0\n> >  \n> >  libevent = dependency('libevent_pthreads', required : get_option('lc-compliance'))\n> > -libgtest = dependency('gtest', required : get_option('lc-compliance'))\n> >  \n> > -if not (libevent.found() and libgtest.found())\n> > +if not libevent.found()\n> >      lc_compliance_enabled = false\n> >      subdir_done()\n> >  endif\n> >  \n> >  lc_compliance_enabled = true\n\nThis should be moved after the block below, or summary() will report\nlc-compliance as enabled on cros when gtest can't be found.\n\n> >  \n> > +if get_option('android_platform') == 'cros'\n> > +    libgtest = dependency('gtest', required : get_option('lc-compliance'))\n> > +\n> > +    if not libgtest.found()\n> > +        lc_compliance_enabled = false\n> \n> This could also be made to fall through and use the wrap somehow - but\n> as it's not expected, and not essential I'm fine with this as it is.\n\nEven better, we should use the system version of gtest if it's compiled\nwith the right compiler, regardless of the platform.\n\n> > +        subdir_done()\n> > +    endif\n> > +\n> > +else\n> > +    libgtest_sp = subproject('gtest')\n> > +    libgtest = libgtest_sp.get_variable('gtest_dep')\n> > +endif\n> > +\n> >  lc_compliance_sources = files([\n> >      '../cam/event_loop.cpp',\n> >      '../cam/options.cpp',\n> > diff --git a/subprojects/.gitignore b/subprojects/.gitignore\n> > index 410b8bd6..82ef2c83 100644\n> > --- a/subprojects/.gitignore\n> > +++ b/subprojects/.gitignore\n> > @@ -1 +1,3 @@\n> > -/libyuv\n> > \\ No newline at end of file\n> > +/libyuv\n> > +/googletest-release*\n> > +/packagecache\n> \n> I bet I know someone who would ask for those to be alphabetical sort\n> order ;-)\n\nI wonder who :-)\n\n> Minors aside,\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > \\ No newline at end of file\n> > diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap\n> > new file mode 100644\n> > index 00000000..40128b35\n> > --- /dev/null\n> > +++ b/subprojects/gtest.wrap\n> > @@ -0,0 +1,14 @@\n> > +[wrap-file]\n> > +directory = googletest-release-1.11.0\n> > +source_url = https://github.com/google/googletest/archive/release-1.11.0.zip\n> > +source_filename = gtest-1.11.0.zip\n> > +source_hash = 353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a\n> > +patch_filename = gtest_1.11.0-1_patch.zip\n> > +patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.11.0-1/get_patch\n> > +patch_hash = d38c39184384608b08419be52aed1d0f9d9d1b5ed71c0c35e51cccbdddab7084\n> > +\n> > +[provide]\n> > +gtest = gtest_dep\n> > +gtest_main = gtest_main_dep\n> > +gmock = gmock_dep\n> > +gmock_main = gmock_main_dep","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 75CC8BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Nov 2021 23:46:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF3B76035F;\n\tFri, 12 Nov 2021 00:45:59 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 135F46033C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Nov 2021 00:45:58 +0100 (CET)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8067E74C;\n\tFri, 12 Nov 2021 00:45:57 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"S+muqqEs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636674357;\n\tbh=0F96ap+eZU2yXS61Gf42ukAj76GNjp0EXuiU4/fRbjA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=S+muqqEsM4MgXejhmkyLZFK5rfJXargD+1ZVz4e5gXV8fO101kZuuPYbV3L8vex9k\n\ttJGeNiuATxI4WvaoWQtXA5FNa5OLMa8GCa4uQl02tLiaDdA1NPnsQcwC0zum4zFzef\n\tOTZtDL9pdJhhZEZCUNpJbshSRuMyF56WMrc19lh8=","Date":"Fri, 12 Nov 2021 01:45:35 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YY2rH9kJpLHx4wH9@pendragon.ideasonboard.com>","References":"<20211109053219.2682711-1-hiroh@chromium.org>\n\t<163645737474.1317171.12450065060742657646@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<163645737474.1317171.12450065060742657646@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH v2] lc-compliance: Build with\n\tgoogltest in subproject","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]