mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Added RTC_ENABLE_MEDIA guard
This commit is contained in:
@ -28,6 +28,7 @@ set(LIBDATACHANNEL_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/configuration.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/datachannel.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/description.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/dtlssrtptransport.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/dtlstransport.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/icetransport.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/init.cpp
|
||||
@ -81,6 +82,7 @@ set(TESTS_ANSWERER_SOURCES
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(SRTP)
|
||||
|
||||
add_subdirectory(deps/usrsctp EXCLUDE_FROM_ALL)
|
||||
if (MSYS OR MINGW)
|
||||
@ -137,39 +139,56 @@ if(WIN32)
|
||||
target_link_libraries(datachannel-static "wsock32" "ws2_32") # winsock2
|
||||
endif()
|
||||
|
||||
if(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 SRTP::SRTP)
|
||||
target_link_libraries(datachannel-static SRTP::SRTP)
|
||||
else()
|
||||
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
|
||||
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
|
||||
endif()
|
||||
|
||||
if (USE_GNUTLS)
|
||||
find_package(GnuTLS REQUIRED)
|
||||
if(NOT TARGET GnuTLS::GnuTLS)
|
||||
add_library(GnuTLS::GnuTLS UNKNOWN IMPORTED)
|
||||
set_target_properties(GnuTLS::GnuTLS PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GNUTLS_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_DEFINITIONS "${GNUTLS_DEFINITIONS}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${GNUTLS_LIBRARIES}")
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GNUTLS_INCLUDE_DIRS}
|
||||
INTERFACE_COMPILE_DEFINITIONS ${GNUTLS_DEFINITIONS}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
||||
IMPORTED_LOCATION ${GNUTLS_LIBRARIES})
|
||||
endif()
|
||||
target_compile_definitions(datachannel PRIVATE USE_GNUTLS=1)
|
||||
target_link_libraries(datachannel GnuTLS::GnuTLS)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_GNUTLS=1)
|
||||
target_link_libraries(datachannel GnuTLS::GnuTLS)
|
||||
target_link_libraries(datachannel-static GnuTLS::GnuTLS)
|
||||
else()
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_compile_definitions(datachannel PRIVATE USE_GNUTLS=0)
|
||||
target_link_libraries(datachannel OpenSSL::SSL)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_GNUTLS=0)
|
||||
target_link_libraries(datachannel OpenSSL::SSL)
|
||||
target_link_libraries(datachannel-static OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
if (USE_JUICE)
|
||||
add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(datachannel PRIVATE USE_JUICE=1)
|
||||
target_link_libraries(datachannel LibJuice::LibJuiceStatic)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_JUICE=1)
|
||||
target_link_libraries(datachannel LibJuice::LibJuiceStatic)
|
||||
target_link_libraries(datachannel-static LibJuice::LibJuiceStatic)
|
||||
else()
|
||||
find_package(LibNice REQUIRED)
|
||||
target_compile_definitions(datachannel PRIVATE USE_JUICE=0)
|
||||
target_link_libraries(datachannel LibNice::LibNice)
|
||||
target_compile_definitions(datachannel-static PRIVATE USE_JUICE=0)
|
||||
target_link_libraries(datachannel LibNice::LibNice)
|
||||
target_link_libraries(datachannel-static LibNice::LibNice)
|
||||
endif()
|
||||
|
||||
|
1
Jamfile
1
Jamfile
@ -10,6 +10,7 @@ lib libdatachannel
|
||||
<cxxstd>17
|
||||
<include>./include/rtc
|
||||
<define>USE_JUICE=1
|
||||
<define>RTC_ENABLE_MEDIA=0
|
||||
<define>RTC_ENABLE_WEBSOCKET=0
|
||||
<library>/libdatachannel//usrsctp
|
||||
<library>/libdatachannel//juice
|
||||
|
8
Makefile
8
Makefile
@ -38,6 +38,14 @@ else
|
||||
LIBS+=glib-2.0 gobject-2.0 nice
|
||||
endif
|
||||
|
||||
RTC_ENABLE_MEDIA ?= 0
|
||||
ifneq ($(RTC_ENABLE_MEDIA), 0)
|
||||
CPPFLAGS+=-DRTC_ENABLE_MEDIA=1
|
||||
LIBS+=srtp
|
||||
else
|
||||
CPPFLAGS+=-DRTC_ENABLE_MEDIA=0
|
||||
endif
|
||||
|
||||
RTC_ENABLE_WEBSOCKET ?= 1
|
||||
ifneq ($(RTC_ENABLE_WEBSOCKET), 0)
|
||||
CPPFLAGS+=-DRTC_ENABLE_WEBSOCKET=1
|
||||
|
@ -19,6 +19,10 @@
|
||||
#ifndef RTC_INCLUDE_H
|
||||
#define RTC_INCLUDE_H
|
||||
|
||||
#ifndef RTC_ENABLE_MEDIA
|
||||
#define RTC_ENABLE_MEDIA 1
|
||||
#endif
|
||||
|
||||
#ifndef RTC_ENABLE_WEBSOCKET
|
||||
#define RTC_ENABLE_WEBSOCKET 1
|
||||
#endif
|
||||
|
@ -27,6 +27,10 @@ extern "C" {
|
||||
|
||||
// libdatachannel C API
|
||||
|
||||
#ifndef RTC_ENABLE_MEDIA
|
||||
#define RTC_ENABLE_MEDIA 1
|
||||
#endif
|
||||
|
||||
#ifndef RTC_ENABLE_WEBSOCKET
|
||||
#define RTC_ENABLE_WEBSOCKET 1
|
||||
#endif
|
||||
|
@ -19,11 +19,11 @@
|
||||
#include "dtlssrtptransport.hpp"
|
||||
#include "tls.hpp"
|
||||
|
||||
#if RTC_ENABLE_MEDIA
|
||||
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
|
||||
#include <srtp2/srtp.h>
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::to_string;
|
||||
|
||||
@ -180,3 +180,5 @@ void DtlsSrtpTransport::postHandshake() {
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "dtlstransport.hpp"
|
||||
#include "include.hpp"
|
||||
|
||||
#if RTC_ENABLE_MEDIA
|
||||
|
||||
#include <srtp2/srtp.h>
|
||||
|
||||
namespace rtc {
|
||||
@ -50,3 +52,5 @@ private:
|
||||
} // namespace rtc
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,10 +16,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "tcptransport.hpp"
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include <exception>
|
||||
#ifndef _WIN32
|
||||
#include <fcntl.h>
|
||||
|
@ -19,12 +19,12 @@
|
||||
#ifndef RTC_TCP_TRANSPORT_H
|
||||
#define RTC_TCP_TRANSPORT_H
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "include.hpp"
|
||||
#include "queue.hpp"
|
||||
#include "transport.hpp"
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
|
@ -16,11 +16,11 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "tlstransport.hpp"
|
||||
#include "tcptransport.hpp"
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
|
@ -19,14 +19,13 @@
|
||||
#ifndef RTC_TLS_TRANSPORT_H
|
||||
#define RTC_TLS_TRANSPORT_H
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "include.hpp"
|
||||
#include "queue.hpp"
|
||||
#include "tls.hpp"
|
||||
#include "transport.hpp"
|
||||
|
||||
#include <memory>
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
|
@ -16,14 +16,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "wstransport.hpp"
|
||||
#include "tcptransport.hpp"
|
||||
#include "tlstransport.hpp"
|
||||
|
||||
#include "base64.hpp"
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include <chrono>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
@ -19,11 +19,11 @@
|
||||
#ifndef RTC_WS_TRANSPORT_H
|
||||
#define RTC_WS_TRANSPORT_H
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
#include "include.hpp"
|
||||
#include "transport.hpp"
|
||||
|
||||
#if RTC_ENABLE_WEBSOCKET
|
||||
|
||||
namespace rtc {
|
||||
|
||||
class TcpTransport;
|
||||
|
Reference in New Issue
Block a user