From 80f315f1ae98bfe5e4c532c27114d8855be669bd Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 29 Mar 2020 17:29:09 +0800 Subject: [PATCH] Support utest on mac osx --- trunk/auto/depends.sh | 4 ++-- trunk/auto/options.sh | 4 ---- trunk/auto/setup_variables.sh | 2 +- trunk/auto/utest.sh | 3 --- trunk/configure | 5 +++++ 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 454990507..d001a8aa0 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -334,10 +334,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then ln -sf .src/$file $file; done && # Link source files under .src/xxx, the first child dir. - for dir in `(cd .src && find . -type d|grep '\./'|grep -v Linux|grep -v Darwin)`; do + for dir in `(cd .src && find . -maxdepth 1 -type d|grep '\./'|grep -v Linux|grep -v Darwin)`; do mkdir -p $dir && for file in `(cd .src/$dir && find . -maxdepth 1 -type f ! -name '*.o' ! -name '*.d')`; do - ln -sf .src/$dir/$file $dir/$file; + ln -sf ../.src/$dir/$file $dir/$file; done; done && # Build source code. diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index b3eec6712..d6a52d83d 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -573,10 +573,6 @@ function check_option_conflicts() { echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker"; exit -1; fi - if [[ $SRS_OSX == YES && $SRS_UTEST == YES ]]; then - echo "Mac does not support utest."; exit -1; - fi - # TODO: FIXME: check more os. __check_ok=YES diff --git a/trunk/auto/setup_variables.sh b/trunk/auto/setup_variables.sh index c144c68f5..7a39fd166 100755 --- a/trunk/auto/setup_variables.sh +++ b/trunk/auto/setup_variables.sh @@ -13,7 +13,7 @@ echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SR # For src object files on each platform. ( mkdir -p ${SRS_OBJS_DIR} && cd ${SRS_OBJS_DIR} && - rm -rf src utest srs research include lib srs_hls_ingester srs_mp4_parser && + rm -rf src utest srs srs_utest research include lib srs_hls_ingester srs_mp4_parser && mkdir -p ${SRS_PLATFORM}/src && ln -sf ${SRS_PLATFORM}/src && mkdir -p ${SRS_PLATFORM}/utest && ln -sf ${SRS_PLATFORM}/utest && mkdir -p ${SRS_PLATFORM}/research && ln -sf ${SRS_PLATFORM}/research && diff --git a/trunk/auto/utest.sh b/trunk/auto/utest.sh index 7dcde25af..b359d4211 100755 --- a/trunk/auto/utest.sh +++ b/trunk/auto/utest.sh @@ -20,9 +20,6 @@ SRS_TRUNK_PREFIX=../../.. # gest dir, relative to objs/utest, it's trunk/objs/gtest GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest -# the extra defines to compile utest. -EXTRA_DEFINES="" - cat << END > ${FILE} # user must run make the ${SRS_OBJS_DIR}/utest dir # at the same dir of Makefile. diff --git a/trunk/configure b/trunk/configure index d3750ba8b..3566c7816 100755 --- a/trunk/configure +++ b/trunk/configure @@ -314,6 +314,11 @@ if [ $SRS_LIBRTMP = YES ]; then MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}" BUILD_KEY="librtmp" LIB_NAME="lib/srs_librtmp" . auto/libs.sh fi +# For utest on mac. +# @see https://github.com/protocolbuffers/protobuf/issues/51#issuecomment-111044468 +if [[ $SRS_OSX == YES ]]; then + EXTRA_DEFINES="-DGTEST_USE_OWN_TR1_TUPLE=1" +fi # # utest, the unit-test cases of srs, base on gtest1.6 if [ $SRS_UTEST = YES ]; then