diff mbox series

[1/1] package/gtest: host-gtest install like a normal cmake package

Message ID 20201216174404.47363-1-paul.soucy@sense.com
State New
Headers show
Series [1/1] package/gtest: host-gtest install like a normal cmake package | expand

Commit Message

Paul Soucy Dec. 16, 2020, 5:44 p.m. UTC
host-gtest does not actually build and install gtest libraries or header files, it just installs the gmock_gen stuff. This patch will now build and install gtest to the host like a normal cmake package.

Signed-off-by: Paul Soucy <paul.soucy@sense.com>
---
 package/gtest/gtest.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Thomas Petazzoni Dec. 30, 2020, 2:43 p.m. UTC | #1
Hello Paul,

On Wed, 16 Dec 2020 12:44:04 -0500
Paul Soucy <paul.soucy@sense.com> wrote:

> host-gtest does not actually build and install gtest libraries or header files, it just installs the gmock_gen stuff. This patch will now build and install gtest to the host like a normal cmake package.
> 
> Signed-off-by: Paul Soucy <paul.soucy@sense.com>

Thanks for your patch!

Could you give some details as to why you need gtest to be installed in
$(HOST_DIR) ?

> -define HOST_GTEST_INSTALL_CMDS
> +define HOST_GTEST_POST_INSTALL_PYTHON
>  	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
>  		$(HOST_DIR)/bin/gmock_gen
>  	cp -rp $(@D)/googlemock/scripts/generator/cpp \
>  		$(HOST_GTEST_GMOCK_PYTHONPATH)
>  endef
>  
> +HOST_GTEST_POST_INSTALL_HOOKS += HOST_GTEST_POST_INSTALL_PYTHON

Is this thing still needed? I applied your patch, and I was able to
successfully build the target gtest+gmock, even without gmock_gen being
installed in $(HOST_DIR)/bin/ by host-gtest.

Am I missing something?

Best regards,

Thomas
Paul Soucy Dec. 30, 2020, 3:13 p.m. UTC | #2
Hi Thomas,

Thanks for taking the time to look at the patch. The reason I would like
the option to install gtest to HOST_DIR is for running unit tests. Some of
our test suite needs to run on the HOST system. This patch solves the
problem.

I'm not sure if HOST_GTEST_POST_INSTALL_PYTHON thing is still needed. We do
not actually use the gmock feature of gtest. I was trying to preserve
existing functionality but not quite sure what the original intention of
this was.


On Wed, Dec 30, 2020, 9:44 AM Thomas Petazzoni <thomas.petazzoni@bootlin.com>
wrote:

> Hello Paul,
>
> On Wed, 16 Dec 2020 12:44:04 -0500
> Paul Soucy <paul.soucy@sense.com> wrote:
>
> > host-gtest does not actually build and install gtest libraries or header
> files, it just installs the gmock_gen stuff. This patch will now build and
> install gtest to the host like a normal cmake package.
> >
> > Signed-off-by: Paul Soucy <paul.soucy@sense.com>
>
> Thanks for your patch!
>
> Could you give some details as to why you need gtest to be installed in
> $(HOST_DIR) ?
>
> > -define HOST_GTEST_INSTALL_CMDS
> > +define HOST_GTEST_POST_INSTALL_PYTHON
> >       $(INSTALL) -D -m 0755
> $(@D)/googlemock/scripts/generator/gmock_gen.py \
> >               $(HOST_DIR)/bin/gmock_gen
> >       cp -rp $(@D)/googlemock/scripts/generator/cpp \
> >               $(HOST_GTEST_GMOCK_PYTHONPATH)
> >  endef
> >
> > +HOST_GTEST_POST_INSTALL_HOOKS += HOST_GTEST_POST_INSTALL_PYTHON
>
> Is this thing still needed? I applied your patch, and I was able to
> successfully build the target gtest+gmock, even without gmock_gen being
> installed in $(HOST_DIR)/bin/ by host-gtest.
>
> Am I missing something?
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
diff mbox series

Patch

diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index 7f967b8bfb..f35ae63383 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -88,14 +88,15 @@  else
 GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
 endif
 
-define HOST_GTEST_INSTALL_CMDS
+define HOST_GTEST_POST_INSTALL_PYTHON
 	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
 		$(HOST_DIR)/bin/gmock_gen
 	cp -rp $(@D)/googlemock/scripts/generator/cpp \
 		$(HOST_GTEST_GMOCK_PYTHONPATH)
 endef
 
+HOST_GTEST_POST_INSTALL_HOOKS += HOST_GTEST_POST_INSTALL_PYTHON
+
+
 $(eval $(cmake-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-cmake-package.
-$(eval $(host-generic-package))
+$(eval $(host-cmake-package))