[libdatachannel] Update to 0.19.4 (#35450)

This commit is contained in:
Sergey Podobry 2023-12-05 03:20:43 +02:00 committed by GitHub
parent d5eafb41cd
commit 544daf445a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 280 deletions

View File

@ -1,266 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 634f242..c8e2f1e 100644
index a3837943..2c34d7fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,6 @@ endif()
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(BUILD_SHARED_LIBS OFF) # to force usrsctp to be built static
if(WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
@@ -202,12 +201,14 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
-set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
-add_subdirectory(deps/plog EXCLUDE_FROM_ALL)
+find_library(USRSCTP_LIBRARY usrsctp REQUIRED)
+find_path(PLOG_INCLUDE_DIRS "plog/Appenders/AndroidAppender.h")
if(SCTP_DEBUG)
add_definitions(-DSCTP_DEBUG)
@@ -446,11 +446,25 @@ if(WARNINGS_AS_ERRORS)
endif()
endif()
+if(DATACHANNEL_STATIC_LINKAGE)
+set_target_properties(datachannel PROPERTIES EXCLUDE_FROM_ALL 1)
+set_target_properties(datachannel-static PROPERTIES EXCLUDE_FROM_ALL 0)
+
+if(0)
option(sctp_build_shared_lib OFF)
option(sctp_build_programs OFF)
option(sctp_inet OFF)
@@ -221,7 +222,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(usrsctp PRIVATE -Wno-error=format-truncation)
endif()
add_library(Usrsctp::Usrsctp ALIAS usrsctp)
+endif()
+if(BUILD_SHARED_LIBS)
add_library(datachannel SHARED
${LIBDATACHANNEL_SOURCES}
${LIBDATACHANNEL_HEADERS}
@@ -234,7 +237,8 @@ set_target_properties(datachannel PROPERTIES
CXX_VISIBILITY_PRESET default)
target_compile_definitions(datachannel PRIVATE RTC_EXPORTS)
-add_library(datachannel-static STATIC EXCLUDE_FROM_ALL
+elseif(BUILD_STATIC_LIBS)
+add_library(datachannel-static STATIC
${LIBDATACHANNEL_SOURCES}
${LIBDATACHANNEL_HEADERS}
${LIBDATACHANNEL_IMPL_SOURCES}
@@ -244,42 +248,63 @@ set_target_properties(datachannel-static PROPERTIES
CXX_STANDARD 17)
target_compile_definitions(datachannel-static PRIVATE RTC_EXPORTS)
target_compile_definitions(datachannel-static PUBLIC RTC_STATIC)
+endif()
+if(BUILD_SHARED_LIBS)
target_include_directories(datachannel PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
+target_include_directories(datachannel PRIVATE ${PLOG_INCLUDE_DIRS})
target_link_libraries(datachannel PRIVATE Threads::Threads)
-target_link_libraries(datachannel PRIVATE Usrsctp::Usrsctp plog::plog)
+target_link_libraries(datachannel PRIVATE ${USRSCTP_LIBRARY})
+elseif(BUILD_STATIC_LIBS)
target_include_directories(datachannel-static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
+target_include_directories(datachannel-static PRIVATE ${PLOG_INCLUDE_DIRS})
target_link_libraries(datachannel-static PRIVATE Threads::Threads)
-target_link_libraries(datachannel-static PRIVATE Usrsctp::Usrsctp plog::plog)
+target_link_libraries(datachannel-static PRIVATE ${USRSCTP_LIBRARY})
+endif()
if(WIN32)
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PUBLIC ws2_32) # winsock2
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PUBLIC ws2_32) # winsock2
+ endif()
endif()
if (NO_WEBSOCKET)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_WEBSOCKET=0)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_WEBSOCKET=0)
+ endif()
else()
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_WEBSOCKET=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_WEBSOCKET=1)
+ endif()
endif()
if(NO_MEDIA)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
+ endif()
else()
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
+ endif()
if(USE_SYSTEM_SRTP)
find_package(libSRTP REQUIRED)
if(NOT TARGET libSRTP::srtp2)
@@ -289,10 +314,16 @@ else()
IMPORTED_LINK_INTERFACE_LANGUAGES C
IMPORTED_LOCATION ${SRTP_LIBRARIES})
endif()
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_SRTP=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE RTC_SYSTEM_SRTP=1)
+ endif()
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE libSRTP::srtp2)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE libSRTP::srtp2)
+ endif()
else()
add_subdirectory(deps/libsrtp EXCLUDE_FROM_ALL)
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_SRTP=0)
@@ -312,15 +343,24 @@ if (USE_GNUTLS)
IMPORTED_LINK_INTERFACE_LANGUAGES C
IMPORTED_LOCATION "${GNUTLS_LIBRARIES}")
endif()
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE USE_GNUTLS=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE USE_GNUTLS=1)
+ endif()
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE GnuTLS::GnuTLS)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE GnuTLS::GnuTLS)
+ endif()
if (NOT NO_WEBSOCKET)
# Needed for SHA1, it should be present as GnuTLS cryptography backend
find_package(Nettle REQUIRED)
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE Nettle::Nettle)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE Nettle::Nettle)
+ endif()
endif()
else()
if(APPLE)
@@ -340,27 +380,48 @@ else()
endif()
endif()
find_package(OpenSSL REQUIRED)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE USE_GNUTLS=0)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE USE_GNUTLS=0)
+ endif()
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE OpenSSL::SSL)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE OpenSSL::SSL)
+ endif()
endif()
if (USE_NICE)
find_package(LibNice REQUIRED)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE USE_NICE=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE USE_NICE=1)
+ endif()
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE LibNice::LibNice)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE LibNice::LibNice)
+ endif()
else()
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE USE_NICE=0)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE USE_NICE=0)
+ endif()
if(USE_SYSTEM_JUICE)
find_package(LibJuice REQUIRED)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_JUICE=1)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PRIVATE RTC_SYSTEM_JUICE=1)
+ endif()
+ if(BUILD_SHARED_LIBS)
target_link_libraries(datachannel PRIVATE LibJuice::LibJuice)
+ elseif(BUILD_STATIC_LIBS)
target_link_libraries(datachannel-static PRIVATE LibJuice::LibJuice)
+ endif()
else()
add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
target_compile_definitions(datachannel PRIVATE RTC_SYSTEM_JUICE=0)
@@ -371,36 +432,58 @@ else()
endif()
if(CAPI_STDCALL)
+ if(BUILD_SHARED_LIBS)
target_compile_definitions(datachannel PUBLIC CAPI_STDCALL)
+ elseif(BUILD_STATIC_LIBS)
target_compile_definitions(datachannel-static PUBLIC CAPI_STDCALL)
+ endif()
endif()
+if(BUILD_SHARED_LIBS)
set_target_properties(datachannel PROPERTIES EXPORT_NAME LibDataChannel)
add_library(LibDataChannel::LibDataChannel ALIAS datachannel)
-
+elseif(BUILD_STATIC_LIBS)
set_target_properties(datachannel-static PROPERTIES EXPORT_NAME LibDataChannelStatic)
add_library(LibDataChannel::LibDataChannelStatic ALIAS datachannel-static)
+endif()
if(NOT MSVC)
+ if(BUILD_SHARED_LIBS)
target_compile_options(datachannel PRIVATE -Wall -Wextra)
+ elseif(BUILD_STATIC_LIBS)
target_compile_options(datachannel-static PRIVATE -Wall -Wextra)
+ endif()
endif()
if(WARNINGS_AS_ERRORS)
if(MSVC)
+ if(BUILD_SHARED_LIBS)
target_compile_options(datachannel PRIVATE /WX)
+ elseif(BUILD_STATIC_LIBS)
target_compile_options(datachannel-static PRIVATE /WX)
+ endif()
else()
+ if(BUILD_SHARED_LIBS)
target_compile_options(datachannel PRIVATE -Werror)
+ elseif(BUILD_STATIC_LIBS)
target_compile_options(datachannel-static PRIVATE -Werror)
+ endif()
endif()
endif()
+if(BUILD_SHARED_LIBS)
install(TARGETS datachannel EXPORT LibDataChannelTargets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
+elseif(BUILD_STATIC_LIBS)
+install(TARGETS datachannel-static EXPORT LibDataChannelTargets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+else()
+set_target_properties(datachannel PROPERTIES EXCLUDE_FROM_ALL 0)
+set_target_properties(datachannel-static PROPERTIES EXCLUDE_FROM_ALL 1)
+
install(TARGETS datachannel EXPORT LibDataChannelTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+endif()
install(FILES ${LIBDATACHANNEL_HEADERS}
DESTINATION include/rtc
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rtc

View File

@ -8,14 +8,12 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO paullouisageneau/libdatachannel
REF "v${VERSION}"
SHA512 bcf58026612e2ae670911945f9f74660b513cbd38c9bae13e7b8acd41e545b5760ab4713c67b956e0bb8c0449491a5ab8e3f8d05e2468ff6540fc99e2540a105
SHA512 2c8da820ebf6751d696645092ea5e562f7cb303d4f5cec9a8ca8e69b65321e79cc8a645095a4ecea710f5afd54499e71f4cdf261a0a2e32e28aef96a50ace28c
HEAD_REF master
PATCHES
${PATCHES}
PATCHES ${PATCHES}
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" DATACHANNEL_STATIC_LINKAGE)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
@ -29,12 +27,10 @@ vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DUSE_SYSTEM_SRTP=ON
-DUSE_SYSTEM_JUICE=ON
-DPREFER_SYSTEM_LIB=ON
-DNO_EXAMPLES=ON
-DNO_TESTS=ON
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
-DBUILD_SHARED_LIBS=${BUILD_SHARED}
-DDATACHANNEL_STATIC_LINKAGE=${DATACHANNEL_STATIC_LINKAGE}
)
vcpkg_cmake_install()

View File

@ -1,17 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8e2f1e..1dfcd62 100644
index 2c34d7fb..1bedd212 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -471,6 +471,12 @@ if(WARNINGS_AS_ERRORS)
endif()
@@ -446,6 +446,9 @@ if(WARNINGS_AS_ERRORS)
endif()
endif()
+if(BUILD_SHARED_LIBS)
+ target_compile_options(datachannel PRIVATE /wd4996)
+elseif(BUILD_STATIC_LIBS)
+ target_compile_options(datachannel-static PRIVATE /wd4996)
+endif()
+target_compile_options(datachannel PRIVATE /wd4996)
+target_compile_options(datachannel-static PRIVATE /wd4996)
+
if(BUILD_SHARED_LIBS)
install(TARGETS datachannel EXPORT LibDataChannelTargets
RUNTIME DESTINATION bin
if(DATACHANNEL_STATIC_LINKAGE)
set_target_properties(datachannel PROPERTIES EXCLUDE_FROM_ALL 1)
set_target_properties(datachannel-static PROPERTIES EXCLUDE_FROM_ALL 0)

View File

@ -1,13 +1,13 @@
{
"name": "libdatachannel",
"version-semver": "0.18.6",
"port-version": 2,
"version-semver": "0.19.4",
"description": "libdatachannel is a standalone implementation of WebRTC Data Channels, WebRTC Media Transport, and WebSockets in C++17 with C bindings for POSIX platforms (including GNU/Linux, Android, and Apple macOS) and Microsoft Windows.",
"homepage": "https://github.com/paullouisageneau/libdatachannel",
"license": "MPL-2.0",
"supports": "!xbox",
"dependencies": [
"libjuice",
"nlohmann-json",
"openssl",
"plog",
"usrsctp",

View File

@ -4181,8 +4181,8 @@
"port-version": 0
},
"libdatachannel": {
"baseline": "0.18.6",
"port-version": 2
"baseline": "0.19.4",
"port-version": 0
},
"libdatrie": {
"baseline": "0.2.13",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3e45715d7c64f9b22c87aff96594979f11e872a7",
"version-semver": "0.19.4",
"port-version": 0
},
{
"git-tree": "3552621ddd4919b86e0b0333bf6530cc1402ec6f",
"version-semver": "0.18.6",