kumquat-buildroot/package/gtest/gtest.mk

96 lines
3.0 KiB
Makefile
Raw Normal View History

################################################################################
#
# gtest
#
################################################################################
GTEST_VERSION = 1.8.0
GTEST_SITE = $(call github,google,googletest,release-$(GTEST_VERSION))
GTEST_INSTALL_STAGING = YES
GTEST_INSTALL_TARGET = NO
GTEST_LICENSE = BSD-3-Clause
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
GTEST_LICENSE_FILES = googletest/LICENSE
ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
GTEST_DEPENDENCIES += host-gtest
endif
HOST_GTEST_LICENSE = Apache-2.0
HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
ifeq ($(BR2_PACKAGE_PYTHON3),y)
HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
HOST_GTEST_DEPENDENCIES += host-python3
else
HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
HOST_GTEST_DEPENDENCIES += host-python
endif
HOST_GTEST_GMOCK_PYTHONPATH = \
$(HOST_DIR)/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
# While it is possible to build gtest as shared library, using this gtest shared
# library requires to set some special configure option in the project using
# gtest.
# So, force to build gtest as a static library.
#
# For further details, refer to the explaination given in the README file from
# the gtest sources.
GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
# Ensure that GTest is compiled with -fPIC to allow linking the static
# libraries with dynamically linked programs. This is not a requirement
# for most architectures but is mandatory for ARM.
ifeq ($(BR2_STATIC_LIBS),)
GTEST_CONF_OPTS += -DCMAKE_POSITION_INDEPENDENT_CODE=ON
endif
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
GTEST_CONF_OPTS += -DBUILD_GTEST=ON
ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
else
GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
endif
define GTEST_INSTALL_MISSING_FILES
$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
# Generate the gtest-config script manually, since the CMake
# build system is not doing it.
sed 's%@PACKAGE_TARNAME@%gtest%;\
s%@PACKAGE_VERSION@%$(GTEST_VERSION)%;\
s%@prefix@%$(STAGING_DIR)/usr%;\
s%@exec_prefix@%$(STAGING_DIR)/usr%;\
s%@libdir@%$(STAGING_DIR)/usr/lib%;\
s%@includedir@%$(STAGING_DIR)/usr/include%;\
s%@bindir@%$(STAGING_DIR)/usr/bin%;\
s%@PTHREAD_CFLAGS@%%;\
s%@PTHREAD_LIBS@%-lpthread%;' \
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
$(@D)/googletest/scripts/gtest-config.in \
> $(STAGING_DIR)/usr/bin/gtest-config
chmod +x $(STAGING_DIR)/usr/bin/gtest-config
endef
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
GTEST_POST_INSTALL_STAGING_HOOKS = GTEST_INSTALL_MISSING_FILES
ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
define GTEST_GMOCK_INSTALL_MISSING_FILE
$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
endef
GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
endif
define HOST_GTEST_INSTALL_CMDS
$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
$(HOST_DIR)/bin/gmock_gen
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
cp -rp $(@D)/googlemock/scripts/generator/cpp \
$(HOST_GTEST_GMOCK_PYTHONPATH)
endef
$(eval $(cmake-package))
gtest/gmock: bump to version 1.8.0 GTest version 1.8.0 includes gmock so merge both packages inside gtest In this merge: - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK) following advice from Arnout Vandecappelle - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST and BR2_PACKAGE_GTEST_GMOCK. - Use cmake to install libraries and headers and add missing files (gtest.pc, gtest-config, gmock.pc) in GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining GTEST_INSTALL_STAGING_CMDS - Remove patch on Python as gmock/gtest now supports python 3.0 (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc) - Add the correct license in HOST_GTEST_LICENSE as all python code in googlemock/scripts/generator is licensed under Apache-2.0 and not BSD-3c - Fix URL of gtest project in Config.in - Remove the gmock entry from DEVELOPERS - Install gmock_gen directly, instead of as a symlink to gmock_gen.py Notice that any external package that depends on gmock will cause an immediate build termination because make doesn't know how to build gmock. Since the user has just removed gmock from the legacy menu, it should be quite obvious what needs to be done. Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com> Signed-off-by: Carlos Santos <casantos@datacom.ind.br> Reviewed-by: Romain Naour <romain.naour@gmail.com> [Thomas: - Use += instead of = when assigning a value to <pkg>_DEPENDENCIES in conditional - Remove comment about the "tricky logic" around BUILD_GTEST and BUILD_GMOCK - Move GTEST_GMOCK_INSTALL_MISSING_FILE inside the ($(BR2_PACKAGE_GTEST_GMOCK),y) condition.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-02-14 12:05:16 +01:00
# 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))