OCT 1. 增加tlsuv支持

This commit is contained in:
xajhuang 2024-12-11 17:16:54 +08:00
parent 27ffde9e0d
commit 6caa1483b6
6 changed files with 90 additions and 6 deletions

View File

@ -76,7 +76,10 @@ FIND_PACKAGE(PkgConfig)
SET(COMMON_LIBS "")
CMAKE_POLICY(SET CMP0135 OLD)
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.28)
CMAKE_POLICY(SET CMP0135 OLD)
ENDIF ()
INCLUDE(./depend/third_libs.cmake)
IF (USED_JSON_VALIDATE)

Binary file not shown.

View File

@ -19,11 +19,11 @@ FUNCTION(LINUX_INSTALL_SYSTEM_PACKAGE)
MESSAGE("Run this command to install system(${OS_DISTRIB_NAME}) dependencies libraries:")
IF (${OS_DISTRIB_NAME} MATCHES "CentOS")
MESSAGE(FATAL_ERROR "$sudo yum -y install libcurl-devel czmq-devel openssl-devel libjson-c-devel")
MESSAGE(FATAL_ERROR "$sudo yum -y install libcurl-devel openssl-devel libjson-c-devel")
ELSEIF (${OS_DISTRIB_NAME} MATCHES "Ubuntu")
MESSAGE(FATAL_ERROR "$sudo apt -y install libcurl4-openssl-dev libczmq-dev libssl-dev libjson-c-dev")
MESSAGE(FATAL_ERROR "$sudo apt -y install libcurl4-openssl-dev libssl-dev libjson-c-dev zlib1g-dev libmbedtls-dev")
ENDIF ()
ELSE ()
MESSAGE(FATAL_ERROR "Run command to install system dependencies libraries [libcurl,libssl,libcrypto,libzmq] by yourself")
MESSAGE(FATAL_ERROR "Run command to install system dependencies libraries [libcurl,libssl,libcrypto] by yourself")
ENDIF ()
ENDFUNCTION(LINUX_INSTALL_SYSTEM_PACKAGE)

View File

@ -1,5 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14 FATAL_ERROR)
CMAKE_POLICY(SET CMP0135 NEW)
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.28)
CMAKE_POLICY(SET CMP0135 NEW)
ENDIF ()
INCLUDE(FetchContent)
@ -21,7 +23,11 @@ LIST(APPEND COMMON_LIBS "-lm -lpthread")
PKG_SEARCH_MODULE(LIBUV QUIET libuv)
PKG_SEARCH_MODULE(LIBCONFIG QUIET libconfig)
PKG_SEARCH_MODULE(LIBZ QUIET libz)
FIND_LIBRARY(LIBLLHTTP llhttp PATHS "/usr/local/lib")
FIND_LIBRARY(LIBTLSUV tlsuv PATHS "/usr/local/lib")
FIND_LIBRARY(LIBZLOG zlog PATHS "/usr/local/lib")
IF (USED_JSON_VALIDATE)
PKG_CHECK_MODULES(LIBJSON-C QUIET json-c>=0.13)
@ -32,12 +38,31 @@ IF (USED_JSON_VALIDATE)
)
ENDIF ()
ENDIF ()
IF (NOT LIBUV_FOUND)
FETCHCONTENT_DECLARE(libuv
URL file://${CMAKE_SOURCE_DIR}/depend/libuv-1.49.2.tar.gz
URL_MD5 b6aa4c4d5a8be9822a50ee9b6cfd00d2)
ENDIF ()
IF (NOT LIBZ_FOUND)
FETCHCONTENT_DECLARE(libz
URL file://${CMAKE_SOURCE_DIR}/depend/zlib-1.3.1.tar.gz
URL_MD5 ddb17dbbf2178807384e57ba0d81e6a1)
ENDIF ()
IF (NOT LIBLLHTTP_FOUND)
FETCHCONTENT_DECLARE(llhttp
URL file://${CMAKE_SOURCE_DIR}/depend/llhttp-release-v9.2.1.tar.gz
URL_MD5 546887e9b5760d9a7406c73eef01f522)
ENDIF ()
IF (NOT LIBTLSUV_FOUND)
FETCHCONTENT_DECLARE(tlsuv
URL file://${CMAKE_SOURCE_DIR}/depend/tlsuv-0.32.9.tar.gz
URL_MD5 a6706d2dd4d6eae0ba1a3cd2c7c6292a)
ENDIF ()
IF (NOT LIBCONFIG_FOUND)
FETCHCONTENT_DECLARE(libconfig
URL file://${CMAKE_SOURCE_DIR}/depend/libconfig-1.7.3.tar.gz
@ -58,15 +83,42 @@ IF (NOT LIBCONFIG_FOUND)
FETCHCONTENT_MAKEAVAILABLE(libconfig)
ENDIF ()
IF (LIBZLOG STREQUAL "LIBZLOG-NOTFOUND")
IF (NOT LIBZ_FOUND)
FETCHCONTENT_MAKEAVAILABLE(libz)
ENDIF ()
IF (${LIBZLOG} STREQUAL "LIBZLOG-NOTFOUND")
FETCHCONTENT_MAKEAVAILABLE(zlog)
ENDIF ()
IF (${LIBLLHTTP} STREQUAL "LIBLLHTTP-NOTFOUND")
FETCHCONTENT_MAKEAVAILABLE(llhttp)
ENDIF ()
IF (${LIBTLSUV} STREQUAL "LIBTLSUV-NOTFOUND")
FETCHCONTENT_MAKEAVAILABLE(tlsuv)
ENDIF ()
IF (USED_JSON_VALIDATE)
IF (NOT LIBJSON-C_FOUND)
FETCHCONTENT_MAKEAVAILABLE(libjson-c)
ENDIF ()
ENDIF ()
IF (NOT LIBZ_FOUND)
MESSAGE(STATUS "libz not found, will be used source code to build it ...")
FETCHCONTENT_GETPROPERTIES(libz)
IF (NOT libz_POPULATED)
FETCHCONTENT_POPULATE(libz)
ADD_SUBDIRECTORY(${libz_SOURCE_DIR} ${libz_BINARY_DIR})
ENDIF ()
INCLUDE_DIRECTORIES(${libz_SOURCE_DIR}/include)
LIST(APPEND COMMON_LIBS "zlibstatic")
ELSE ()
MESSAGE(STATUS "libz found ${LIBZ_VERSION} at ${LIBZ_LIBRARY_DIRS}")
LIST(APPEND COMMON_LIBS "${LIBZ_LDFLAGS}")
ENDIF ()
IF (NOT LIBUV_FOUND)
MESSAGE(STATUS "libuv not found, will be used source code to build it ...")
FETCHCONTENT_GETPROPERTIES(libuv)
@ -109,6 +161,35 @@ ELSE ()
LIST(APPEND COMMON_LIBS "${LIBZLOG}")
ENDIF ()
IF (LIBLLHTTP STREQUAL "LIBLLHTTP-NOTFOUND")
MESSAGE(STATUS "llhttp not found, will be used source code to build it ...")
FETCHCONTENT_GETPROPERTIES(llhttp)
IF (NOT llhttp_POPULATED)
FETCHCONTENT_POPULATE(llhttp)
ADD_SUBDIRECTORY(${llhttp_SOURCE_DIR} ${llhttp_BINARY_DIR})
ENDIF ()
INCLUDE_DIRECTORIES(${llhttp_SOURCE_DIR}/include)
LIST(APPEND COMMON_LIBS "llhttp_static")
ELSE ()
MESSAGE(STATUS "llhttp found of ${LIBLLHTTP}")
LIST(APPEND COMMON_LIBS "${LIBLLHTTP}")
ENDIF ()
IF (LIBTLSUV STREQUAL "LIBTLSUV-NOTFOUND")
MESSAGE(STATUS "tlsuv not found, will be used source code to build it ...")
FETCHCONTENT_GETPROPERTIES(tlsuv)
IF (NOT tlsuv_POPULATED)
FETCHCONTENT_POPULATE(tlsuv)
ADD_SUBDIRECTORY(${tlsuv_SOURCE_DIR} ${tlsuv_BINARY_DIR})
ENDIF ()
INCLUDE_DIRECTORIES(${tlsuv_SOURCE_DIR}/src)
LIST(APPEND COMMON_LIBS "tlsuv")
ELSE ()
MESSAGE(STATUS "tlsuv found of ${LIBTLSUV}")
LIST(APPEND COMMON_LIBS "${LIBTLSUV}")
ENDIF ()
IF (USED_JSON_VALIDATE)
IF (NOT LIBJSON-C_FOUND)
MESSAGE(STATUS "json-c not found, will be used source code to build it ...")

BIN
depend/tlsuv-0.32.9.tar.gz Normal file

Binary file not shown.

BIN
depend/zlib-1.3.1.tar.gz Normal file

Binary file not shown.