Skip to contentSkip to conversation

package/gtest: host-gtest install like a normal cmake package

PATCH Applied Paul Soucy 3 participants 4 messages Dec 16, 2020 – Jan 9, 2022

lore
Share & tools
lore

Paul Soucy

author
#0 lore raw

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

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.

---
 package/gtest/gtest.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/gtest/gtest.mk +5 -4
index 7f967b8bfb..f35ae63383 100644
@@ -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))
Signature · 1 line
2.24.1 (Apple Git-126)
#1 lore raw

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

Hello Paul,

Quoted 3 lines · On Wed, 16 Dec 2020 12:44:04 -0500 Paul Soucy <[email protected]> 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.

Thanks for your patch!

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

package/gtest/gtest.mk else · line 98

Quoted 9 lines
package/gtest/gtest.mk +2 -1
-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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#2 lore raw

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

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.

Quoted 33 lines · Thomas Petazzoni

Hello Paul,

Quoted 1 line · On Wed, 16 Dec 2020 12:44:04 -0500 Paul Soucy <[email protected]> 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.

Quoted 2 lines

Thanks for your patch!

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

package/gtest/gtest.mk else

Quoted 3 lines
package/gtest/gtest.mk +1 -1
-define HOST_GTEST_INSTALL_CMDS
+define HOST_GTEST_POST_INSTALL_PYTHON
      $(INSTALL) -D -m 0755

$(@D)/googlemock/scripts/generator/gmock_gen.py \

Quoted 6 lines
              $(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?

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20201230/a92f3b03/attachment.html>

#3 lore raw
In reply to Paul Soucy

Paul, All,

Sorry for the long delay...

On 2020-12-16 12:44 -0500, Paul Soucy spake thusly:

Quoted 1 line

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.

I rewrapped the commit log, and slightly extended it with the information you rpovided elsewhere in the thread.

Quoted 14 lines
---
 package/gtest/gtest.mk | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
package/gtest/gtest.mk +0 -1
index 7f967b8bfb..f35ae63383 100644
@@ -88,14 +88,15 @@ else
 GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
 endif
 
-define HOST_GTEST_INSTALL_CMDS

package/gtest/gtest.mk else · line 100

Quoted 10 lines
package/gtest/gtest.mk +4 -0
+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
+
+
    $ make check-package
    package/gtest/gtest.mk:64: consecutive empty lines

Applied to master with the above fixed, thanks.

Regards,
Yann E. MORIN.

Quoted 5 lines
package/gtest/gtest.mk +1 -3
 $(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))
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot