|
@@ -7,15 +7,14 @@ set(PROJECT_DESCRIPTION "WebRTC Data Channels Library")
|
|
# Options
|
|
# Options
|
|
option(USE_GNUTLS "Use GnuTLS instead of OpenSSL" OFF)
|
|
option(USE_GNUTLS "Use GnuTLS instead of OpenSSL" OFF)
|
|
option(USE_NICE "Use libnice instead of libjuice" 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_WEBSOCKET "Disable WebSocket support" OFF)
|
|
|
|
+option(NO_MEDIA "Disable media transport support" OFF)
|
|
option(NO_EXAMPLES "Disable examples" OFF)
|
|
option(NO_EXAMPLES "Disable examples" OFF)
|
|
option(NO_TESTS "Disable tests build" OFF)
|
|
option(NO_TESTS "Disable tests build" OFF)
|
|
option(WARNINGS_AS_ERRORS "Treat warnings as errors" 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(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(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)
|
|
if(USE_NICE)
|
|
option(USE_JUICE "Use libjuice" OFF)
|
|
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/reliability.hpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtc.h
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtc.h
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/rtc.hpp
|
|
${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/track.hpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/rtc/websocket.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/capi_track.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/websocket.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/websocket.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/benchmark.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/test/benchmark.cpp
|
|
- include/rtc/rtp.hpp)
|
|
|
|
|
|
+)
|
|
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
@@ -166,41 +166,32 @@ if(WIN32)
|
|
target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
|
|
target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
|
|
endif()
|
|
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)
|
|
|
|
|
|
+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 PUBLIC RTC_ENABLE_MEDIA=1)
|
|
target_compile_definitions(datachannel-static 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})
|
|
|
|
|
|
+ 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()
|
|
- 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")
|
|
|
|
- target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
|
|
|
|
- target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
|
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
if (USE_GNUTLS)
|
|
if (USE_GNUTLS)
|