From c14a777598318efc333416a107b63d9a0d8a34ac Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Thu, 28 Jul 2022 23:15:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=90=AF=E7=94=A8=20SCTP=20?= =?UTF-8?q?=E5=90=8E=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webrtc/CMakeLists.txt b/webrtc/CMakeLists.txt index 87daf5b3..251e4038 100644 --- a/webrtc/CMakeLists.txt +++ b/webrtc/CMakeLists.txt @@ -35,12 +35,17 @@ include_directories(SYSTEM ${SRTP_INCLUDE_DIRS}) set(LINK_LIBRARIES ${SRTP_LIBRARIES}) +set(COMPILE_DEFINITIONS) +set(INCLUDE_DIRECTORIES) + find_package(SCTP QUIET) if(SCTP_FOUND) message(STATUS "found library: ${SCTP_INCLUDE_DIRS} ${SCTP_LIBRARIES}") include_directories(SYSTEM ${SCTP_INCLUDE_DIRS}) - update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_SCTP) - update_cached_list(LINK_LIBRARIES ${SCTP_LIBRARIES}) + # TODO: 避免暴露 SCTP 到 WebRTC 模块外 + list(APPEND COMPILE_DEFINITIONS ENABLE_SCTP) + list(APPEND INCLUDE_DIRECTORIES ${SCTP_INCLUDE_DIRS}) + list(APPEND LINK_LIBRARIES ${SCTP_LIBRARIES}) message(STATUS "WebRTC datachannel 功能已打开") endif() @@ -50,19 +55,22 @@ file(GLOB WEBRTC_SRC_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) add_library(webrtc ${WEBRTC_SRC_LIST}) add_library(ZLMediaKit::WebRTC ALIAS webrtc) +target_compile_definitions(webrtc + # ENABLE_SCTP 暂时需要暴露 + PUBLIC ${COMPILE_DEFINITIONS}) target_compile_options(webrtc PRIVATE ${COMPILE_OPTIONS_DEFAULT}) target_link_libraries(webrtc PRIVATE ZLMediaKit::MediaKit ZLMediaKit::ToolKit - PUBLIC ${LINK_LIBRARIES}) target_include_directories(webrtc PRIVATE "$" PUBLIC - "$") + "$" + ${INCLUDE_DIRECTORIES}) message(STATUS "WebRTC 功能已开启")