shithub: openh264

Download patch

ref: 8bb82769679bf274f4d53e0153099c5091274e09
parent: bc3c63c4319949a9da0257d4a195de43987a5db5
author: EKR <ekr@rtfm.com>
date: Thu Dec 12 07:24:55 EST 2013

Make gtest support conditional

--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,14 @@
 UNAME=$(shell uname | tr A-Z a-z)
 LIBPREFIX=lib
 LIBSUFFIX=a
+CP=cp
 ROOTDIR=$(PWD)
+
+ifeq (,wildcard ./gtest)
+HAVE_GTEST=No
+else
 HAVE_GTEST=Yes
+endif
 
 # Configurations
 ifeq ($(BUILDTYPE), Release)
@@ -50,13 +56,15 @@
 H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
 H264ENC_LDFLAGS = -L. -lencoder -lprocessing -lcommon
 
-CODEC_UNITTEST_LDFLAGS = -L. -lgtest
+CODEC_UNITTEST_LDFLAGS = -L. -lgtest -ldecoder -lcommon
 
-all:	libraries binaries
+all:	$(GTEST_TARGETS) libraries binaries
 
 clean:
 	rm -f $(OBJS) $(LIBRARIES) $(BINARIES)
 
+gtest-bootstrap:
+	svn co https://googletest.googlecode.com/svn/trunk/ gtest
 
 include codec/common/targets.mk
 include codec/decoder/targets.mk
@@ -65,10 +73,11 @@
 include codec/console/dec/targets.mk
 include codec/console/enc/targets.mk
 
-ifdef HAVE_GTEST
-include gtest/targets.mk
+ifeq ($(HAVE_GTEST),Yes)
+include build/gtest-targets.mk
 include test/targets.mk
 endif
+
 
 
 
--- /dev/null
+++ b/build/gtest-targets.mk
@@ -1,0 +1,19 @@
+GTEST_PREFIX=GTEST
+GTEST_SRCDIR=gtest
+GTEST_CPP_SRCS=\
+	$(GTEST_SRCDIR)/src/gtest-all.cc
+
+GTEST_OBJS += $(GTEST_CPP_SRCS:.cc=.o)
+
+OBJS += $(GTEST_OBJS)
+GTEST_INCLUDES += -Igtest
+
+$(GTEST_SRCDIR)/src/gtest-all.o: $(GTEST_SRCDIR)/src/gtest-all.cc
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(GTEST_CFLAGS) $(GTEST_INCLUDES) -c -o $(GTEST_SRCDIR)/src/gtest-all.o $(GTEST_SRCDIR)/src/gtest-all.cc
+
+$(LIBPREFIX)gtest.$(LIBSUFFIX): $(GTEST_OBJS)
+	rm -f $(LIBPREFIX)gtest.$(LIBSUFFIX)
+	ar cr $@ $(GTEST_OBJS)
+
+libraries: $(LIBPREFIX)gtest.$(LIBSUFFIX)
+LIBRARIES += $(LIBPREFIX)gtest.$(LIBSUFFIX)
--- a/gtest-targets.mk
+++ /dev/null
@@ -1,19 +1,0 @@
-GTEST_PREFIX=GTEST
-GTEST_SRCDIR=gtest
-GTEST_CPP_SRCS=\
-	$(GTEST_SRCDIR)/src/gtest-all.cc
-
-GTEST_OBJS += $(GTEST_CPP_SRCS:.cc=.o)
-
-OBJS += $(GTEST_OBJS)
-GTEST_INCLUDES += -Igtest
-
-$(GTEST_SRCDIR)/src/gtest-all.o: $(GTEST_SRCDIR)/src/gtest-all.cc
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(GTEST_CFLAGS) $(GTEST_INCLUDES) -c -o $(GTEST_SRCDIR)/src/gtest-all.o $(GTEST_SRCDIR)/src/gtest-all.cc
-
-$(LIBPREFIX)gtest.$(LIBSUFFIX): $(GTEST_OBJS)
-	rm -f $(LIBPREFIX)gtest.$(LIBSUFFIX)
-	ar cr $@ $(GTEST_OBJS)
-
-libraries: $(LIBPREFIX)gtest.$(LIBSUFFIX)
-LIBRARIES += $(LIBPREFIX)gtest.$(LIBSUFFIX)