mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Fixed CMakeLists and updated workflows
This commit is contained in:
4
.github/workflows/build-gnutls.yml
vendored
4
.github/workflows/build-gnutls.yml
vendored
@ -12,11 +12,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install packages
|
||||
run: sudo apt update && sudo apt install libgnutls28-dev nettle-dev
|
||||
run: sudo apt update && sudo apt install libgnutls28-dev nettle-dev libsrtp2-dev
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_GNUTLS=1 -DWARNINGS_AS_ERRORS=1
|
||||
run: cmake -B build -DUSE_GNUTLS=1 -DUSE_SYSTEM_SRTP=1 -DWARNINGS_AS_ERRORS=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
|
16
.github/workflows/build-nice.yml
vendored
16
.github/workflows/build-nice.yml
vendored
@ -7,7 +7,7 @@ on:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
build-linux:
|
||||
build-media:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -21,4 +21,18 @@ jobs:
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
run: ./build/tests
|
||||
build-no-media:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install packages
|
||||
run: sudo apt update && sudo apt install libgnutls28-dev libnice-dev
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_GNUTLS=1 -DUSE_NICE=1 -DNO_MEDIA=1 -DWARNINGS_AS_ERRORS=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
run: ./build/tests
|
||||
|
||||
|
4
.github/workflows/build-openssl.yml
vendored
4
.github/workflows/build-openssl.yml
vendored
@ -12,11 +12,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: install packages
|
||||
run: sudo apt update && sudo apt install libssl-dev
|
||||
run: sudo apt update && sudo apt install libssl-dev libsrtp2-dev
|
||||
- name: submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: cmake
|
||||
run: cmake -B build -DUSE_GNUTLS=0 -DWARNINGS_AS_ERRORS=1
|
||||
run: cmake -B build -DUSE_GNUTLS=0 -DUSE_SYSTEM_SRTP=1 -DWARNINGS_AS_ERRORS=1
|
||||
- name: make
|
||||
run: (cd build; make -j2)
|
||||
- name: test
|
||||
|
@ -7,15 +7,14 @@ set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
|
||||
# Options
|
||||
option(USE_GNUTLS "Use GnuTLS instead of OpenSSL" OFF)
|
||||
option(USE_NICE "Use libnice instead of libjuice" OFF)
|
||||
option(USE_SYSTEM_SRTP "Use system libSRTP" OFF)
|
||||
option(NO_WEBSOCKET "Disable WebSocket support" OFF)
|
||||
option(NO_MEDIA "Disable media transport support" OFF)
|
||||
option(NO_EXAMPLES "Disable examples" OFF)
|
||||
option(NO_TESTS "Disable tests build" OFF)
|
||||
option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
|
||||
option(RSA_KEY_BITS_2048 "Use 2048-bit RSA key instead of 3072-bit" OFF)
|
||||
option(CAPI_STDCALL "Set calling convention of C API callbacks stdcall" OFF)
|
||||
# Option USE_SRTP defaults to AUTO (enabled if libSRTP is found, else disabled)
|
||||
set(USE_SRTP AUTO CACHE STRING "Use libSRTP and enable media support")
|
||||
set_property(CACHE USE_SRTP PROPERTY STRINGS AUTO ON OFF)
|
||||
|
||||
if(USE_NICE)
|
||||
option(USE_JUICE "Use libjuice" OFF)
|
||||
@ -90,6 +89,7 @@ set(LIBDATACHANNEL_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/reliability.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtc.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtc.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtp.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/track.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/websocket.hpp
|
||||
)
|
||||
@ -102,7 +102,7 @@ set(TESTS_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/capi_track.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/websocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/benchmark.cpp
|
||||
include/rtc/rtp.hpp)
|
||||
)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
@ -166,41 +166,32 @@ if(WIN32)
|
||||
target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
|
||||
endif()
|
||||
|
||||
if(USE_SRTP STREQUAL "AUTO")
|
||||
find_package(SRTP)
|
||||
if(SRTP_FOUND)
|
||||
message(STATUS "LibSRTP found, compiling with media transport")
|
||||
else()
|
||||
message(STATUS "LibSRTP NOT found, compiling WITHOUT media transport")
|
||||
endif()
|
||||
elseif (USE_SRTP STREQUAL "COMPILE")
|
||||
message(STATUS "Compiling LibSRTP from source; compiling with media transport")
|
||||
add_subdirectory(deps/libsrtp EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
target_compile_definitions(datachannel PUBLIC RTC_SRTP_FROM_SOURCE=1)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_SRTP_FROM_SOURCE=1)
|
||||
target_link_libraries(datachannel PRIVATE srtp2)
|
||||
target_link_libraries(datachannel-static PRIVATE srtp2)
|
||||
elseif(USE_SRTP)
|
||||
find_package(SRTP REQUIRED)
|
||||
endif()
|
||||
|
||||
if(USE_SRTP AND SRTP_FOUND)
|
||||
if(NOT TARGET SRTP::SRTP)
|
||||
add_library(SRTP::SRTP UNKNOWN IMPORTED)
|
||||
set_target_properties(SRTP::SRTP PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SRTP_INCLUDE_DIRS}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
||||
IMPORTED_LOCATION ${SRTP_LIBRARIES})
|
||||
endif()
|
||||
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
target_link_libraries(datachannel PRIVATE SRTP::SRTP)
|
||||
target_link_libraries(datachannel-static PRIVATE SRTP::SRTP)
|
||||
elseif (NOT USE_SRTP STREQUAL "COMPILE")
|
||||
if(NO_MEDIA)
|
||||
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
|
||||
else()
|
||||
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
|
||||
if(USE_SYSTEM_SRTP)
|
||||
find_package(SRTP REQUIRED)
|
||||
if(NOT TARGET SRTP::SRTP)
|
||||
add_library(SRTP::SRTP UNKNOWN IMPORTED)
|
||||
set_target_properties(SRTP::SRTP PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SRTP_INCLUDE_DIRS}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
||||
IMPORTED_LOCATION ${SRTP_LIBRARIES})
|
||||
endif()
|
||||
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_SRTP=1)
|
||||
target_compile_definitions(datachannel-static PRIVATE RTC_SYSTEM_SRTP=1)
|
||||
target_link_libraries(datachannel PRIVATE SRTP::SRTP)
|
||||
target_link_libraries(datachannel-static PRIVATE SRTP::SRTP)
|
||||
else()
|
||||
add_subdirectory(deps/libsrtp EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_SRTP=0)
|
||||
target_compile_definitions(datachannel-static PRIVATE RTC_SYSTEM_SRTP=0)
|
||||
target_link_libraries(datachannel PRIVATE srtp2)
|
||||
target_link_libraries(datachannel-static PRIVATE srtp2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (USE_GNUTLS)
|
||||
|
@ -24,11 +24,12 @@
|
||||
|
||||
#if RTC_ENABLE_MEDIA
|
||||
|
||||
#ifdef RTC_SRTP_FROM_SOURCE
|
||||
#include "srtp.h"
|
||||
#else
|
||||
#if RTC_SYSTEM_SRTP
|
||||
#include <srtp2/srtp.h>
|
||||
#else
|
||||
#include "srtp.h"
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace rtc {
|
||||
|
Reference in New Issue
Block a user