mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
Merge pull request #1837 from wasphin/feature/cmake-fix-sctp
修正启用 SCTP 后编译问题
This commit is contained in:
commit
9ea98642c1
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
|
run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
|
||||||
|
|
||||||
- name: apt-get安装依赖库(非必选)
|
- name: apt-get安装依赖库(非必选)
|
||||||
run: sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev libswscale-dev libresample-dev
|
run: sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev libswscale-dev libresample-dev libusrsctp-dev
|
||||||
|
|
||||||
- name: 下载 SRTP
|
- name: 下载 SRTP
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -35,12 +35,17 @@ include_directories(SYSTEM ${SRTP_INCLUDE_DIRS})
|
|||||||
|
|
||||||
set(LINK_LIBRARIES ${SRTP_LIBRARIES})
|
set(LINK_LIBRARIES ${SRTP_LIBRARIES})
|
||||||
|
|
||||||
|
set(COMPILE_DEFINITIONS)
|
||||||
|
set(INCLUDE_DIRECTORIES)
|
||||||
|
|
||||||
find_package(SCTP QUIET)
|
find_package(SCTP QUIET)
|
||||||
if(SCTP_FOUND)
|
if(SCTP_FOUND)
|
||||||
message(STATUS "found library: ${SCTP_INCLUDE_DIRS} ${SCTP_LIBRARIES}")
|
message(STATUS "found library: ${SCTP_INCLUDE_DIRS} ${SCTP_LIBRARIES}")
|
||||||
include_directories(SYSTEM ${SCTP_INCLUDE_DIRS})
|
include_directories(SYSTEM ${SCTP_INCLUDE_DIRS})
|
||||||
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_SCTP)
|
# TODO: 避免暴露 SCTP 到 WebRTC 模块外
|
||||||
update_cached_list(LINK_LIBRARIES ${SCTP_LIBRARIES})
|
list(APPEND COMPILE_DEFINITIONS ENABLE_SCTP)
|
||||||
|
list(APPEND INCLUDE_DIRECTORIES ${SCTP_INCLUDE_DIRS})
|
||||||
|
list(APPEND LINK_LIBRARIES ${SCTP_LIBRARIES})
|
||||||
message(STATUS "WebRTC datachannel 功能已打开")
|
message(STATUS "WebRTC datachannel 功能已打开")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -50,19 +55,22 @@ file(GLOB WEBRTC_SRC_LIST
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
|
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
|
||||||
add_library(webrtc ${WEBRTC_SRC_LIST})
|
add_library(webrtc ${WEBRTC_SRC_LIST})
|
||||||
add_library(ZLMediaKit::WebRTC ALIAS webrtc)
|
add_library(ZLMediaKit::WebRTC ALIAS webrtc)
|
||||||
|
target_compile_definitions(webrtc
|
||||||
|
# ENABLE_SCTP 暂时需要暴露
|
||||||
|
PUBLIC ${COMPILE_DEFINITIONS})
|
||||||
target_compile_options(webrtc
|
target_compile_options(webrtc
|
||||||
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||||
target_link_libraries(webrtc
|
target_link_libraries(webrtc
|
||||||
PRIVATE
|
PRIVATE
|
||||||
ZLMediaKit::MediaKit
|
ZLMediaKit::MediaKit
|
||||||
ZLMediaKit::ToolKit
|
ZLMediaKit::ToolKit
|
||||||
PUBLIC
|
|
||||||
${LINK_LIBRARIES})
|
${LINK_LIBRARIES})
|
||||||
target_include_directories(webrtc
|
target_include_directories(webrtc
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>"
|
||||||
|
${INCLUDE_DIRECTORIES})
|
||||||
|
|
||||||
message(STATUS "WebRTC 功能已开启")
|
message(STATUS "WebRTC 功能已开启")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user