initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

1028
third_party/libhv/cmake/ios.toolchain.cmake vendored Executable file

File diff suppressed because it is too large Load Diff

87
third_party/libhv/cmake/libhvConfig.cmake vendored Executable file
View File

@@ -0,0 +1,87 @@
include(SelectLibraryConfigurations)
find_path(libhv_INCLUDE_DIRS hv/hv.h)
message("libhv_INCLUDE_DIRS: " ${libhv_INCLUDE_DIRS})
find_library(libhv_LIBRARY_RELEASE NAMES hv PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH)
find_library(libhv_LIBRARY_DEBUG NAMES hv PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH)
select_library_configurations(libhv)
if(NOT libhv_LIBRARY)
set(libhv_FOUND FALSE)
set(LIBHV_FOUND FALSE)
return()
endif()
if(WIN32)
find_file(libhv_LIBRARY_RELEASE_DLL NAMES hv.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin" NO_DEFAULT_PATH)
find_file(libhv_LIBRARY_DEBUG_DLL NAMES hv.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/bin" NO_DEFAULT_PATH)
endif()
# Manage Release Windows shared
if(EXISTS "${libhv_LIBRARY_RELEASE_DLL}")
add_library(libhv SHARED IMPORTED)
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS Release
IMPORTED_LOCATION_RELEASE "${libhv_LIBRARY_RELEASE_DLL}"
IMPORTED_IMPLIB_RELEASE "${libhv_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
endif()
# Manage Debug Windows shared
if(EXISTS "${libhv_LIBRARY_DEBUG_DLL}")
if(EXISTS "${libhv_LIBRARY_RELEASE_DLL}")
#message("Debug mode")
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS "Release;Debug"
IMPORTED_LOCATION_RELEASE "${libhv_LIBRARY_RELEASE_DLL}"
IMPORTED_IMPLIB_RELEASE "${libhv_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${libhv_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${libhv_LIBRARY_DEBUG}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
else()
add_library(libhv SHARED IMPORTED)
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS Debug
IMPORTED_LOCATION_DEBUG "${libhv_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${libhv_LIBRARY_DEBUG}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
endif()
endif()
# Manage Release Windows static and Linux shared/static
if((NOT EXISTS "${libhv_LIBRARY_RELEASE_DLL}") AND (EXISTS "${libhv_LIBRARY_RELEASE}"))
add_library(libhv UNKNOWN IMPORTED)
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS Release
IMPORTED_LOCATION_RELEASE "${libhv_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
endif()
# Manage Debug Windows static and Linux shared/static
if((NOT EXISTS "${libhv_LIBRARY_DEBUG_DLL}") AND (EXISTS "${libhv_LIBRARY_DEBUG}"))
if(EXISTS "${libhv_LIBRARY_RELEASE}")
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS "Release;Debug"
IMPORTED_LOCATION_RELEASE "${libhv_LIBRARY_RELEASE}"
IMPORTED_LOCATION_DEBUG "${libhv_LIBRARY_DEBUG}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
else()
add_library(libhv UNKNOWN IMPORTED)
set_target_properties(libhv PROPERTIES
IMPORTED_CONFIGURATIONS Debug
IMPORTED_LOCATION_DEBUG "${libhv_LIBRARY_DEBUG}"
INTERFACE_INCLUDE_DIRECTORIES "${libhv_INCLUDE_DIRS}"
)
endif()
endif()
set(libhv_FOUND TRUE)
set(LIBHV_FOUND TRUE)

42
third_party/libhv/cmake/utils.cmake vendored Executable file
View File

@@ -0,0 +1,42 @@
include(CheckIncludeFiles)
macro(check_header header)
string(TOUPPER ${header} str1)
string(REGEX REPLACE "[/.]" "_" str2 ${str1})
set(str3 HAVE_${str2})
check_include_files(${header} ${str3})
if (${str3})
set(${str3} 1)
else()
set(${str3} 0)
endif()
endmacro()
include(CheckSymbolExists)
macro(check_function function header)
string(TOUPPER ${function} str1)
set(str2 HAVE_${str1})
check_symbol_exists(${function} ${header} ${str2})
if (${str2})
set(${str2} 1)
else()
set(${str2} 0)
endif()
endmacro()
macro(list_source_directories srcs)
unset(tmp)
foreach(dir ${ARGN})
aux_source_directory(${dir} tmp)
endforeach()
set(${srcs} ${tmp})
list(FILTER ${srcs} EXCLUDE REGEX ".*_test\\.c")
endmacro()
macro(glob_headers_and_sources files)
unset(tmp)
foreach(dir ${ARGN})
file(GLOB tmp ${dir}/*.h ${dir}/*.c ${dir}/*.hpp ${dir}/*.cpp)
list(APPEND ${files} ${tmp})
endforeach()
list(FILTER ${files} EXCLUDE REGEX ".*_test\\.c")
endmacro()

110
third_party/libhv/cmake/vars.cmake vendored Executable file
View File

@@ -0,0 +1,110 @@
# see Makefile.vars
set(BASE_HEADERS
base/hplatform.h
base/hdef.h
base/hatomic.h
base/herr.h
base/htime.h
base/hmath.h
base/hbase.h
base/hversion.h
base/hsysinfo.h
base/hproc.h
base/hthread.h
base/hmutex.h
base/hsocket.h
base/hlog.h
base/hbuf.h
base/hmain.h
base/hendian.h
)
set(SSL_HEADERS
ssl/hssl.h
)
set(EVENT_HEADERS
event/hloop.h
event/nlog.h
)
set(UTIL_HEADERS
util/base64.h
util/md5.h
util/sha1.h
)
set(CPPUTIL_HEADERS
cpputil/hmap.h
cpputil/hstring.h
cpputil/hfile.h
cpputil/hpath.h
cpputil/hdir.h
cpputil/hurl.h
cpputil/hscope.h
cpputil/hthreadpool.h
cpputil/hasync.h
cpputil/hobjectpool.h
cpputil/ifconfig.h
cpputil/iniparser.h
cpputil/json.hpp
cpputil/singleton.h
cpputil/ThreadLocalStorage.h
)
set(EVPP_HEADERS
evpp/Buffer.h
evpp/Channel.h
evpp/Event.h
evpp/EventLoop.h
evpp/EventLoopThread.h
evpp/EventLoopThreadPool.h
evpp/Status.h
evpp/TcpClient.h
evpp/TcpServer.h
evpp/UdpClient.h
evpp/UdpServer.h
)
set(PROTOCOL_HEADERS
protocol/icmp.h
protocol/dns.h
protocol/ftp.h
protocol/smtp.h
)
set(HTTP_HEADERS
http/httpdef.h
http/wsdef.h
http/http_content.h
http/HttpMessage.h
http/HttpParser.h
http/WebSocketParser.h
http/WebSocketChannel.h
)
set(HTTP2_HEADERS
http/http2def.h
http/grpcdef.h
)
set(HTTP_CLIENT_HEADERS
http/client/HttpClient.h
http/client/requests.h
http/client/axios.h
http/client/AsyncHttpClient.h
http/client/WebSocketClient.h)
set(HTTP_SERVER_HEADERS
http/server/HttpServer.h
http/server/HttpService.h
http/server/HttpContext.h
http/server/HttpResponseWriter.h
http/server/WebSocketServer.h
)
set(MQTT_HEADERS
mqtt/mqtt_protocol.h
mqtt/mqtt_client.h
)