Add building of Google Test libraries (#781978)

This closely follows the minimal-gtest-autotools template project.
    https://github.com/octol/minimal-gtest-autotools

Now 'make check' will additionally build the Google Test C++ test
framework libraries.

Bug 781978 - Add Google Test C++ test framework
This commit is contained in:
Mike Fleetwood 2017-04-20 18:44:41 +01:00 committed by Curtis Gedak
parent 4d6823a20a
commit 81b104928b
5 changed files with 79 additions and 1 deletions

2
.gitignore vendored
View File

@ -5,6 +5,7 @@
*~ *~
*.a *.a
*.gmo *.gmo
*.lo
*.mo *.mo
*.o *.o
*.omf *.omf
@ -33,6 +34,7 @@ gnome-doc-utils.make
help/*/gparted.xml help/*/gparted.xml
install-sh install-sh
intltool-* intltool-*
lib/gtest/lib
libtool libtool
ltmain.sh ltmain.sh
m4/*.m4 m4/*.m4

View File

@ -1,4 +1,4 @@
SUBDIRS = compose data doc include po src SUBDIRS = compose data doc include lib po src
# Only build GParted help documentation when enabled. (Can be disabled # Only build GParted help documentation when enabled. (Can be disabled
# with './configure --disable-doc'). # with './configure --disable-doc').
if BUILD_HELP_DOC if BUILD_HELP_DOC

View File

@ -285,6 +285,18 @@ fi
dnl Definitions for building of and with gtest. Gets flags for pthread via earlier
dnl gthread package check.
GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"
GTEST_CXXFLAGS="$GTHREAD_CFLAGS"
GTEST_LDFLAGS=
GTEST_LIBS="$GTHREAD_LIBS"
AC_SUBST([GTEST_CPPFLAGS])
AC_SUBST([GTEST_CXXFLAGS])
AC_SUBST([GTEST_LDFLAGS])
AC_SUBST([GTEST_LIBS])
dnl====================== dnl======================
dnl check whether to build documentation - gnome-doc-utils dnl check whether to build documentation - gnome-doc-utils
dnl====================== dnl======================
@ -367,6 +379,8 @@ data/icons/Makefile
doc/Makefile doc/Makefile
help/Makefile help/Makefile
include/Makefile include/Makefile
lib/Makefile
lib/gtest/Makefile
src/Makefile src/Makefile
po/Makefile.in po/Makefile.in
]) ])

1
lib/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = gtest

61
lib/gtest/Makefile.am Normal file
View File

@ -0,0 +1,61 @@
# Nonstandard package files for distribution
EXTRA_DIST = \
LICENSE \
README.md \
include/gtest/gtest-param-test.h.pump \
include/gtest/internal/gtest-param-util-generated.h.pump \
include/gtest/internal/gtest-tuple.h.pump \
include/gtest/internal/gtest-type-util.h.pump
# gtest source files that we don't compile directly. They are
# #included by gtest-all.cc.
GTEST_SRC = \
src/gtest-death-test.cc \
src/gtest-filepath.cc \
src/gtest-internal-inl.h \
src/gtest-port.cc \
src/gtest-printers.cc \
src/gtest-test-part.cc \
src/gtest-typed-test.cc \
src/gtest.cc \
include/gtest/gtest-death-test.h \
include/gtest/gtest-message.h \
include/gtest/gtest-param-test.h \
include/gtest/gtest-printers.h \
include/gtest/gtest-spi.h \
include/gtest/gtest-test-part.h \
include/gtest/gtest-typed-test.h \
include/gtest/gtest.h \
include/gtest/gtest_pred_impl.h \
include/gtest/gtest_prod.h \
include/gtest/internal/gtest-death-test-internal.h \
include/gtest/internal/gtest-filepath.h \
include/gtest/internal/gtest-internal.h \
include/gtest/internal/gtest-linked_ptr.h \
include/gtest/internal/gtest-param-util-generated.h \
include/gtest/internal/gtest-param-util.h \
include/gtest/internal/gtest-port.h \
include/gtest/internal/gtest-port-arch.h \
include/gtest/internal/gtest-string.h \
include/gtest/internal/gtest-tuple.h \
include/gtest/internal/gtest-type-util.h \
include/gtest/internal/custom/gtest.h \
include/gtest/internal/custom/gtest-port.h \
include/gtest/internal/custom/gtest-printers.h
EXTRA_DIST += $(GTEST_SRC)
# We define the global AM_CPPFLAGS as everything we compile includes from these
# directories.
AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include $(GTEST_CPPFLAGS)
AM_CXXFLAGS = $(GTEST_CXXFLAGS)
AM_LDFLAGS = $(GTEST_LDFLAGS)
LDADD = $(GTEST_LIBS)
# Build rules for libraries.
check_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la
lib_libgtest_la_SOURCES = src/gtest-all.cc
lib_libgtest_main_la_SOURCES = src/gtest_main.cc
lib_libgtest_main_la_LIBADD = lib/libgtest.la