-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
44,233 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Potential build directories | ||
[Aa][Rr][Mm]/ | ||
[Aa][Rr][Mm]64/ | ||
[Bb]in/ | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Ll]og/ | ||
[Ll]ogs/ | ||
[Oo]bj/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
[Ww][Ii][Nn]32/ | ||
bld/ | ||
build/ | ||
builds/ | ||
out/ | ||
x64/ | ||
x86/ | ||
|
||
# VS | ||
.vs/ | ||
.vscode/ | ||
!.vscode/extensions.json | ||
!.vscode/launch.json | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
|
||
# CMake | ||
_deps | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeLists.txt.user | ||
CMakeScripts | ||
CMakeUserPresets.json | ||
CTestTestfile.cmake | ||
cmake_install.cmake | ||
compile_commands.json | ||
install_manifest.txt | ||
|
||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
cmake_minimum_required(VERSION 2.8.12...3.20) | ||
|
||
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() | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}/include) | ||
|
||
set(INCLUDE_FILES_PREFIX include/enet) | ||
set(INCLUDE_FILES | ||
${INCLUDE_FILES_PREFIX}/callbacks.h | ||
${INCLUDE_FILES_PREFIX}/enet.h | ||
${INCLUDE_FILES_PREFIX}/list.h | ||
${INCLUDE_FILES_PREFIX}/protocol.h | ||
${INCLUDE_FILES_PREFIX}/time.h | ||
${INCLUDE_FILES_PREFIX}/types.h | ||
${INCLUDE_FILES_PREFIX}/unix.h | ||
${INCLUDE_FILES_PREFIX}/utility.h | ||
${INCLUDE_FILES_PREFIX}/win32.h | ||
) | ||
|
||
set(SOURCE_FILES | ||
callbacks.c | ||
compress.c | ||
host.c | ||
list.c | ||
packet.c | ||
peer.c | ||
protocol.c | ||
unix.c | ||
win32.c) | ||
|
||
source_group(include FILES ${INCLUDE_FILES}) | ||
source_group(source FILES ${SOURCE_FILES}) | ||
|
||
if(WIN32 AND BUILD_SHARED_LIBS AND (MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")) | ||
add_definitions(-DENET_DLL=1) | ||
add_definitions(-DENET_BUILDING_LIB) | ||
endif() | ||
|
||
add_library(enet | ||
${INCLUDE_FILES} | ||
${SOURCE_FILES} | ||
) | ||
|
||
if (WIN32) | ||
target_link_libraries(enet winmm ws2_32) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS enet | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/enet | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2002-2024 Lee Salzman | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CFLAGS=-O3 -fomit-frame-pointer | ||
override CFLAGS:= $(CFLAGS) -Iinclude | ||
|
||
OBJS= \ | ||
callbacks.o \ | ||
compress.o \ | ||
host.o \ | ||
list.o \ | ||
packet.o \ | ||
peer.o \ | ||
protocol.o \ | ||
unix.o \ | ||
win32.o | ||
|
||
libenet.a: $(OBJS) | ||
$(AR) rcs $@ $(OBJS) | ||
|
||
default: libenet.a | ||
|
||
clean: | ||
-$(RM) libenet.a $(OBJS) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pkgconfigdir = $(libdir)/pkgconfig | ||
nodist_pkgconfig_DATA = libenet.pc | ||
|
||
enetincludedir=$(includedir)/enet | ||
enetinclude_HEADERS = \ | ||
include/enet/callbacks.h \ | ||
include/enet/enet.h \ | ||
include/enet/list.h \ | ||
include/enet/protocol.h \ | ||
include/enet/time.h \ | ||
include/enet/types.h \ | ||
include/enet/unix.h \ | ||
include/enet/utility.h \ | ||
include/enet/win32.h | ||
|
||
lib_LTLIBRARIES = libenet.la | ||
libenet_la_SOURCES = callbacks.c compress.c host.c list.c packet.c peer.c protocol.c unix.c win32.c | ||
# see info '(libtool) Updating version info' before making a release | ||
libenet_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:6:0 | ||
AM_CPPFLAGS = -I$(top_srcdir)/include | ||
|
||
ACLOCAL_AMFLAGS = -Im4 |
Oops, something went wrong.