summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-03-08 14:18:39 -0800
committerChase Douglas <chase.douglas@canonical.com>2012-03-16 15:23:42 -0700
commit71f006cadac2bc7f249965896d898143d7592f12 (patch)
tree271b6a7491d58e3bce07be1d225d47b0697ee59e /examples
parentd02b5095dbe69b695034242a978c489aaef61109 (diff)
Build gtest as part of the project
Google Test does not recommend using precompiled gtest libraries. See: http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog This change modifies the build system so the examples build the gtest and xorg-gtest libraries and link against the locally built libraries instead of any other precompiled libraries on the system. It uses the same compiler flags to compile everything so the C++ One-Definition Rule is not broken. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-By: Christopher Halse Rogers <christopher.halse.rogers@canonical.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am42
1 files changed, 37 insertions, 5 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index fcaca2b..5c41732 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -24,12 +24,44 @@
# SOFTWARE.
#
-noinst_PROGRAMS = xorg-gtest-example
+check_LIBRARIES = libgtest.a libxorg-gtest.a libxorg-gtest_main.a
-xorg_gtest_example_SOURCES = xorg-gtest-example.cpp
+AM_CPPFLAGS = $(GTEST_CPPFLAGS)
+AM_CXXFLAGS = $(XSERVER_CFLAGS) $(BASE_CXXFLAGS)
+
+nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc
+libgtest_a_CPPFLAGS = $(AM_CPPFLAGS) -w
+libgtest_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
+
+libxorg_gtest_a_SOURCES = $(top_srcdir)/src/xorg-gtest-all.cpp
+libxorg_gtest_a_CPPFLAGS = \
+ $(AM_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_main_a_SOURCES = $(top_srcdir)/src/xorg-gtest_main.cpp
+libxorg_gtest_main_a_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)
+libxorg_gtest_main_a_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CXXFLAGS = $(XSERVER_CFLAGS) $(GTEST_CPPFLAGS) $(BASE_CXXFLAGS)
+check_PROGRAMS = xorg-gtest-example
+
+if ENABLE_XORG_GTEST_TESTS
+TESTS = $(check_PROGRAMS)
+endif
+
+xorg_gtest_example_SOURCES = xorg-gtest-example.cpp
-xorg_gtest_example_LDADD = $(top_builddir)/src/libxorg-gtest.la $(top_builddir)/src/libxorg-gtest_main.la -lgtest -lpthread -lX11
+xorg_gtest_example_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include
+xorg_gtest_example_LDADD = \
+ libgtest.a \
+ libxorg-gtest.a \
+ libxorg-gtest_main.a \
+ -lpthread \
+ $(XSERVER_LIBS) \
+ $(EVEMU_LIBS)