[enet] Update to 1.3.18 (#41880)

Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
MonicaLiu 2024-11-01 05:51:49 +00:00 committed by GitHub
parent 6020d4118c
commit 8979c5049d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 43 additions and 115 deletions

View File

@ -1,106 +0,0 @@
cmake_minimum_required(VERSION 3.0.2)
project(enet)
# The "configure" step.
include(CheckFunctionExists)
include(CheckStructHasMember)
include(CheckTypeSize)
check_function_exists("fcntl" HAS_FCNTL)
check_function_exists("poll" HAS_POLL)
check_function_exists("getaddrinfo" HAS_GETADDRINFO)
check_function_exists("getnameinfo" HAS_GETNAMEINFO)
check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R)
check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R)
check_function_exists("inet_pton" HAS_INET_PTON)
check_function_exists("inet_ntop" HAS_INET_NTOP)
check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(MSVC)
add_definitions(-W3)
else()
add_definitions(-Wno-error)
endif()
if(HAS_FCNTL)
add_definitions(-DHAS_FCNTL=1)
endif()
if(HAS_POLL)
add_definitions(-DHAS_POLL=1)
endif()
if(HAS_GETNAMEINFO)
add_definitions(-DHAS_GETNAMEINFO=1)
endif()
if(HAS_GETADDRINFO)
add_definitions(-DHAS_GETADDRINFO=1)
endif()
if(HAS_GETHOSTBYNAME_R)
add_definitions(-DHAS_GETHOSTBYNAME_R=1)
endif()
if(HAS_GETHOSTBYADDR_R)
add_definitions(-DHAS_GETHOSTBYADDR_R=1)
endif()
if(HAS_INET_PTON)
add_definitions(-DHAS_INET_PTON=1)
endif()
if(HAS_INET_NTOP)
add_definitions(-DHAS_INET_NTOP=1)
endif()
if(HAS_MSGHDR_FLAGS)
add_definitions(-DHAS_MSGHDR_FLAGS=1)
endif()
if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()
add_library(enet
callbacks.c
compress.c
host.c
list.c
packet.c
peer.c
protocol.c
unix.c
win32.c
)
add_library(enet::enet ALIAS enet)
target_include_directories(enet PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if (BUILD_SHARED_LIBS)
target_compile_definitions(enet
PUBLIC ENET_DLL
PRIVATE ENET_BUILDING_LIB
)
endif()
if (WIN32)
target_link_libraries(enet winmm ws2_32)
endif()
set(ENET_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/enet)
configure_file ("${CMAKE_SOURCE_DIR}/libenet.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libenet.pc" @ONLY)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libenet.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
install(TARGETS enet EXPORT unofficial-enet-config
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
INSTALL(EXPORT unofficial-enet-config
NAMESPACE unofficial::enet::
FILE unofficial-enet-config.cmake
DESTINATION share/unofficial-enet
)
install(DIRECTORY include/
DESTINATION include)

View File

@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6459b6..63aef98 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,14 +89,25 @@ add_library(enet STATIC
${SOURCE_FILES}
)
+target_include_directories(enet PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+)
+
if (MINGW)
target_link_libraries(enet winmm ws2_32)
endif()
install(TARGETS enet
+ EXPORT unofficial-enet-config
RUNTIME DESTINATION bin
- ARCHIVE DESTINATION lib/static
+ ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
+INSTALL(EXPORT unofficial-enet-config
+ NAMESPACE unofficial::enet::
+ DESTINATION share/unofficial-enet
+)
+
install(DIRECTORY include/
DESTINATION include)

View File

@ -1,12 +1,11 @@
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO "lsalzman/enet"
REF e0e7045b7e056b454b5093cb34df49dc4cee0bee # v1.3.17
REF "v${VERSION}"
HEAD_REF master
SHA512 006a78edcc2059d8cee47a163d308dd02120a54f9c203401b83eb6cb4ab3e56cf09988d3c35b436a1e9f74c01296995ae6fdd46f6d354fe8261cf19cdde3df5d
SHA512 a0d2fa8c957704dd49e00a726284ac5ca034b50b00d2b20a94fa1bbfbb80841467834bfdc84aa0ed0d6aab894608fd6c86c3b94eee46343f0e6d9c22e391dbf9
PATCHES fix-export.patch
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
@ -21,4 +20,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,7 +1,6 @@
{
"name": "enet",
"version": "1.3.17",
"port-version": 2,
"version": "1.3.18",
"description": "Reliable UDP networking library",
"homepage": "https://github.com/lsalzman/enet",
"dependencies": [

View File

@ -2557,8 +2557,8 @@
"port-version": 4
},
"enet": {
"baseline": "1.3.17",
"port-version": 2
"baseline": "1.3.18",
"port-version": 0
},
"enkits": {
"baseline": "1.11",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "20760176898c0663e1a8c3245ec12c324a444525",
"version": "1.3.18",
"port-version": 0
},
{
"git-tree": "17a08430b1e76eae1ff5ea036084bee2d9a09775",
"version": "1.3.17",