Skip to content

Commit 8810558

Browse files
authored
[libdatachannel] Fix dependency not found (microsoft#35618)
1 parent 64e15f6 commit 8810558

File tree

9 files changed

+95
-5
lines changed

9 files changed

+95
-5
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index f604628..1610166 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -239,7 +239,7 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
6+
find_package(Threads REQUIRED)
7+
8+
if(USE_SYSTEM_PLOG)
9+
- find_package(plog REQUIRED)
10+
+ find_package(plog CONFIG REQUIRED)
11+
else()
12+
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
13+
add_subdirectory(deps/plog EXCLUDE_FROM_ALL)
14+
@@ -250,7 +250,7 @@ if(SCTP_DEBUG)
15+
endif()
16+
17+
if(USE_SYSTEM_USRSCTP)
18+
- find_package(Usrsctp REQUIRED)
19+
+ find_package(unofficial-usrsctp CONFIG REQUIRED)
20+
else()
21+
option(sctp_build_shared_lib OFF)
22+
option(sctp_build_programs OFF)
23+
@@ -294,7 +294,7 @@ target_include_directories(datachannel PUBLIC
24+
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
25+
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
26+
target_link_libraries(datachannel PRIVATE Threads::Threads)
27+
-target_link_libraries(datachannel PRIVATE Usrsctp::Usrsctp plog::plog)
28+
+target_link_libraries(datachannel PRIVATE unofficial::usrsctp::usrsctp plog::plog)
29+
30+
target_include_directories(datachannel-static PUBLIC
31+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
32+
@@ -302,7 +302,7 @@ target_include_directories(datachannel-static PUBLIC
33+
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
34+
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
35+
target_link_libraries(datachannel-static PRIVATE Threads::Threads)
36+
-target_link_libraries(datachannel-static PRIVATE Usrsctp::Usrsctp plog::plog)
37+
+target_link_libraries(datachannel-static PRIVATE unofficial::usrsctp::usrsctp plog::plog)
38+
39+
if(WIN32)
40+
target_link_libraries(datachannel PUBLIC ws2_32) # winsock2

ports/libdatachannel/portfile.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ vcpkg_from_github(
1010
REF "v${VERSION}"
1111
SHA512 2c8da820ebf6751d696645092ea5e562f7cb303d4f5cec9a8ca8e69b65321e79cc8a645095a4ecea710f5afd54499e71f4cdf261a0a2e32e28aef96a50ace28c
1212
HEAD_REF master
13-
PATCHES ${PATCHES}
13+
PATCHES
14+
${PATCHES}
15+
fix_dependency.patch
1416
)
1517

1618
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" DATACHANNEL_STATIC_LINKAGE)
@@ -44,6 +46,8 @@ include(CMakeFindDependencyMacro)
4446
find_dependency(Threads)
4547
find_dependency(OpenSSL)
4648
find_dependency(LibJuice)
49+
find_dependency(plog CONFIG)
50+
find_dependency(libSRTP CONFIG)
4751
${DATACHANNEL_CONFIG}")
4852

4953
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

ports/libdatachannel/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "libdatachannel",
33
"version-semver": "0.19.4",
4+
"port-version": 1,
45
"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.",
56
"homepage": "https://github.com/paullouisageneau/libdatachannel",
67
"license": "MPL-2.0",

ports/usrsctp/fix_export.patch

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/usrsctplib/CMakeLists.txt b/usrsctplib/CMakeLists.txt
2+
index aa99cf2..c60b393 100644
3+
--- a/usrsctplib/CMakeLists.txt
4+
+++ b/usrsctplib/CMakeLists.txt
5+
@@ -174,7 +174,8 @@ list(APPEND usrsctp_sources
6+
7+
add_library(usrsctp ${usrsctp_sources} ${usrsctp_headers})
8+
9+
-target_include_directories(usrsctp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
10+
+target_include_directories(usrsctp PUBLIC $<INSTALL_INTERFACE:include>
11+
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
12+
13+
if (WIN32)
14+
message(STATUS "link library: ws2_32")
15+
@@ -188,8 +189,12 @@ set_target_properties(usrsctp PROPERTIES SOVERSION ${SOVERSION_SHORT} VERSION ${
16+
# INSTALL LIBRARY AND HEADER
17+
#################################################
18+
19+
-install(TARGETS usrsctp DESTINATION ${CMAKE_INSTALL_LIBDIR})
20+
+install(TARGETS usrsctp EXPORT unofficial-usrsctp-config
21+
+ ARCHIVE DESTINATION lib
22+
+ LIBRARY DESTINATION lib
23+
+ RUNTIME DESTINATION bin)
24+
install(FILES usrsctp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
25+
+install(EXPORT unofficial-usrsctp-config NAMESPACE unofficial::usrsctp:: DESTINATION share/unofficial-usrsctp)
26+
27+
#################################################
28+
# GENERATE AND INSTALL PKG-CONFIG FILE

ports/usrsctp/portfile.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ vcpkg_from_github(
66
REF 0.9.5.0
77
SHA512 7b28706449f9365ba9750fd39925e7171516a1e3145d123ec69a12486637ae2393ad4c587b056403298dc13c149f0b01a262cbe4852abca42e425d7680c77ee3
88
HEAD_REF master
9+
PATCHES
10+
fix_export.patch
911
)
1012

1113
vcpkg_cmake_configure(
@@ -23,4 +25,5 @@ configure_file("${SOURCE_PATH}/LICENSE.md" "${CURRENT_PACKAGES_DIR}/share/usrsct
2325

2426
vcpkg_copy_pdbs()
2527

26-
vcpkg_fixup_pkgconfig()
28+
vcpkg_fixup_pkgconfig()
29+
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT})

ports/usrsctp/vcpkg.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
{
22
"name": "usrsctp",
33
"version": "0.9.5.0",
4-
"port-version": 2,
4+
"port-version": 3,
55
"description": "A userland SCTP stack supporting FreeBSD, Linux, Mac OS X and Windows.",
66
"homepage": "https://github.com/sctplab/usrsctp",
77
"license": "BSD-3-Clause",
88
"dependencies": [
99
{
1010
"name": "vcpkg-cmake",
1111
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
1216
}
1317
]
1418
}

versions/baseline.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4186,7 +4186,7 @@
41864186
},
41874187
"libdatachannel": {
41884188
"baseline": "0.19.4",
4189-
"port-version": 0
4189+
"port-version": 1
41904190
},
41914191
"libdatrie": {
41924192
"baseline": "0.2.13",
@@ -8746,7 +8746,7 @@
87468746
},
87478747
"usrsctp": {
87488748
"baseline": "0.9.5.0",
8749-
"port-version": 2
8749+
"port-version": 3
87508750
},
87518751
"utf8-range": {
87528752
"baseline": "2023-11-09",

versions/l-/libdatachannel.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "b3364c6dfb715277d483a8e0410a98fe84a65345",
5+
"version-semver": "0.19.4",
6+
"port-version": 1
7+
},
38
{
49
"git-tree": "3e45715d7c64f9b22c87aff96594979f11e872a7",
510
"version-semver": "0.19.4",

versions/u-/usrsctp.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "7c30cd146c1f7b69d5a8f43fbb615e3bbb42b6ee",
5+
"version": "0.9.5.0",
6+
"port-version": 3
7+
},
38
{
49
"git-tree": "8ac1cb14a09660bf33bd8f3dc7727bcf8080ae02",
510
"version": "0.9.5.0",

0 commit comments

Comments
 (0)