调整cmake

This commit is contained in:
ziyue 2021-04-06 18:30:36 +08:00
parent 9c552128a7
commit b5bf930467
3 changed files with 19 additions and 22 deletions

View File

@ -225,10 +225,23 @@ if(ENABLE_API)
add_subdirectory(api)
endif()
if(ENABLE_WEBRTC)
add_definitions(-DENABLE_WEBRTC)
add_subdirectory(webrtc)
endif()
if (ENABLE_WEBRTC)
#srtp
find_package(SRTP QUIET)
if (SRTP_FOUND)
message(STATUS "found library:${SRTP_LIBRARIES}")
include_directories(${SRTP_INCLUDE_DIRS})
list(APPEND LINK_LIB_LIST ${SRTP_LIBRARIES})
add_definitions(-DENABLE_WEBRTC)
include_directories(./webrtc)
file(GLOB SRC_WEBRTC_LIST ./webrtc/*.cpp ./webrtc/*.h ./webrtc/*.hpp)
add_library(webrtc ${SRC_WEBRTC_LIST})
list(APPEND LINK_LIB_LIST webrtc)
else ()
message(WARNING "srtp未找到, webrtc相关功能打开失败")
endif ()
endif ()
if (NOT IOS)
#

View File

@ -32,7 +32,7 @@ set(_SRTP_ROOT_PATHS
find_path(SRTP_INCLUDE_DIRS
NAMES srtp2/srtp.h
HINTS _SRTP_ROOT_PATHS
HINTS _SRTP_ROOT_PATHS ${SRTP_PREFIX}
PATH_SUFFIXES include
)
@ -42,7 +42,7 @@ endif()
find_library(SRTP_LIBRARIES
NAMES srtp2
HINTS ${_SRTP_ROOT_PATHS}
HINTS ${_SRTP_ROOT_PATHS} ${SRTP_PREFIX}
PATH_SUFFIXES bin lib
)

View File

@ -1,16 +0,0 @@
list(APPEND LINK_LIB_LIST webrtc)
#srtp
find_package(SRTP QUIET)
if (SRTP_FOUND)
message(STATUS "found library:${SRTP_LIBRARIES}")
include_directories(${SRTP_INCLUDE_DIRS})
list(APPEND LINK_LIB_LIST ${SRTP_LIBRARIES})
else ()
message(FATAL_ERROR "srtp未找到!")
endif ()
include_directories(./)
file(GLOB SRC_LIST ./*.cpp ./*.h ./*.hpp)
add_library(webrtc ${SRC_LIST})
set(LINK_LIB_LIST ${LINK_LIB_LIST} PARENT_SCOPE)