From db8d91cbeebd22a5ead9da3e6ee0bea742820c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E6=88=98?= Date: Thu, 11 Jun 2020 17:12:37 +0800 Subject: [PATCH] add c++14 support --- trunk/auto/auto_headers.sh | 6 ++++++ trunk/auto/options.sh | 9 +++++++++ trunk/configure | 3 +++ 3 files changed, 18 insertions(+) diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 6867c3945..fd4bf322d 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -75,6 +75,12 @@ else srs_undefine_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H fi +if [ $SRS_CXX14 = YES ]; then + srs_define_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H +fi + if [ $SRS_RTC = YES ]; then srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H else diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index ad592662e..ee2f6a42a 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -20,6 +20,7 @@ SRS_SRT=NO SRS_RTC=YES SRS_GB28181=NO SRS_CXX11=NO +SRS_CXX14=NO SRS_NGINX=NO SRS_FFMPEG_TOOL=NO SRS_LIBRTMP=NO @@ -151,6 +152,7 @@ Features: --rtc=on|off Whether build the WebRTC support for SRS. --gb28181=on|off Whether build the GB28181 support for SRS. --cxx11=on|off Whether enable the C++11 support for SRS. + --cxx14=on|off Whether enable the C++14 support for SRS. --prefix= The absolute installation path for srs. Default: $SRS_PREFIX --gcov=on|off Whether enable the GCOV compiler options. @@ -324,6 +326,7 @@ function parse_user_option() { --gb28181) if [[ $value == off ]]; then SRS_GB28181=NO; else SRS_GB28181=YES; fi ;; --cxx11) if [[ $value == off ]]; then SRS_CXX11=NO; else SRS_CXX11=YES; fi ;; + --cxx14) if [[ $value == off ]]; then SRS_CXX14=NO; else SRS_CXX14=YES; fi ;; --with-clean) SRS_CLEAN=YES ;; --without-clean) SRS_CLEAN=NO ;; @@ -523,6 +526,11 @@ function apply_user_presets() { if [[ $SRS_SRT == YES ]]; then SRS_CXX11=YES fi + + # Enable c++14 for RTC + if [[ $SRS_RTC == YES ]]; then + SRS_CXX14=YES + fi } apply_user_presets @@ -623,6 +631,7 @@ function regenerate_options() { if [ $SRS_SIMULATOR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=off"; fi if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=off"; fi if [ $SRS_CXX11 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=off"; fi + if [ $SRS_CXX14 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=off"; fi if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=off"; fi if [ $SRS_SRTP_ASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=off"; fi if [ $SRS_SENDMMSG = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=off"; fi diff --git a/trunk/configure b/trunk/configure index 5bf253747..68f661783 100755 --- a/trunk/configure +++ b/trunk/configure @@ -90,6 +90,9 @@ CppStd="-ansi" if [[ $SRS_CXX11 == YES ]]; then CppStd="-std=c++11" fi +if [[ $SRS_CXX14 == YES ]]; then + CppStd="-std=c++14" +fi # performance of gprof SrsGprof=""; SrsGprofLink=""; if [ $SRS_GPROF = YES ]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi # performance of gperf