configs/bananapro: bump Linux to 4.10.4
[buildroot-gz.git] / package / gtest / gtest.mk
blob329179d07926afcaba3c28856658d63c3cff9391
1 ################################################################################
3 # gtest
5 ################################################################################
7 GTEST_VERSION = release-1.8.0
8 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
9 GTEST_INSTALL_STAGING = YES
10 GTEST_INSTALL_TARGET = NO
11 GTEST_LICENSE = BSD-3c
12 GTEST_LICENSE_FILES = googletest/LICENSE
14 ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
15 GTEST_DEPENDENCIES += host-gtest
16 endif
18 HOST_GTEST_LICENSE = Apache-2.0
19 HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
20 ifeq ($(BR2_PACKAGE_PYTHON3),y)
21 HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
22 HOST_GTEST_DEPENDENCIES += host-python3
23 else
24 HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
25 HOST_GTEST_DEPENDENCIES += host-python
26 endif
28 HOST_GTEST_GMOCK_PYTHONPATH = \
29 $(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
31 # While it is possible to build gtest as shared library, using this gtest shared
32 # library requires to set some special configure option in the project using
33 # gtest.
34 # So, force to build gtest as a static library.
36 # For further details, refer to the explaination given in the README file from
37 # the gtest sources.
38 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
40 GTEST_CONF_OPTS += -DBUILD_GTEST=ON
42 ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
43 GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
44 else
45 GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
46 endif
48 define GTEST_INSTALL_MISSING_FILES
49 $(INSTALL) -D -m 0644 package/gtest/gtest.pc \
50 $(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
51 # Generate the gtest-config script manually, since the CMake
52 # build system is not doing it.
53 sed 's%@PACKAGE_TARNAME@%gtest%;\
54 s%@PACKAGE_VERSION@%$(GTEST_VERSION)%;\
55 s%@prefix@%$(STAGING_DIR)/usr%;\
56 s%@exec_prefix@%$(STAGING_DIR)/usr%;\
57 s%@libdir@%$(STAGING_DIR)/usr/lib%;\
58 s%@includedir@%$(STAGING_DIR)/usr/include%;\
59 s%@bindir@%$(STAGING_DIR)/usr/bin%;\
60 s%@PTHREAD_CFLAGS@%%;\
61 s%@PTHREAD_LIBS@%-lpthread%;' \
62 $(@D)/googletest/scripts/gtest-config.in \
63 > $(STAGING_DIR)/usr/bin/gtest-config
64 chmod +x $(STAGING_DIR)/usr/bin/gtest-config
65 endef
67 GTEST_POST_INSTALL_STAGING_HOOKS = GTEST_INSTALL_MISSING_FILES
69 ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
70 define GTEST_GMOCK_INSTALL_MISSING_FILE
71 $(INSTALL) -D -m 0644 package/gtest/gmock.pc \
72 $(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
73 endef
75 GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
76 endif
78 define HOST_GTEST_INSTALL_CMDS
79 $(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
80 $(HOST_DIR)/usr/bin/gmock_gen
81 cp -rp $(@D)/googlemock/scripts/generator/cpp \
82 $(HOST_GTEST_GMOCK_PYTHONPATH)
83 endef
85 $(eval $(cmake-package))
86 # The host package does not build anything, just installs gmock_gen stuff, so
87 # it does not need to be a host-cmake-package.
88 $(eval $(host-generic-package))