diff options
| author | Nemirtingas <9432037+Nemirtingas@users.noreply.github.com> | 2020-11-23 19:50:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-23 10:50:37 -0800 |
| commit | 9555c112029cf2427a20dfec0eb946ff5315a23d (patch) | |
| tree | 8fa2ffa1951d09bd4f3958d7c47f931facd46ea4 | |
| parent | d9633d939c665e527f8bda22669f543f03540b17 (diff) | |
| download | vcpkg-9555c112029cf2427a20dfec0eb946ff5315a23d.tar.gz vcpkg-9555c112029cf2427a20dfec0eb946ff5315a23d.zip | |
[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>
| -rw-r--r-- | ports/libdatachannel/fix-for-vcpkg.patch | 110 | ||||
| -rw-r--r-- | ports/libdatachannel/portfile.cmake | 34 | ||||
| -rw-r--r-- | ports/libdatachannel/vcpkg.json | 26 |
3 files changed, 170 insertions, 0 deletions
diff --git a/ports/libdatachannel/fix-for-vcpkg.patch b/ports/libdatachannel/fix-for-vcpkg.patch new file mode 100644 index 000000000..fc6c26adf --- /dev/null +++ b/ports/libdatachannel/fix-for-vcpkg.patch @@ -0,0 +1,110 @@ +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 { + diff --git a/ports/libdatachannel/portfile.cmake b/ports/libdatachannel/portfile.cmake new file mode 100644 index 000000000..9fb73f372 --- /dev/null +++ b/ports/libdatachannel/portfile.cmake @@ -0,0 +1,34 @@ +vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO paullouisageneau/libdatachannel
+ REF v0.10.1
+ SHA512 195f564776b2a7ab6fe3a838d55be7fa03b72a5f08faaba5ddefac59ae1fff28f3ee0b9ed5dc17a7ef9155a1d30a61f8c593f2a108f60e415ffd213188e081bd
+ HEAD_REF master
+ PATCHES
+ fix-for-vcpkg.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ INVERTED_FEATURES
+ ws NO_WEBSOCKET
+ srtp NO_MEDIA
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DUSE_SYSTEM_SRTP=ON
+ -DNO_EXAMPLES=ON
+ -DNO_TESTS=ON
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/libdatachannel)
+vcpkg_fixup_pkgconfig()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/libdatachannel/vcpkg.json b/ports/libdatachannel/vcpkg.json new file mode 100644 index 000000000..79299fa5c --- /dev/null +++ b/ports/libdatachannel/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "libdatachannel", + "version-string": "v0.10.1", + "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", + "dependencies": [ + "libjuice", + "openssl", + "plog", + "usrsctp" + ], + "default-features": [ + "ws" + ], + "features": { + "srtp": { + "description": "Use Cisco's libSRTP for media transport.", + "dependencies": [ + "libsrtp" + ] + }, + "ws": { + "description": "Web Socket support" + } + } +} |
