Add gtest support
This commit is contained in:
12
Makefile
12
Makefile
@@ -2,6 +2,7 @@ UNAME=$(shell uname | tr A-Z a-z)
|
|||||||
LIBPREFIX=lib
|
LIBPREFIX=lib
|
||||||
LIBSUFFIX=a
|
LIBSUFFIX=a
|
||||||
ROOTDIR=$(PWD)
|
ROOTDIR=$(PWD)
|
||||||
|
HAVE_GTEST=Yes
|
||||||
|
|
||||||
# Configurations
|
# Configurations
|
||||||
ifeq ($(BUILDTYPE), Release)
|
ifeq ($(BUILDTYPE), Release)
|
||||||
@@ -24,7 +25,7 @@ ASMFLAGS += -DNO_DYNAMIC_VP -DNOPREFIX
|
|||||||
|
|
||||||
|
|
||||||
#### No user-serviceable parts below this line
|
#### No user-serviceable parts below this line
|
||||||
INCLUDES = -Icodec/api/svc -Icodec/common
|
INCLUDES = -Icodec/api/svc -Icodec/common -Igtest/include
|
||||||
ASM_INCLUDES = -Iprocessing/src/asm/
|
ASM_INCLUDES = -Iprocessing/src/asm/
|
||||||
|
|
||||||
COMMON_INCLUDES = \
|
COMMON_INCLUDES = \
|
||||||
@@ -49,6 +50,8 @@ H264DEC_LDFLAGS = -L. -ldecoder -lcommon
|
|||||||
H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
|
H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
|
||||||
H264ENC_LDFLAGS = -L. -lencoder -lprocessing -lcommon
|
H264ENC_LDFLAGS = -L. -lencoder -lprocessing -lcommon
|
||||||
|
|
||||||
|
CODEC_UNITTEST_LDFLAGS = -L. -lgtest
|
||||||
|
|
||||||
all: libraries binaries
|
all: libraries binaries
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@@ -62,5 +65,12 @@ include processing/targets.mk
|
|||||||
include codec/console/dec/targets.mk
|
include codec/console/dec/targets.mk
|
||||||
include codec/console/enc/targets.mk
|
include codec/console/enc/targets.mk
|
||||||
|
|
||||||
|
ifdef HAVE_GTEST
|
||||||
|
include gtest/targets.mk
|
||||||
|
include test/targets.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,3 +6,5 @@
|
|||||||
|
|
||||||
(cd codec/console/dec; python ../../../build/mktargets.py --directory codec/console/dec --binary h264dec --exclude dec_console.h --exclude load_bundle_functions.cpp)
|
(cd codec/console/dec; python ../../../build/mktargets.py --directory codec/console/dec --binary h264dec --exclude dec_console.h --exclude load_bundle_functions.cpp)
|
||||||
(cd codec/console/enc; python ../../../build/mktargets.py --directory codec/console/enc --binary h264enc --exclude enc_console.h --exclude bundlewelsenc.cpp)
|
(cd codec/console/enc; python ../../../build/mktargets.py --directory codec/console/enc --binary h264enc --exclude enc_console.h --exclude bundlewelsenc.cpp)
|
||||||
|
(cd test; python ../build/mktargets.py --directory test --binary codec_unittest)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ COMMON_CPP_SRCS=\
|
|||||||
$(COMMON_SRCDIR)/./logging.cpp\
|
$(COMMON_SRCDIR)/./logging.cpp\
|
||||||
|
|
||||||
COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.o)
|
COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.o)
|
||||||
ifdef USE_ASM
|
ifeq ($(USE_ASM), Yes)
|
||||||
COMMON_ASM_SRCS=\
|
COMMON_ASM_SRCS=\
|
||||||
|
|
||||||
COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.o)
|
COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.o)
|
||||||
|
|||||||
7
test/simple_test.cpp
Normal file
7
test/simple_test.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
||||||
21
test/targets.mk
Normal file
21
test/targets.mk
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
CODEC_UNITTEST_PREFIX=CODEC_UNITTEST
|
||||||
|
CODEC_UNITTEST_SRCDIR=test
|
||||||
|
CODEC_UNITTEST_CPP_SRCS=\
|
||||||
|
$(CODEC_UNITTEST_SRCDIR)/./simple_test.cpp\
|
||||||
|
|
||||||
|
CODEC_UNITTEST_OBJS += $(CODEC_UNITTEST_CPP_SRCS:.cpp=.o)
|
||||||
|
ifeq ($(USE_ASM), Yes)
|
||||||
|
CODEC_UNITTEST_ASM_SRCS=\
|
||||||
|
|
||||||
|
CODEC_UNITTEST_OBJS += $(CODEC_UNITTEST_ASM_SRCS:.asm=.o)
|
||||||
|
endif
|
||||||
|
|
||||||
|
OBJS += $(CODEC_UNITTEST_OBJS)
|
||||||
|
$(CODEC_UNITTEST_SRCDIR)/./simple_test.o: $(CODEC_UNITTEST_SRCDIR)/./simple_test.cpp
|
||||||
|
$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c -o $(CODEC_UNITTEST_SRCDIR)/./simple_test.o $(CODEC_UNITTEST_SRCDIR)/./simple_test.cpp
|
||||||
|
|
||||||
|
codec_unittest: $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS)
|
||||||
|
$(CXX) -o $@ $(CODEC_UNITTEST_OBJS) $(CODEC_UNITTEST_LDFLAGS) $(CODEC_UNITTEST_LIBS) $(LDFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
binaries: codec_unittest
|
||||||
|
BINARIES += codec_unittest
|
||||||
Reference in New Issue
Block a user