summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-10-03 09:14:02 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-10-09 21:04:11 +1000
commitb50377c8fef4edb5a0b06f1fc8067859ad012885 (patch)
tree4c98b5cf207472c46a06ab4d586aaf8719f8e03c
parent2c100a7fe31cbd8779df945ebaec8d410686eade (diff)
Fix up build system to use the googletest import buildgoogletest-merge
Drop the CHECK_GTEST macro, we can assume it's there now. We still build the gtest bits as convenience libraries, leave the various flags in there. Add $includedir/xorg to pgkconfig CPPFLAGS, as we install gtest.h in includedir/xorg/gtest/gtest.h to avoid overwriting or conflicts with a system-installed gtest.h Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--Makefile.am2
-rw-r--r--aclocal/xorg-gtest.m450
-rw-r--r--configure.ac10
-rw-r--r--examples/Makefile.am4
-rw-r--r--gtest/Makefile.am28
-rw-r--r--gtest/include/Makefile.am25
-rw-r--r--src/Makefile-xorg-gtest.am6
-rw-r--r--test/Makefile.am8
-rw-r--r--xorg-gtest.pc.in2
9 files changed, 74 insertions, 61 deletions
diff --git a/Makefile.am b/Makefile.am
index b984c8e..d2fdbb0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@
# SOFTWARE.
#
-SUBDIRS = aclocal data doc include src examples test
+SUBDIRS = aclocal data doc include src examples test gtest
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-gtest.pc
diff --git a/aclocal/xorg-gtest.m4 b/aclocal/xorg-gtest.m4
index e180b56..6bd0d4f 100644
--- a/aclocal/xorg-gtest.m4
+++ b/aclocal/xorg-gtest.m4
@@ -1,4 +1,4 @@
-# serial 7
+# serial 9
# Copyright (C) 2012 Canonical, Ltd.
#
@@ -21,45 +21,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# Checks whether the gtest source is available on the system. Allows for
-# adjusting the include and source path. Sets have_gtest=yes if the source is
-# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
-# source location respectively.
-AC_DEFUN([_CHECK_GTEST],
-[
- AC_ARG_WITH([gtest-source-path],
- [AS_HELP_STRING([--with-gtest-source-path],
- [location of the Google test sources, defaults to /usr/src/gtest])],
- [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include";
- case "$withval" in
- /*) ;;
- *) AC_MSG_ERROR([gtest-source-path must be an absolute path ('$withval')]) ;;
- esac
- ],
- [GTEST_SOURCE="/usr/src/gtest"; GTEST_CPPFLAGS="-I$GTEST_SOURCE/include"])
-
- AC_ARG_WITH([gtest-include-path],
- [AS_HELP_STRING([--with-gtest-include-path],
- [location of the Google test headers])],
- [GTEST_CPPFLAGS="-I$withval";
- case "$withval" in
- /*) ;;
- *) AC_MSG_ERROR([gtest-include-path must be an absolute path ('$withval')]) ;;
- esac
- ])
-
- GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
-
- AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
- [$GTEST_SOURCE/src/gtest_main.cc],
- [have_gtest=yes],
- [have_gtest=no])
-
- AS_IF([test "x$have_gtest" = xyes],
- [AC_SUBST(GTEST_CPPFLAGS)]
- [AC_SUBST(GTEST_SOURCE)] [:])
-]) # _CHECK_GTEST
-
# CHECK_XORG_GTEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Checks whether the xorg-gtest source is available on the system. Allows for
@@ -71,13 +32,13 @@ AC_DEFUN([_CHECK_GTEST],
# Both default actions are no-ops.
AC_DEFUN([CHECK_XORG_GTEST],
[
- AC_REQUIRE([_CHECK_GTEST])
-
PKG_CHECK_EXISTS([xorg-gtest],
[have_xorg_gtest=yes],
[have_xorg_gtest=no])
XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest`
+ GTEST_SOURCE="$XORG_GTEST_SOURCE/src/gtest"
+ GTEST_CPPFLAGS="-I$XORG_GTEST_SOURCE/src/gtest/include -I$XORG_GTEST_SOURCE/src/gtest"
XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest`
XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS"
XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE"
@@ -102,10 +63,9 @@ AC_DEFUN([CHECK_XORG_GTEST],
AS_IF([test "x$have_xorg_gtest_evemu" = xyes],
[XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"])
- AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes],
- [have_xorg_gtest=no])
-
AS_IF([test "x$have_xorg_gtest" = xyes],
+ [AC_SUBST(GTEST_SOURCE)]
+ [AC_SUBST(GTEST_CPPFLAGS)]
[AC_SUBST(XORG_GTEST_SOURCE)]
[AC_SUBST(XORG_GTEST_CPPFLAGS)]
diff --git a/configure.ac b/configure.ac
index 6413d46..d8f1df6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,14 +27,6 @@ XORG_WITH_DOXYGEN
PKG_CHECK_MODULES(X11, x11 xi)
-# Check for Google Test
-CHECK_GTEST
-
-AS_IF([test "x$have_gtest" != xyes],
- AC_MSG_ERROR([package 'gtest' not found]))
-
-AC_SUBST([GTEST_CPPFLAGS])
-
# Check if we should include support for evemu
AC_ARG_WITH([evemu],
[AS_HELP_STRING([--with-evemu],
@@ -77,6 +69,8 @@ AM_CONDITIONAL(ENABLE_XORG_GTEST_TESTS, [test "x$have_dummy_module" = xyes ])
AC_CONFIG_FILES([Makefile
aclocal/Makefile
+ gtest/Makefile
+ gtest/include/Makefile
data/Makefile
doc/Doxyfile
doc/Makefile
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 49c133f..2cd1bd8 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -26,11 +26,13 @@
check_LIBRARIES = libgtest.a libxorg-gtest.a libxorg-gtest_main.a
+GTEST_CPPFLAGS=-I$(top_srcdir)/gtest/include -I$(top_srcdir)/gtest
+
AM_CPPFLAGS = $(GTEST_CPPFLAGS)
AM_CXXFLAGS = $(X11_CFLAGS) $(BASE_CXXFLAGS)
# build googletest as static lib
-nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc
+nodist_libgtest_a_SOURCES = $(top_srcdir)/gtest/src/gtest-all.cc
libgtest_a_CPPFLAGS = $(AM_CPPFLAGS) -w
libgtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
diff --git a/gtest/Makefile.am b/gtest/Makefile.am
new file mode 100644
index 0000000..5ba9d32
--- /dev/null
+++ b/gtest/Makefile.am
@@ -0,0 +1,28 @@
+# Makefile for the gtest subdirectory of xorg-gtest
+#
+# Copyright © 2012 Red Hat, Inc
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+SUBDIRS = include
+
+srcinstalldir = $(prefix)/src/xorg-gtest/src/gtest
+dist_srcinstall_DATA = src/gtest-all.cc src/gtest_main.cc
diff --git a/gtest/include/Makefile.am b/gtest/include/Makefile.am
new file mode 100644
index 0000000..54d3088
--- /dev/null
+++ b/gtest/include/Makefile.am
@@ -0,0 +1,25 @@
+# Makefile for the gtest/include subdirectory of xorg-gtest
+#
+# Copyright © 2012 Red Hat, Inc
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+
+nobase_include_HEADERS = gtest/gtest.h
diff --git a/src/Makefile-xorg-gtest.am b/src/Makefile-xorg-gtest.am
index 4f36b13..c7c96d8 100644
--- a/src/Makefile-xorg-gtest.am
+++ b/src/Makefile-xorg-gtest.am
@@ -26,14 +26,16 @@ XORG_GTEST_BUILD_LIBS = \
libxorg-gtest.a \
libxorg-gtest_main.a
+GTEST_CPPFLAGS=-I$(XORG_GTEST_SOURCE)/src/gtest
+
# Here and below we compile without warnings (-w) because the projects using
# xorg-gtest will not want to see warnings or fail to build due to warnings in
# gtest or xorg-gtest.
-nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc
+nodist_libgtest_a_SOURCES = $(XORG_GTEST_SOURCE)/src/gtest/gtest-all.cc
libgtest_a_CPPFLAGS = $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) -w
libgtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
-nodist_libgtest_main_a_SOURCES = $(GTEST_SOURCE)/src/gtest_main.cc
+nodist_libgtest_main_a_SOURCES = $(XORG_GTEST_SOURCE)/src/gtest/gtest_main.cc
libgtest_main_a_CPPFLAGS = $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) -w
libgtest_main_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
diff --git a/test/Makefile.am b/test/Makefile.am
index 4f847b3..df671a4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -28,6 +28,8 @@
noinst_PROGRAMS = process-test xserver-test device-test
noinst_DATA = PIXART-USB-OPTICAL-MOUSE.desc
+GTEST_CPPFLAGS=-I$(top_srcdir)/gtest/include -I$(top_srcdir)/gtest
+
AM_CPPFLAGS = $(GTEST_CPPFLAGS)
AM_CXXFLAGS = $(BASE_CXXFLAGS) \
-DTEST_ROOT_DIR=\"$(abs_top_srcdir)/test/\"
@@ -54,9 +56,9 @@ device_test_LDADD = $(tests_libraries)
check_LIBRARIES = libgtest.a libxorg-gtest.a
# build googletest as static lib
-nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc
+nodist_libgtest_a_SOURCES = $(top_srcdir)/gtest/src/gtest-all.cc
libgtest_a_CPPFLAGS = $(AM_CPPFLAGS) -w
-libgtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
+libgtest_a_CXXFLAGS = $(AM_CXXFLAGS)
# build xorg-gtest as static lib
libxorg_gtest_a_SOURCES = $(top_srcdir)/src/xorg-gtest-all.cpp
@@ -65,7 +67,7 @@ libxorg_gtest_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir) \
-DDUMMY_CONF_PATH="\"$(top_srcdir)/data/xorg/gtest/dummy.conf\""
-libxorg_gtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
+libxorg_gtest_a_CXXFLAGS = $(AM_CXXFLAGS)
if ENABLE_XORG_GTEST_TESTS
TESTS = $(noinst_PROGRAMS)
diff --git a/xorg-gtest.pc.in b/xorg-gtest.pc.in
index a80f666..e88e06c 100644
--- a/xorg-gtest.pc.in
+++ b/xorg-gtest.pc.in
@@ -2,7 +2,7 @@ prefix=@prefix@
includedir=@includedir@
sourcedir=@SOURCEDIR@
datarootdir=@datarootdir@
-CPPflags=-I${includedir} -I${sourcedir} -DDUMMY_CONF_PATH=\"@DUMMY_CONF_PATH@\"
+CPPflags=-I${includedir} -I${includedir}/xorg -I${sourcedir} -DDUMMY_CONF_PATH=\"@DUMMY_CONF_PATH@\"
Name: xorg-gtest
Description: X.org Google Test Environment