[libdatachannel] Fix dependency not found (#35618)

This commit is contained in:
jim wang 2024-01-04 08:56:55 +08:00 committed by GitHub
parent 64e15f6669
commit 8810558616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 95 additions and 5 deletions

View File

@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f604628..1610166 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,7 +239,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)
@@ -250,7 +250,7 @@ if(SCTP_DEBUG)
endif()
if(USE_SYSTEM_USRSCTP)
- find_package(Usrsctp REQUIRED)
+ find_package(unofficial-usrsctp CONFIG REQUIRED)
else()
option(sctp_build_shared_lib OFF)
option(sctp_build_programs OFF)
@@ -294,7 +294,7 @@ target_include_directories(datachannel PUBLIC
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 PRIVATE Threads::Threads)
-target_link_libraries(datachannel PRIVATE Usrsctp::Usrsctp plog::plog)
+target_link_libraries(datachannel PRIVATE unofficial::usrsctp::usrsctp plog::plog)
target_include_directories(datachannel-static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@@ -302,7 +302,7 @@ target_include_directories(datachannel-static PUBLIC
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 PRIVATE Threads::Threads)
-target_link_libraries(datachannel-static PRIVATE Usrsctp::Usrsctp plog::plog)
+target_link_libraries(datachannel-static PRIVATE unofficial::usrsctp::usrsctp plog::plog)
if(WIN32)
target_link_libraries(datachannel PUBLIC ws2_32) # winsock2

View File

@ -10,7 +10,9 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 2c8da820ebf6751d696645092ea5e562f7cb303d4f5cec9a8ca8e69b65321e79cc8a645095a4ecea710f5afd54499e71f4cdf261a0a2e32e28aef96a50ace28c
HEAD_REF master
PATCHES ${PATCHES}
PATCHES
${PATCHES}
fix_dependency.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" DATACHANNEL_STATIC_LINKAGE)
@ -44,6 +46,8 @@ include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(OpenSSL)
find_dependency(LibJuice)
find_dependency(plog CONFIG)
find_dependency(libSRTP CONFIG)
${DATACHANNEL_CONFIG}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

View File

@ -1,6 +1,7 @@
{
"name": "libdatachannel",
"version-semver": "0.19.4",
"port-version": 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",
"license": "MPL-2.0",

View File

@ -0,0 +1,28 @@
diff --git a/usrsctplib/CMakeLists.txt b/usrsctplib/CMakeLists.txt
index aa99cf2..c60b393 100644
--- a/usrsctplib/CMakeLists.txt
+++ b/usrsctplib/CMakeLists.txt
@@ -174,7 +174,8 @@ list(APPEND usrsctp_sources
add_library(usrsctp ${usrsctp_sources} ${usrsctp_headers})
-target_include_directories(usrsctp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(usrsctp PUBLIC $<INSTALL_INTERFACE:include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
if (WIN32)
message(STATUS "link library: ws2_32")
@@ -188,8 +189,12 @@ set_target_properties(usrsctp PROPERTIES SOVERSION ${SOVERSION_SHORT} VERSION ${
# INSTALL LIBRARY AND HEADER
#################################################
-install(TARGETS usrsctp DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(TARGETS usrsctp EXPORT unofficial-usrsctp-config
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin)
install(FILES usrsctp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install(EXPORT unofficial-usrsctp-config NAMESPACE unofficial::usrsctp:: DESTINATION share/unofficial-usrsctp)
#################################################
# GENERATE AND INSTALL PKG-CONFIG FILE

View File

@ -6,6 +6,8 @@ vcpkg_from_github(
REF 0.9.5.0
SHA512 7b28706449f9365ba9750fd39925e7171516a1e3145d123ec69a12486637ae2393ad4c587b056403298dc13c149f0b01a262cbe4852abca42e425d7680c77ee3
HEAD_REF master
PATCHES
fix_export.patch
)
vcpkg_cmake_configure(
@ -23,4 +25,5 @@ configure_file("${SOURCE_PATH}/LICENSE.md" "${CURRENT_PACKAGES_DIR}/share/usrsct
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT})

View File

@ -1,7 +1,7 @@
{
"name": "usrsctp",
"version": "0.9.5.0",
"port-version": 2,
"port-version": 3,
"description": "A userland SCTP stack supporting FreeBSD, Linux, Mac OS X and Windows.",
"homepage": "https://github.com/sctplab/usrsctp",
"license": "BSD-3-Clause",
@ -9,6 +9,10 @@
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -4186,7 +4186,7 @@
},
"libdatachannel": {
"baseline": "0.19.4",
"port-version": 0
"port-version": 1
},
"libdatrie": {
"baseline": "0.2.13",
@ -8746,7 +8746,7 @@
},
"usrsctp": {
"baseline": "0.9.5.0",
"port-version": 2
"port-version": 3
},
"utf8-range": {
"baseline": "2023-11-09",

View File

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

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7c30cd146c1f7b69d5a8f43fbb615e3bbb42b6ee",
"version": "0.9.5.0",
"port-version": 3
},
{
"git-tree": "8ac1cb14a09660bf33bd8f3dc7727bcf8080ae02",
"version": "0.9.5.0",