vcpkg/ports/libdatachannel/fix-for-vcpkg.patch
Nemirtingas 9555c11202
[libdatachannel] Add new port (#13704)
* libdatachannel port

* Fixed various things for pr.

* Update to v0.9.2

* Update to 0.9.4 and enable SRTP feature

* Add openssl dependency

* Fix usrsctp find_library

* Flip the sense of the websockets feature and use a manifest instead of CONTROL file.

* Need to update libjuice and libdatachannel but there is now a USE_SRTP option.

* Update libdatachannel for USE_SRTP Option

* Update libdatachannel to v0.10.1

Co-authored-by: Nemirtingas <nanaki89@hotmail.fr>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2020-11-23 10:50:37 -08:00

111 lines
4.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bed634b..fced56e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,28 +112,18 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
-add_subdirectory(deps/plog)
-
-option(sctp_build_programs 0)
-option(sctp_build_shared_lib 0)
-add_subdirectory(deps/usrsctp EXCLUDE_FROM_ALL)
-if (MSYS OR MINGW)
- target_compile_definitions(usrsctp PUBLIC -DSCTP_STDINT_INCLUDE=<stdint.h>)
-endif()
-if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- target_compile_options(usrsctp PRIVATE -Wno-error=format-truncation)
-endif()
-add_library(Usrsctp::Usrsctp ALIAS usrsctp)
+find_library(USRSCTP_LIBRARY usrsctp REQUIRED)
+find_path(PLOG_INCLUDE_DIRS "plog/Appenders/AndroidAppender.h")
if (NO_WEBSOCKET)
- add_library(datachannel SHARED
+ add_library(datachannel
${LIBDATACHANNEL_SOURCES})
add_library(datachannel-static STATIC EXCLUDE_FROM_ALL
${LIBDATACHANNEL_SOURCES})
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_WEBSOCKET=0)
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_WEBSOCKET=0)
else()
- add_library(datachannel SHARED
+ add_library(datachannel
${LIBDATACHANNEL_SOURCES}
${LIBDATACHANNEL_WEBSOCKET_SOURCES})
add_library(datachannel-static STATIC EXCLUDE_FROM_ALL
@@ -150,17 +140,17 @@ set_target_properties(datachannel-static PROPERTIES
VERSION ${PROJECT_VERSION}
CXX_STANDARD 17)
-target_include_directories(datachannel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
+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_link_libraries(datachannel PUBLIC Threads::Threads plog::plog)
-target_link_libraries(datachannel PRIVATE Usrsctp::Usrsctp)
+target_include_directories(datachannel PRIVATE ${PLOG_INCLUDE_DIRS})
+target_link_libraries(datachannel PUBLIC Threads::Threads ${USRSCTP_LIBRARY})
target_include_directories(datachannel-static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/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_link_libraries(datachannel-static PUBLIC Threads::Threads plog::plog)
-target_link_libraries(datachannel-static PRIVATE Usrsctp::Usrsctp)
+target_include_directories(datachannel-static PRIVATE ${PLOG_INCLUDE_DIRS})
+target_link_libraries(datachannel-static PUBLIC Threads::Threads ${USRSCTP_LIBRARY})
if(WIN32)
target_link_libraries(datachannel PRIVATE ws2_32) # winsock2
@@ -224,11 +214,11 @@ if (USE_NICE OR NOT USE_JUICE)
target_link_libraries(datachannel PRIVATE LibNice::LibNice)
target_link_libraries(datachannel-static PRIVATE LibNice::LibNice)
else()
- add_subdirectory(deps/libjuice EXCLUDE_FROM_ALL)
+ find_package(libjuice CONFIG REQUIRED)
target_compile_definitions(datachannel PRIVATE USE_NICE=0)
target_compile_definitions(datachannel-static PRIVATE USE_NICE=0)
- target_link_libraries(datachannel PRIVATE LibJuice::LibJuiceStatic)
- target_link_libraries(datachannel-static PRIVATE LibJuice::LibJuiceStatic)
+ target_link_libraries(datachannel PRIVATE LibJuice::juice)
+ target_link_libraries(datachannel-static PRIVATE LibJuice::juice)
endif()
if(RSA_KEY_BITS_2048)
@@ -244,7 +234,11 @@ endif()
add_library(LibDataChannel::LibDataChannel ALIAS datachannel)
add_library(LibDataChannel::LibDataChannelStatic ALIAS datachannel-static)
-install(TARGETS datachannel LIBRARY DESTINATION lib)
+install(TARGETS datachannel EXPORT libdatachannel-config
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
install(FILES ${LIBDATACHANNEL_HEADERS} DESTINATION include/rtc)
if(NOT MSVC)
@@ -306,3 +300,8 @@ if(NOT NO_EXAMPLES AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
add_subdirectory(examples/copy-paste-capi)
endif()
+install(
+ EXPORT libdatachannel-config
+ NAMESPACE LibDatachannel::
+ DESTINATION share/cmake/libdatachannel
+)
diff --git a/src/tcptransport.hpp b/src/tcptransport.hpp
index 1447835..1c92686 100644
--- a/src/tcptransport.hpp
+++ b/src/tcptransport.hpp
@@ -29,7 +29,7 @@
#include <thread>
// Use the socket defines from libjuice
-#include "../deps/libjuice/src/socket.h"
+#include <juice/src/socket.h>
namespace rtc {