[libcamera-devel,v6,1/4] lc-compliance: Build with gtest in subprojects
diff mbox series

Message ID 20211110072207.3273703-1-hiroh@chromium.org
State Accepted
Headers show
Series
  • [libcamera-devel,v6,1/4] lc-compliance: Build with gtest in subprojects
Related show

Commit Message

Hirokazu Honda Nov. 10, 2021, 7:22 a.m. UTC
libgtest-dev is provided as a static library at least Debian 10.
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 gtest 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 <hiroh@chromium.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 README.rst                    |  2 +-
 src/lc-compliance/meson.build | 16 ++++++++++++++--
 subprojects/.gitignore        |  4 +++-
 subprojects/gtest.wrap        | 14 ++++++++++++++
 4 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 subprojects/gtest.wrap

Comments

Kieran Bingham Nov. 10, 2021, 10:06 a.m. UTC | #1
Hi Hiro,

Quoting Hirokazu Honda (2021-11-10 07:22:04)
> libgtest-dev is provided as a static library at least Debian 10.
> 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 gtest 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.
> 

Is this different from "[PATCH v3] lc-compliance: Build with gtest in
subprojects"?

Perhaps it was not intended to be in this series.

Could you include cover letters on your series when you post them
please. That will help ensure the intended content of the series is
clear.

--
Kieran


> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  README.rst                    |  2 +-
>  src/lc-compliance/meson.build | 16 ++++++++++++++--
>  subprojects/.gitignore        |  4 +++-
>  subprojects/gtest.wrap        | 14 ++++++++++++++
>  4 files changed, 32 insertions(+), 4 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..8c43ef12 100644
> --- a/src/lc-compliance/meson.build
> +++ b/src/lc-compliance/meson.build
> @@ -1,15 +1,27 @@
>  # 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 libevent.found()
>      lc_compliance_enabled = false
>      subdir_done()
>  endif
>  
>  lc_compliance_enabled = true
>  
> +if get_option('android_platform') == 'cros'
> +    libgtest = dependency('gtest', required : get_option('lc-compliance'))
> +
> +    if not libgtest.found()
> +        lc_compliance_enabled = false
> +        subdir_done()
> +    endif
> +
> +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..391fde2c 100644
> --- a/subprojects/.gitignore
> +++ b/subprojects/.gitignore
> @@ -1 +1,3 @@
> -/libyuv
> \ No newline at end of file
> +/googletest-release*
> +/libyuv
> +/packagecache
> \ No newline at end of file
> diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
> new file mode 100644
> index 00000000..40128b35
> --- /dev/null
> +++ b/subprojects/gtest.wrap
> @@ -0,0 +1,14 @@
> +[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
> -- 
> 2.34.0.rc0.344.g81b53c2807-goog
>
Umang Jain Nov. 10, 2021, 4:39 p.m. UTC | #2
Hi Hiro,

Thank you for the patch

On 11/10/21 12:52 PM, Hirokazu Honda wrote:
> libgtest-dev is provided as a static library at least Debian 10.
> 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 gtest 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 <hiroh@chromium.org>
> Tested-by: Jacopo Mondi <jacopo@jmondi.org>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   README.rst                    |  2 +-
>   src/lc-compliance/meson.build | 16 ++++++++++++++--
>   subprojects/.gitignore        |  4 +++-
>   subprojects/gtest.wrap        | 14 ++++++++++++++
>   4 files changed, 32 insertions(+), 4 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..8c43ef12 100644
> --- a/src/lc-compliance/meson.build
> +++ b/src/lc-compliance/meson.build
> @@ -1,15 +1,27 @@
>   # 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 libevent.found()
>       lc_compliance_enabled = false
>       subdir_done()
>   endif
>   
>   lc_compliance_enabled = true
>   
> +if get_option('android_platform') == 'cros'
> +    libgtest = dependency('gtest', required : get_option('lc-compliance'))
> +
> +    if not libgtest.found()
> +        lc_compliance_enabled = false
> +        subdir_done()
> +    endif
> +
> +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..391fde2c 100644
> --- a/subprojects/.gitignore
> +++ b/subprojects/.gitignore
> @@ -1 +1,3 @@
> -/libyuv
> \ No newline at end of file
> +/googletest-release*
> +/libyuv
> +/packagecache
> \ No newline at end of file
> diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
> new file mode 100644
> index 00000000..40128b35
> --- /dev/null
> +++ b/subprojects/gtest.wrap
> @@ -0,0 +1,14 @@
> +[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
Hirokazu Honda Nov. 10, 2021, 5:04 p.m. UTC | #3
Hi Kieran,

Yes, I sent patch v4 unintendly. Please ignore.
Re cover-letter, sure. I will do next time.

-Hiro

On Wed, Nov 10, 2021 at 7:06 PM Kieran Bingham
<kieran.bingham@ideasonboard.com> wrote:
>
> Hi Hiro,
>
> Quoting Hirokazu Honda (2021-11-10 07:22:04)
> > libgtest-dev is provided as a static library at least Debian 10.
> > 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 gtest 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.
> >
>
> Is this different from "[PATCH v3] lc-compliance: Build with gtest in
> subprojects"?
>
> Perhaps it was not intended to be in this series.
>
> Could you include cover letters on your series when you post them
> please. That will help ensure the intended content of the series is
> clear.
>
> --
> Kieran
>
>
> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> > Tested-by: Jacopo Mondi <jacopo@jmondi.org>
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> >  README.rst                    |  2 +-
> >  src/lc-compliance/meson.build | 16 ++++++++++++++--
> >  subprojects/.gitignore        |  4 +++-
> >  subprojects/gtest.wrap        | 14 ++++++++++++++
> >  4 files changed, 32 insertions(+), 4 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..8c43ef12 100644
> > --- a/src/lc-compliance/meson.build
> > +++ b/src/lc-compliance/meson.build
> > @@ -1,15 +1,27 @@
> >  # 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 libevent.found()
> >      lc_compliance_enabled = false
> >      subdir_done()
> >  endif
> >
> >  lc_compliance_enabled = true
> >
> > +if get_option('android_platform') == 'cros'
> > +    libgtest = dependency('gtest', required : get_option('lc-compliance'))
> > +
> > +    if not libgtest.found()
> > +        lc_compliance_enabled = false
> > +        subdir_done()
> > +    endif
> > +
> > +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..391fde2c 100644
> > --- a/subprojects/.gitignore
> > +++ b/subprojects/.gitignore
> > @@ -1 +1,3 @@
> > -/libyuv
> > \ No newline at end of file
> > +/googletest-release*
> > +/libyuv
> > +/packagecache
> > \ No newline at end of file
> > diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
> > new file mode 100644
> > index 00000000..40128b35
> > --- /dev/null
> > +++ b/subprojects/gtest.wrap
> > @@ -0,0 +1,14 @@
> > +[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
> > --
> > 2.34.0.rc0.344.g81b53c2807-goog
> >

Patch
diff mbox series

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..8c43ef12 100644
--- a/src/lc-compliance/meson.build
+++ b/src/lc-compliance/meson.build
@@ -1,15 +1,27 @@ 
 # 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 libevent.found()
     lc_compliance_enabled = false
     subdir_done()
 endif
 
 lc_compliance_enabled = true
 
+if get_option('android_platform') == 'cros'
+    libgtest = dependency('gtest', required : get_option('lc-compliance'))
+
+    if not libgtest.found()
+        lc_compliance_enabled = false
+        subdir_done()
+    endif
+
+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..391fde2c 100644
--- a/subprojects/.gitignore
+++ b/subprojects/.gitignore
@@ -1 +1,3 @@ 
-/libyuv
\ No newline at end of file
+/googletest-release*
+/libyuv
+/packagecache
\ No newline at end of file
diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap
new file mode 100644
index 00000000..40128b35
--- /dev/null
+++ b/subprojects/gtest.wrap
@@ -0,0 +1,14 @@ 
+[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