diff options
-rw-r--r-- | Makefile.in | 22 | ||||
-rw-r--r-- | Makefile.include.in | 6 | ||||
-rw-r--r-- | configure.in | 36 | ||||
-rw-r--r-- | xbmc/threads/test/Makefile | 4 | ||||
-rw-r--r-- | xbmc/utils/test/Makefile | 4 |
5 files changed, 65 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in index cef82b880a..2b25695a01 100644 --- a/Makefile.in +++ b/Makefile.in @@ -241,6 +241,7 @@ FINAL_TARGETS=xbmc.bin skins xbmc-xrandr endif FINAL_TARGETS+=Makefile externals +GTEST_DIR = lib/gtest CHECK_DIRS = xbmc/utils/test \ xbmc/threads/test @@ -252,7 +253,8 @@ all : $(FINAL_TARGETS) include Makefile.include .PHONY : dllloader exports visualizations screensavers eventclients papcodecs \ - dvdpcodecs imagelib codecs externals force skins libaddon + dvdpcodecs imagelib codecs externals force skins libaddon check \ + testframework testsuite # hack targets to keep build system up to date Makefile : config.status $(addsuffix .in, $(AUTOGENERATED_MAKEFILES)) @@ -573,5 +575,21 @@ clean-codecs: clean-dvdpcodecs clean-papcodecs clean-externals: clean-codecs clean-eventclients clean-xbmctex clean-libs \ clean-screensavers clean-visualisations clean-libaddons -check: +ifeq (1,@GTEST_CONFIGURED@) +check: testsuite for d in $(CHECK_DIRS); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done + +testsuite: testframework + for d in $(CHECK_DIRS); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done + +testframework: $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a + +$(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a: $(GTEST_DIR)/Makefile + +$(GTEST_DIR)/Makefile: force + $(MAKE) -C $(GTEST_DIR) +else +# Give a message that the framework is not configured, but don't fail. +check testsuite testframework: + @echo "Google Test Framework not configured, skipping testsuite check." +endif diff --git a/Makefile.include.in b/Makefile.include.in index 704a4bc7f2..5772d67da7 100644 --- a/Makefile.include.in +++ b/Makefile.include.in @@ -125,7 +125,7 @@ GEN_DEPS=\ && $(GEN_DEPS) -.PHONY : lib pch clean distclean distclean_evil +.PHONY : lib pch clean distclean distclean_evil check testsuite $(LIB): $(OBJS) $(SILENT_AR) $(AR) $(ARFLAGS) $(LIB) $(OBJS) @@ -136,11 +136,11 @@ pch: $(PCH:.h=.h.gch) clean: $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(CLEAN_FILES) $(PCH:.h=.h.gch) $(DEPS) for d in $(DIRS); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" clean); fi ); done - for d in $(CHECK_DIRS); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done + for d in $(CHECK_DIRS) $(GTEST_DIR); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done distclean: $(RM) $(OBJS) *.o $(LIB) $(SLIB) $(STATICLIB) $(CLEAN_FILES) $(DISTCLEAN_FILES) $(PCH:.h=.h.gch) $(DEPS) for d in $(DIRS); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" distclean || $(MAKE) -C "$$d" clean); fi ); done - for d in $(CHECK_DIRS); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" $@ || $(MAKE) -C "$$d" clean); fi ); done + for d in $(CHECK_DIRS) $(GTEST_DIR); do (if test -f "$$d/Makefile"; then ($(MAKE) -C "$$d" $@ || $(MAKE) -C "$$d" clean); fi ); done if [ "$(shell pwd -P)" = "$(abs_top_srcdir)" ] || \ [ "$(shell pwd)" = "$(abs_top_srcdir)" ]; then rm -f $(AUTOGENERATED_MAKEFILES) Makefile.include Makefile; fi diff --git a/configure.in b/configure.in index f283ed680e..e35c2feb8b 100644 --- a/configure.in +++ b/configure.in @@ -146,6 +146,8 @@ alsa_not_found="== Could not find ALSA. ALSA support disabled. ==" dbus_not_found="== Could not find DBUS. DBUS support disabled. ==" libcap_disabled="== Capabilities detection support disabled. ==" libcap_not_found="== Could not find libcap. Capabilities detection support disabled. ==" +gtest_enabled="== Google Test Framework will be configured. ==" +gtest_disabled="== Google Test Framework will not be configured. ==" libudev_not_found="== Could not find libudev. Will use polling to check for device changes. ==" libudev_disabled="== udev support disabled. Will use polling to check for device changes. ==" @@ -486,6 +488,12 @@ AC_ARG_ENABLE([player], [add_players=$enableval], [add_players=no]) +AC_ARG_ENABLE([gtest], + [AS_HELP_STRING([--enable-gtest], + [configure Google Test Framework (default is no)])], + [configure_gtest=$enableval], + [configure_gtest=no]) + ### External libraries options AC_ARG_ENABLE([external-libraries], [AS_HELP_STRING([--enable-external-libraries], @@ -2018,6 +2026,19 @@ if test "$host_vendor" = "apple"; then DVDREAD_CFLAGS="$DVDREAD_CFLAGS -D__DARWIN__" fi +# Google Test Framework +if test "$configure_gtest" = "yes"; then + AC_MSG_NOTICE($gtest_enabled) + final_message="$final_message\n Google Test Framework Configured:\tYes" + GTEST_CONFIGURED=1 + SKIP_CONFIG_GTEST=0 +else + AC_MSG_NOTICE($gtest_disabled) + final_message="$final_message\n Google Test Framework Configured:\tNo" + GTEST_CONFIGURED=0 + SKIP_CONFIG_GTEST=1 +fi + if test "$use_avahi" = "yes"; then final_message="$final_message\n Avahi:\tYes" else @@ -2321,6 +2342,7 @@ AC_SUBST(USE_CEC_RPI_API) AC_SUBST(USE_MYSQL) AC_SUBST(USE_WEB_SERVER) AC_SUBST(USE_ANDROID) +AC_SUBST(GTEST_CONFIGURED) # pushd and popd are not available in other shells besides bash, so implement @@ -2636,6 +2658,20 @@ XB_CONFIG_MODULE([lib/cpluff], [ #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress" ], [0]) +XB_CONFIG_MODULE([lib/gtest], [ + ./configure \ + CC="$CC" \ + CXX="$CXX" \ + CFLAGS="$CFLAGS" \ + --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \ + --host=$host_alias \ + --build=$build_alias \ + --target=$target_alias \ + --disable-shared \ + --enable-static \ + --with-pthreads +], [$SKIP_CONFIG_GTEST]) + AC_OUTPUT final_message="$final_message\n prefix:\t$prefix\n$dashes" diff --git a/xbmc/threads/test/Makefile b/xbmc/threads/test/Makefile index 93a0f38b76..43954667af 100644 --- a/xbmc/threads/test/Makefile +++ b/xbmc/threads/test/Makefile @@ -10,9 +10,11 @@ LIB=threadTest.a CLEAN_FILES=testMain -check: testMain +check: testsuite ./testMain +testsuite: testMain + include ../../../Makefile.include -include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) diff --git a/xbmc/utils/test/Makefile b/xbmc/utils/test/Makefile index 4756f8c382..720ddd93b3 100644 --- a/xbmc/utils/test/Makefile +++ b/xbmc/utils/test/Makefile @@ -6,9 +6,11 @@ LIB=utilsTest.a CLEAN_FILES=testMain -check: testMain +check: testsuite ./testMain +testsuite: testMain + include ../../../Makefile.include -include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) |