From 3036e6abdf96c44c77cfbbc892e7eac9413f4d03 Mon Sep 17 00:00:00 2001 From: Gordon Date: Tue, 18 Oct 2022 06:20:38 +0800 Subject: [PATCH] fix mips compile error (#1532) * fix mips compile error * fix mips compile error * fix mips compile error --- CMake/Dependencies/libsrtp-CMakeLists.txt | 1 + CMake/Dependencies/libusrsctp-CMakeLists.txt | 4 +++- CMakeLists.txt | 17 +++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CMake/Dependencies/libsrtp-CMakeLists.txt b/CMake/Dependencies/libsrtp-CMakeLists.txt index b2491d786c..e74838185b 100644 --- a/CMake/Dependencies/libsrtp-CMakeLists.txt +++ b/CMake/Dependencies/libsrtp-CMakeLists.txt @@ -52,6 +52,7 @@ ExternalProject_Add(project_libsrtp -D ENABLE_OPENSSL=${LIBSRTP_ENABLE_OPENSSL} -D BUILD_SHARED_LIBS=${LIBSRTP_SHARED_LIBS} -D OPENSSL_ROOT_DIR=${OPEN_SRC_INSTALL_PREFIX} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} CONFIGURE_COMMAND ${CONFIGURE_COMMAND} TEST_COMMAND "" ) diff --git a/CMake/Dependencies/libusrsctp-CMakeLists.txt b/CMake/Dependencies/libusrsctp-CMakeLists.txt index bae5c8a435..5315a45a48 100644 --- a/CMake/Dependencies/libusrsctp-CMakeLists.txt +++ b/CMake/Dependencies/libusrsctp-CMakeLists.txt @@ -8,7 +8,9 @@ ExternalProject_Add(project_libusrsctp GIT_REPOSITORY https://github.com/sctplab/usrsctp.git GIT_TAG 1ade45cbadfd19298d2c47dc538962d4425ad2dd PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX} -DCMAKE_C_FLAGS=-fPIC -Dsctp_werror=0 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX} + "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -fPIC" + -Dsctp_werror=0 BUILD_ALWAYS TRUE TEST_COMMAND "" ) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3dc73f9e2..45d4db468f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,10 @@ endif() set(KINESIS_VIDEO_WEBRTC_CLIENT_SRC "${CMAKE_CURRENT_SOURCE_DIR}") +if(ADD_MUCLIBC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -muclibc") +endif() + message(STATUS "Kinesis Video WebRTC Client path is ${KINESIS_VIDEO_WEBRTC_CLIENT_SRC}") message(STATUS "dependencies install path is ${OPEN_SRC_INSTALL_PREFIX}") @@ -121,7 +125,7 @@ if(BUILD_DEPENDENCIES) set(OPENSSL_ROOT_DIR ${OPEN_SRC_INSTALL_PREFIX}) elseif(USE_MBEDTLS) set(BUILD_ARGS -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}) + "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -std=c99") build_dependency(mbedtls ${BUILD_ARGS}) endif() @@ -140,10 +144,14 @@ if(BUILD_DEPENDENCIES) -DBUILD_LIBSRTP_DESTINATION_PLATFORM=${BUILD_LIBSRTP_DESTINATION_PLATFORM} -DUSE_OPENSSL=${USE_OPENSSL} -DUSE_MBEDTLS=${USE_MBEDTLS} - ) + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}) + build_dependency(srtp ${BUILD_ARGS}) - build_dependency(usrsctp) + set(BUILD_ARGS + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}) + + build_dependency(usrsctp ${BUILD_ARGS}) if(BUILD_TEST) build_dependency(gtest) endif() @@ -218,9 +226,6 @@ link_directories(${OPEN_SRC_INSTALL_PREFIX}/lib) if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU|Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - if(ADD_MUCLIBC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -muclibc") - endif() if(CODE_COVERAGE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fprofile-arcs -ftest-coverage")