aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libdatachannel
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/libdatachannel')
-rw-r--r--vcpkg/ports/libdatachannel/dependencies.diff53
-rw-r--r--vcpkg/ports/libdatachannel/disable-pdb.patch13
-rw-r--r--vcpkg/ports/libdatachannel/portfile.cmake40
-rw-r--r--vcpkg/ports/libdatachannel/uwp-warnings.patch15
-rw-r--r--vcpkg/ports/libdatachannel/vcpkg.json40
5 files changed, 161 insertions, 0 deletions
diff --git a/vcpkg/ports/libdatachannel/dependencies.diff b/vcpkg/ports/libdatachannel/dependencies.diff
new file mode 100644
index 0000000..918a5a5
--- /dev/null
+++ b/vcpkg/ports/libdatachannel/dependencies.diff
@@ -0,0 +1,53 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8a61757..b35e4b1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -234,7 +234,7 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+ find_package(Threads REQUIRED)
+
+ if(USE_SYSTEM_PLOG)
+- find_package(plog REQUIRED)
++ find_package(plog CONFIG REQUIRED)
+ else()
+ set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
+ add_subdirectory(deps/plog EXCLUDE_FROM_ALL)
+@@ -245,7 +245,8 @@ if(SCTP_DEBUG)
+ endif()
+
+ if(USE_SYSTEM_USRSCTP)
+- find_package(Usrsctp REQUIRED)
++ find_package(unofficial-usrsctp CONFIG REQUIRED)
++ add_library(Usrsctp::Usrsctp ALIAS unofficial::usrsctp::usrsctp)
+ else()
+ option(sctp_build_shared_lib OFF)
+ option(sctp_build_programs OFF)
+@@ -331,7 +332,7 @@ else()
+ target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
+ target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
+ if(USE_SYSTEM_SRTP)
+- find_package(libSRTP REQUIRED)
++ find_package(libSRTP CONFIG REQUIRED)
+ if(NOT TARGET libSRTP::srtp2)
+ add_library(libSRTP::srtp2 UNKNOWN IMPORTED)
+ set_target_properties(libSRTP::srtp2 PROPERTIES
+diff --git a/cmake/LibDataChannelConfig.cmake b/cmake/LibDataChannelConfig.cmake
+index cb2b884..d0b77ca 100644
+--- a/cmake/LibDataChannelConfig.cmake.in
++++ b/cmake/LibDataChannelConfig.cmake.in
+@@ -1,3 +1,16 @@
+ @PACKAGE_INIT@
++if(NOT "@BUILD_SHARED_LIBS@")
++ include(CMakeFindDependencyMacro)
++ set(THREADS_PREFER_PTHREAD_FLAG ON)
++ find_dependency(Threads)
++ find_dependency(plog CONFIG)
++ find_dependency(unofficial-usrsctp CONFIG)
++ if(NOT "@NO_MEDIA@")
++ find_dependency(libSRTP CONFIG)
++ endif()
++ find_dependency(OpenSSL)
++ find_dependency(LibJuice)
++endif()
++
+
+ include("${CMAKE_CURRENT_LIST_DIR}/LibDataChannelTargets.cmake")
diff --git a/vcpkg/ports/libdatachannel/disable-pdb.patch b/vcpkg/ports/libdatachannel/disable-pdb.patch
new file mode 100644
index 0000000..c7ead08
--- /dev/null
+++ b/vcpkg/ports/libdatachannel/disable-pdb.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 015c973..e589518 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -520,7 +520,7 @@ install(TARGETS datachannel EXPORT LibDataChannelTargets
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ )
+
+-if(MSVC)
++if(MSVC AND BUILD_SHARED_LIBS)
+ install(FILES $<TARGET_PDB_FILE:datachannel>
+ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+ endif()
diff --git a/vcpkg/ports/libdatachannel/portfile.cmake b/vcpkg/ports/libdatachannel/portfile.cmake
new file mode 100644
index 0000000..c3cebf6
--- /dev/null
+++ b/vcpkg/ports/libdatachannel/portfile.cmake
@@ -0,0 +1,40 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO paullouisageneau/libdatachannel
+ REF "v${VERSION}"
+ SHA512 49e19e40874167ef505829841a8b944f8489cb7a15ff6e5a8d74c886c5ff28a32c2724871be2244c805dd6b0919878e06d31c43b27c8d242222adae8509e0d59
+ HEAD_REF master
+ PATCHES
+ dependencies.diff
+ uwp-warnings.patch
+ disable-pdb.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ stdcall CAPI_STDCALL
+ INVERTED_FEATURES
+ ws NO_WEBSOCKET
+ srtp NO_MEDIA
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DPREFER_SYSTEM_LIB=ON
+ -DNO_EXAMPLES=ON
+ -DNO_TESTS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/LibDataChannel)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/rtc/common.hpp" "#ifdef RTC_STATIC" "#if 1")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/rtc/rtc.h" "#ifdef RTC_STATIC" "#if 1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libdatachannel/uwp-warnings.patch b/vcpkg/ports/libdatachannel/uwp-warnings.patch
new file mode 100644
index 0000000..23d23dd
--- /dev/null
+++ b/vcpkg/ports/libdatachannel/uwp-warnings.patch
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1b5190b..763b49e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -315,6 +315,10 @@ target_link_libraries(datachannel-static PRIVATE Usrsctp::Usrsctp plog::plog)
+ if(WIN32)
+ target_link_libraries(datachannel PUBLIC ws2_32) # winsock2
+ target_link_libraries(datachannel-static PUBLIC ws2_32) # winsock2
++ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
++ target_compile_options(datachannel PRIVATE /wd4996)
++ target_compile_options(datachannel-static PRIVATE /wd4996)
++ endif()
+ endif()
+
+ if (NO_WEBSOCKET)
diff --git a/vcpkg/ports/libdatachannel/vcpkg.json b/vcpkg/ports/libdatachannel/vcpkg.json
new file mode 100644
index 0000000..fa4dbc1
--- /dev/null
+++ b/vcpkg/ports/libdatachannel/vcpkg.json
@@ -0,0 +1,40 @@
+{
+ "name": "libdatachannel",
+ "version-semver": "0.23.2",
+ "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",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "ws"
+ ],
+ "features": {
+ "srtp": {
+ "description": "Use Cisco's libSRTP for media transport.",
+ "dependencies": [
+ "libsrtp"
+ ]
+ },
+ "stdcall": {
+ "description": "Use stdcall convention in callbacks"
+ },
+ "ws": {
+ "description": "Web Socket support"
+ }
+ }
+}