1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

UTest: Upgrade gtest to 1.11 and support clion. (#2970)

This commit is contained in:
Winlin 2022-03-17 16:56:52 +08:00 committed by GitHub
parent c5cc79ee6f
commit 350c05c589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 40318 additions and 31 deletions

View file

@ -811,22 +811,21 @@ fi
# build utest code
#####################################################################################
if [ $SRS_UTEST = YES ]; then
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/gtest-1.6.0/include/gtest/gtest.h ]]; then
echo "The gtest-1.6.0 is ok.";
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/gtest-fit/googletest/include/gtest/gtest.h ]]; then
echo "The gtest-fit is ok.";
else
echo "Build gtest-1.6.0";
echo "Build gtest-fit";
(
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/gtest-1.6.0 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
unzip -q ../../3rdparty/gtest-1.6.0.zip &&
rm -rf gtest && ln -sf gtest-1.6.0 gtest
cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf gtest-fit && cp -R ../../3rdparty/gtest-fit gtest-fit
rm -rf gtest && ln -sf gtest-fit/googletest gtest
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-fit failed, ret=$ret"; exit $ret; fi
# Always update the links.
(cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf gtest && ln -sf gtest-1.6.0 gtest)
(cd ${SRS_OBJS} && rm -rf gtest && ln -sf ${SRS_PLATFORM}/gtest-1.6.0 gtest)
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "Build gtest-1.6.0 failed."; exit -1; fi
(cd ${SRS_OBJS}/${SRS_PLATFORM} && rm -rf gtest && ln -sf gtest-fit/googletest gtest)
(cd ${SRS_OBJS} && rm -rf gtest && ln -sf ${SRS_PLATFORM}/gtest-fit/googletest gtest)
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "Build gtest-fit failed."; exit -1; fi
fi
#####################################################################################

View file

@ -53,6 +53,8 @@ CPPFLAGS += -I\$(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += ${CXXFLAGS} ${UTEST_EXTRA_DEFINES} -Wno-unused-private-field -Wno-unused-command-line-argument
# Always use C++11 for gtest required, see https://github.com/google/googletest
CXXFLAGS += -std=c++11
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.