OSDN Git Service

toolchain: build gtest convenience library
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Thu, 1 Sep 2016 19:59:36 +0000 (12:59 -0700)
committerSean V Kelley <seanvk@posteo.de>
Wed, 7 Sep 2016 17:18:01 +0000 (10:18 -0700)
Define autoconf/automake rules to build libgtest.la
as a convenience library.

Add --enable-tests configure option (default:no).

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
Makefile.am
configure.ac
test/Makefile.am [new file with mode: 0644]

index 093adef..37ef353 100644 (file)
@@ -2,6 +2,11 @@ AUTOMAKE_OPTIONS = foreign
 
 SUBDIRS = debian.upstream src
 
+if ENABLE_TESTS
+SUBDIRS += test
+endif
+
+
 # Extra clean files so that maintainer-clean removes *everything*
 MAINTAINERCLEANFILES = \
        aclocal.m4 compile config.guess config.sub \
index f12f8a6..7b4fd0a 100644 (file)
@@ -61,11 +61,16 @@ AC_ARG_ENABLE([hybrid-codec],
                     [build with hybrid codec support @<:@default=no@:>@])],
     [], [enable_hybrid_codec="no"])
 
+AC_ARG_ENABLE([tests],
+    [AC_HELP_STRING([--enable-tests],
+                    [build tests @<:@default=no@:>@])],
+    [], [enable_tests="no"])
+
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 AC_PROG_CC
 AM_PROG_CC_C_O
-
+AC_PROG_CXX
 AC_C_BIGENDIAN
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
@@ -116,6 +121,8 @@ if test "$enable_hybrid_codec" = "yes"; then
     AC_DEFINE([HAVE_HYBRID_CODEC], [1], [Defined to 1 if hybrid codec is needed])
 fi
 
+AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" = "yes")
+
 VA_VERSION=`$PKG_CONFIG --modversion libva`
 VA_MAJOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f1`
 VA_MINOR_VERSION=`echo "$VA_VERSION" | cut -d'.' -f2`
@@ -207,6 +214,7 @@ AC_OUTPUT([
     src/shaders/render/Makefile
     src/shaders/utils/Makefile
     src/shaders/vme/Makefile
+    test/Makefile
 ])
 
 dnl Print summary
@@ -221,4 +229,5 @@ echo
 echo VA-API version ................... : $VA_VERSION_STR
 echo VA-API drivers path .............. : $LIBVA_DRIVERS_PATH
 echo Windowing systems ................ : $BACKENDS
+echo Build tests ...................... : $enable_tests
 echo
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644 (file)
index 0000000..aa79703
--- /dev/null
@@ -0,0 +1,38 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
+AM_CXXFLAGS =                                                          \
+       -I$(top_srcdir)/test/gtest/include                              \
+       $(NULL)
+
+AM_CPPFLAGS =                                                          \
+       -DGTEST_HAS_PTHREAD=1                                           \
+       -DGTEST_USE_OWN_TR1_TUPLE=0                                     \
+       -DGTEST_LANG_CXX11=1                                            \
+       -DGTEST_HAS_TR1_TUPLE=1                                         \
+       -std=c++11                                                      \
+       $(NULL)
+
+AM_LDFLAGS =                                                           \
+       -pthread                                                        \
+       $(NULL)
+
+noinst_LTLIBRARIES = libgtest.la
+
+libgtest_la_SOURCES =                                                  \
+       gtest/src/gtest-all.cc                                          \
+       gtest/src/gtest_main.cc                                         \
+       $(NULL)
+
+libgtest_la_CXXFLAGS =                                                 \
+       -I$(top_srcdir)/test/gtest                                      \
+       $(AM_CXXFLAGS)                                                  \
+       $(NULL)
+
+EXTRA_DIST =                                                           \
+       gtest/docs                                                      \
+       gtest/include                                                   \
+       gtest/src/*.cc                                                  \
+       gtest/src/*.h                                                   \
+       gtest/README.md                                                 \
+       gtest/LICENSE                                                   \
+       $(NULL)