support framework

This commit is contained in:
ruanshudong 2020-02-20 22:00:32 +08:00
parent be0086be92
commit ce4fdcf063
12 changed files with 699 additions and 700 deletions

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- "2.0"
- master
jobs:
build:

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- "2.0"
- master
jobs:
build:

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- "2.0"
- master
jobs:
build:

View File

@ -2,351 +2,7 @@ cmake_minimum_required(VERSION 3.2)
project(tars_cpp)
set(TARS_VERSION "2.0.0")
add_definitions(-DTARS_VERSION="${TARS_VERSION}")
include("${PROJECT_SOURCE_DIR}/cmake/Common.cmake")
if(WIN32)
option(TARS_MYSQL "option for mysql" OFF)
else()
option(TARS_MYSQL "option for mysql" ON)
endif()
include("${PROJECT_SOURCE_DIR}/cmake/BuildTarsCpp.cmake")
option(TARS_SSL "option for ssl" OFF)
option(TARS_HTTP2 "option for http2" OFF)
option(TARS_PROTOBUF "option for protocol" OFF)
#option(TARS_ZLIB "option for zip" OFF)
if(TARS_MYSQL)
add_definitions(-DTARS_MYSQL=1)
endif()
if(TARS_SSL)
add_definitions(-DTARS_SSL=1)
endif()
if(TARS_HTTP2)
add_definitions(-DTARS_HTTP2=1)
endif()
if(TARS_PROTOBUF)
add_definitions(-DTARS_PROTOBUF=1)
endif()
#if(TARS_ZLIB)
#add_definitions(-DTARS_ZLIB=1)
#endif()
set(CMAKE_VERBOSE_MAKEFILE off)
#for coverage statistics
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O2 -Wall -Wno-deprecated -fprofile-arcs -ftest-coverage")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -Wno-deprecated -fprofile-arcs -ftest-coverage")
#set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "set build type to release default")
IF (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
ENDIF()
#
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(_USE_OPENTRACKING $ENV{_USE_OPENTRACKING})
if(_USE_OPENTRACKING)
set(OPENTRACKING_INC "/usr/local/include")
add_definitions(-D_USE_OPENTRACKING=${_USE_OPENTRACKING})
endif()
#-------------------------------------------------------------
if("${INSTALL_PREFIX}" STREQUAL "")
IF (UNIX)
set(INSTALL_PREFIX "/usr/local/tars/cpp")
ELSE()
set(INSTALL_PREFIX "c:\\tars\\cpp")
ENDIF()
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX})
endif()
#-------------------------------------------------------------
set(THIRDPARTY_PATH "${CMAKE_BINARY_DIR}/src")
if(TARS_MYSQL)
set(MYSQL_DIR_INC "${THIRDPARTY_PATH}/mysql-lib/include")
set(MYSQL_DIR_LIB "${THIRDPARTY_PATH}/mysql-lib/libmysql")
include_directories(${MYSQL_DIR_INC})
link_directories(${MYSQL_DIR_LIB})
endif()
if(TARS_PROTOBUF)
set(PROTOBUF_DIR_INC "${THIRDPARTY_PATH}/protobuf-lib/src")
set(PROTOBUF_DIR_LIB "${THIRDPARTY_PATH}/protobuf-lib")
include_directories(${PROTOBUF_DIR_INC})
link_directories(${PROTOBUF_DIR_LIB})
endif()
#if(TARS_ZLIB)
# set(ZLIB_DIR_INC "${THIRDPARTY_PATH}/z-lib")
# set(ZLIB_DIR_LIB "${THIRDPARTY_PATH}/z-lib")
# include_directories(${ZLIB_DIR_INC})
# link_directories(${ZLIB_DIR_LIB})
#endif()
if(TARS_HTTP2)
set(NGHTTP2_DIR_INC "${THIRDPARTY_PATH}/nghttp2-lib/lib/includes/")
set(NGHTTP2_DIR_LIB "${THIRDPARTY_PATH}/nghttp2-lib/lib")
include_directories(${NGHTTP2_DIR_INC})
link_directories(${NGHTTP2_DIR_LIB})
endif()
if(TARS_SSL)
set(SSL_DIR_INC "${THIRDPARTY_PATH}/openssl-lib/include/")
set(SSL_DIR_LIB "${THIRDPARTY_PATH}/openssl-lib")
include_directories(${SSL_DIR_INC})
link_directories(${SSL_DIR_LIB})
endif()
#-------------------------------------------------------------
set(LIB_MYSQL)
set(LIB_HTTP2)
set(LIB_SSL)
set(LIB_CRYPTO)
#set(LIB_ZLIB)
set(LIB_PROTOBUF)
IF (WIN32)
if(TARS_MYSQL)
set(LIB_MYSQL "libmysql")
endif()
if(TARS_HTTP2)
set(LIB_HTTP2 "libnghttp2_static")
endif()
if(TARS_SSL)
set(LIB_SSL "libssl")
set(LIB_CRYPTO "libcrypto")
endif()
#if(TARS_ZLIB)
# set(LIB_ZLIB "libz")
#endif()
#if(TARS_PROTOBUF)
# set(LIB_PROTOBUF "libprotoc")
#endif()
ELSE()
link_libraries(pthread dl)
if(TARS_MYSQL)
set(LIB_MYSQL "mysqlclient")
endif()
if(TARS_HTTP2)
set(LIB_HTTP2 "nghttp2_static")
endif()
#
#if(TARS_SSL)
# set(LIB_SSL "ssl")
# set(LIB_CRYPTO "crypto")
#endif()
#if(TARS_ZLIB)
# set(LIB_ZLIB "z")
#endif()
if(TARS_PROTOBUF)
set(LIB_PROTOBUF "protoc")
endif()
ENDIF()
#-------------------------------------------------------------
#if(TARS_MYSQL)
#link_libraries(${LIB_MYSQL})
#endif()
#if(TARS_ZLIB)
#link_libraries(${LIB_ZLIB})
#endif()
#
if(TARS_HTTP2)
link_libraries(${LIB_HTTP2})
endif()
#
#if(TARS_PROTOBUF)
# list(APPEND APP_LIBRARIES ${LIB_HTTP2})
#endif()
if(TARS_SSL)
link_libraries(${LIB_SSL} ${LIB_CRYPTO})
endif()
#list(LENGTH APP_LIBRARIES RET)
#if(${RET} GREATER 0)
# link_libraries(${APP_LIBRARIES})
#endif()
include(ExternalProject)
if(TARS_PROTOBUF)
ExternalProject_Add(${LIB_PROTOBUF}
URL http://cdn.tarsyun.com/src/protobuf-cpp-3.11.3.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake cmake
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make -j4 libprotoc
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 fb59398329002c98d4d92238324c4187
)
endif()
if(TARS_MYSQL)
ExternalProject_Add(${LIB_MYSQL}
URL http://cdn.tarsyun.com/src/mysql-5.6.26.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDISABLE_SHARED=1
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make mysqlclient
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 c537c08c1276abc79d76e8e562bbcea5
)
endif()
#
#if(TARS_ZLIB)
#ExternalProject_Add(${LIB_ZLIB}
# URL http://cdn.tarsyun.com/src/zlib-1.2.11.tar.gz
# PREFIX ${CMAKE_BINARY_DIR}
# INSTALL_DIR ${CMAKE_SOURCE_DIR}
# CONFIGURE_COMMAND cmake .
# SOURCE_DIR ${CMAKE_BINARY_DIR}/src/z-lib
# BUILD_IN_SOURCE 1
# BUILD_COMMAND make zlibstatic
# LOG_CONFIGURE 1
# LOG_BUILD 1
# INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
# URL_MD5 1c9f62f0778697a09d36121ead88e08e
# )
#endif()
if(TARS_HTTP2)
ExternalProject_Add(${LIB_HTTP2}
URL http://cdn.tarsyun.com/src/nghttp2-1.40.0.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake . -DENABLE_SHARED_LIB=OFF -DENABLE_STATIC_LIB=ON -DENABLE_LIB_ONLY=ON
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib
BUILD_IN_SOURCE 1
LOG_BUILD 1
LOG_CONFIGURE 1
BUILD_COMMAND make
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 5df375bbd532fcaa7cd4044b54b1188d
# URL_MD5 9521689460b4a57912acd3f88f301a3a
)
endif()
if(TARS_SSL)
ExternalProject_Add(${LIB_SSL}
DEPENDS ${LIB_ZLIB}
URL http://cdn.tarsyun.com/src/openssl-1.1.1c.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND ./config
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
#URL_MD5 3be209000dbc7e1b95bcdf47980a3baa
URL_MD5 15e21da6efe8aa0e0768ffd8cd37a5f6
)
endif()
add_custom_target(thirdparty DEPENDS ${LIB_MYSQL} ${LIB_HTTP2} ${LIB_SSL})
#-------------------------------------------------------------
IF (APPLE)
link_libraries(iconv)
ENDIF(APPLE)
set(PLATFORM)
IF (UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wno-deprecated -fno-strict-aliasing -Wno-overloaded-virtual")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined -D__FILE__='\"$(notdir $(abspath $<))\"'")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -Wall -g")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wall -fno-strict-aliasing")
set(PLATFORM "linux")
IF(APPLE)
set(PLATFORM "mac")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
ENDIF(APPLE)
ELSEIF (WIN32)
set(PLATFORM "window")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4101 /wd4244 /wd4996 /wd4091 /wd4503 /wd4819 /wd4200 /wd4800")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj " )
ELSE ()
MESSAGE(STATUS "================ ERROR: This platform is unsupported!!! ================")
ENDIF (UNIX)
#-------------------------------------------------------------
IF(WIN32)
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe")
#set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp.exe")
ELSE()
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp")
ENDIF()
#-------------------------------------------------------------
IF(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/util/src/epoll_windows)
ENDIF()
message("----------------------------------------------------")
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("PLATFORM: ${PLATFORM}")
message("INSTALL_PREFIX: ${INSTALL_PREFIX}")
message("BIN: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
#-------------------------------------------------------------
message("----------------------------------------------------")
message("TARS_MYSQL: ${TARS_MYSQL}")
message("TARS_HTTP2: ${TARS_HTTP2}")
message("TARS_SSL: ${TARS_SSL}")
#message("TARS_ZLIB: ${TARS_ZLIB}")
message("TARS_PROTOBUF: ${TARS_PROTOBUF}")
#-------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/cmake/BuildTarsServer.cmake")
include_directories(${CMAKE_SOURCE_DIR}/util/include)
include_directories(${CMAKE_SOURCE_DIR}/servant)
include_directories(${CMAKE_SOURCE_DIR}/servant/protocol)
add_subdirectory(util)
add_subdirectory(tools)
add_subdirectory(servant)
add_subdirectory(examples)
#add_subdirectory(test_deprecated)

View File

@ -80,3 +80,16 @@ macro(build_tars_server MODULE DEPS)
add_custom_target(${MODULE}-tar DEPENDS ${MODULE-TGZ})
endmacro()
#-----------------------------------------------------------------------
include_directories(${PROJECT_SOURCE_DIR}/util/include)
include_directories(${PROJECT_SOURCE_DIR}/servant)
include_directories(${PROJECT_SOURCE_DIR}/servant/protocol)
add_subdirectory(util)
add_subdirectory(tools)
add_subdirectory(servant)
add_subdirectory(examples)
#add_subdirectory(test_deprecated)

321
cmake/Common.cmake Executable file
View File

@ -0,0 +1,321 @@
if("${TARS_CPP_COMMON}" STREQUAL "")
set(TARS_CPP_COMMON "1")
set(TARS_VERSION "2.0.0")
add_definitions(-DTARS_VERSION="${TARS_VERSION}")
if(WIN32)
option(TARS_MYSQL "option for mysql" OFF)
else()
option(TARS_MYSQL "option for mysql" ON)
endif()
option(TARS_SSL "option for ssl" OFF)
option(TARS_HTTP2 "option for http2" OFF)
option(TARS_PROTOBUF "option for protocol" OFF)
#option(TARS_ZLIB "option for zip" OFF)
if(TARS_MYSQL)
add_definitions(-DTARS_MYSQL=1)
endif()
if(TARS_SSL)
add_definitions(-DTARS_SSL=1)
endif()
if(TARS_HTTP2)
add_definitions(-DTARS_HTTP2=1)
endif()
if(TARS_PROTOBUF)
add_definitions(-DTARS_PROTOBUF=1)
endif()
#if(TARS_ZLIB)
#add_definitions(-DTARS_ZLIB=1)
#endif()
set(CMAKE_VERBOSE_MAKEFILE off)
#for coverage statistics
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O2 -Wall -Wno-deprecated -fprofile-arcs -ftest-coverage")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -Wno-deprecated -fprofile-arcs -ftest-coverage")
#set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "set build type to release default")
IF (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
ENDIF()
#
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(_USE_OPENTRACKING $ENV{_USE_OPENTRACKING})
if(_USE_OPENTRACKING)
set(OPENTRACKING_INC "/usr/local/include")
add_definitions(-D_USE_OPENTRACKING=${_USE_OPENTRACKING})
endif()
#-------------------------------------------------------------
if("${INSTALL_PREFIX}" STREQUAL "")
IF (UNIX)
set(INSTALL_PREFIX "/usr/local/tars/cpp")
ELSE()
set(INSTALL_PREFIX "c:\\tars\\cpp")
ENDIF()
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX})
endif()
#-------------------------------------------------------------
set(THIRDPARTY_PATH "${CMAKE_BINARY_DIR}/src")
if(TARS_MYSQL)
set(MYSQL_DIR_INC "${THIRDPARTY_PATH}/mysql-lib/include")
set(MYSQL_DIR_LIB "${THIRDPARTY_PATH}/mysql-lib/libmysql")
include_directories(${MYSQL_DIR_INC})
link_directories(${MYSQL_DIR_LIB})
endif()
if(TARS_PROTOBUF)
set(PROTOBUF_DIR_INC "${THIRDPARTY_PATH}/protobuf-lib/src")
set(PROTOBUF_DIR_LIB "${THIRDPARTY_PATH}/protobuf-lib")
include_directories(${PROTOBUF_DIR_INC})
link_directories(${PROTOBUF_DIR_LIB})
endif()
#if(TARS_ZLIB)
# set(ZLIB_DIR_INC "${THIRDPARTY_PATH}/z-lib")
# set(ZLIB_DIR_LIB "${THIRDPARTY_PATH}/z-lib")
# include_directories(${ZLIB_DIR_INC})
# link_directories(${ZLIB_DIR_LIB})
#endif()
if(TARS_HTTP2)
set(NGHTTP2_DIR_INC "${THIRDPARTY_PATH}/nghttp2-lib/lib/includes/")
set(NGHTTP2_DIR_LIB "${THIRDPARTY_PATH}/nghttp2-lib/lib")
include_directories(${NGHTTP2_DIR_INC})
link_directories(${NGHTTP2_DIR_LIB})
endif()
if(TARS_SSL)
set(SSL_DIR_INC "${THIRDPARTY_PATH}/openssl-lib/include/")
set(SSL_DIR_LIB "${THIRDPARTY_PATH}/openssl-lib")
include_directories(${SSL_DIR_INC})
link_directories(${SSL_DIR_LIB})
endif()
#-------------------------------------------------------------
set(LIB_MYSQL)
set(LIB_HTTP2)
set(LIB_SSL)
set(LIB_CRYPTO)
#set(LIB_ZLIB)
set(LIB_PROTOBUF)
IF (WIN32)
if(TARS_MYSQL)
set(LIB_MYSQL "libmysql")
endif()
if(TARS_HTTP2)
set(LIB_HTTP2 "libnghttp2_static")
endif()
if(TARS_SSL)
set(LIB_SSL "libssl")
set(LIB_CRYPTO "libcrypto")
endif()
ELSE()
link_libraries(pthread dl)
if(TARS_MYSQL)
set(LIB_MYSQL "mysqlclient")
endif()
if(TARS_HTTP2)
set(LIB_HTTP2 "nghttp2_static")
endif()
if(TARS_SSL)
set(LIB_SSL "ssl")
set(LIB_CRYPTO "crypto")
endif()
if(TARS_PROTOBUF)
set(LIB_PROTOBUF "protoc")
endif()
ENDIF()
#-------------------------------------------------------------
if(TARS_HTTP2)
link_libraries(${LIB_HTTP2})
endif()
if(TARS_SSL)
link_libraries(${LIB_SSL} ${LIB_CRYPTO})
endif()
include(ExternalProject)
if(TARS_PROTOBUF)
ExternalProject_Add(${LIB_PROTOBUF}
URL http://cdn.tarsyun.com/src/protobuf-cpp-3.11.3.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake cmake
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make -j4 libprotoc
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 fb59398329002c98d4d92238324c4187
)
endif()
if(TARS_MYSQL)
ExternalProject_Add(${LIB_MYSQL}
URL http://cdn.tarsyun.com/src/mysql-5.6.26.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDISABLE_SHARED=1
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make mysqlclient
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 c537c08c1276abc79d76e8e562bbcea5
#URL_MD5 9d225528742c882d5b1e4a40b0877690
)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/mysql-lib/include/mysql DESTINATION include)
if(WIN32)
INSTALL(FILES ${CMAKE_BINARY_DIR}/src/mysql-lib/libmysql/${LIB_MYSQL}.dll DESTINATION lib)
else()
INSTALL(FILES ${CMAKE_BINARY_DIR}/src/mysql-lib/libmysql/lib${LIB_MYSQL}.a DESTINATION lib)
endif()
endif()
if(TARS_HTTP2)
ExternalProject_Add(${LIB_HTTP2}
URL http://cdn.tarsyun.com/src/nghttp2-1.40.0.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND cmake . -DENABLE_SHARED_LIB=OFF -DENABLE_STATIC_LIB=ON -DENABLE_LIB_ONLY=ON
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib
BUILD_IN_SOURCE 1
LOG_BUILD 1
LOG_CONFIGURE 1
BUILD_COMMAND make
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 5df375bbd532fcaa7cd4044b54b1188d
# URL_MD5 9521689460b4a57912acd3f88f301a3a
)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/nghttp2-lib/lib/includes/nghttp2 DESTINATION include)
INSTALL(FILES ${CMAKE_BINARY_DIR}/src/nghttp2-lib/lib/lib${LIB_HTTP2}.a DESTINATION lib)
endif()
if(TARS_SSL)
ExternalProject_Add(${LIB_SSL}
DEPENDS ${LIB_ZLIB}
URL http://cdn.tarsyun.com/src/openssl-1.1.1d.tar.gz
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND ./config
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make
LOG_CONFIGURE 1
LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
URL_MD5 3be209000dbc7e1b95bcdf47980a3baa
#URL_MD5 15e21da6efe8aa0e0768ffd8cd37a5f6
)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/openssl-lib/include/openssl DESTINATION include)
INSTALL(FILES
${CMAKE_BINARY_DIR}/src/openssl-lib/lib${LIB_SSL}.a
${CMAKE_BINARY_DIR}/src/openssl-lib/lib${LIB_CRYPTO}.a
DESTINATION lib)
endif()
add_custom_target(thirdparty DEPENDS ${LIB_MYSQL} ${LIB_HTTP2} ${LIB_SSL})
#-------------------------------------------------------------
IF (APPLE)
link_libraries(iconv)
ENDIF(APPLE)
set(PLATFORM)
IF (UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -Wno-deprecated -fno-strict-aliasing -Wno-overloaded-virtual")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined -D__FILE__='\"$(notdir $(abspath $<))\"'")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -Wall -g")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wall -fno-strict-aliasing")
set(PLATFORM "linux")
IF(APPLE)
set(PLATFORM "mac")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
ENDIF(APPLE)
ELSEIF (WIN32)
set(PLATFORM "window")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4101 /wd4244 /wd4996 /wd4091 /wd4503 /wd4819 /wd4200 /wd4800")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj " )
ELSE ()
MESSAGE(STATUS "================ ERROR: This platform is unsupported!!! ================")
ENDIF (UNIX)
#-------------------------------------------------------------
IF(WIN32)
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe")
ELSE()
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp")
ENDIF()
#-------------------------------------------------------------
IF(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/util/src/epoll_windows)
ENDIF()
message("----------------------------------------------------")
message("CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
message("CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("PLATFORM: ${PLATFORM}")
message("INSTALL_PREFIX: ${INSTALL_PREFIX}")
message("BIN: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message("TARS2CPP: ${TARS2CPP}")
#-------------------------------------------------------------
message("----------------------------------------------------")
message("TARS_MYSQL: ${TARS_MYSQL}")
message("TARS_HTTP2: ${TARS_HTTP2}")
message("TARS_SSL: ${TARS_SSL}")
#message("TARS_ZLIB: ${TARS_ZLIB}")
message("TARS_PROTOBUF: ${TARS_PROTOBUF}")
endif()

View File

@ -69,7 +69,6 @@ add_subdirectory(libservant)
install(DIRECTORY servant DESTINATION include)
install(DIRECTORY tup DESTINATION include)
install(DIRECTORY jmem DESTINATION include)
install(DIRECTORY promise DESTINATION include)
install(DIRECTORY script DESTINATION .)
install(DIRECTORY makefile DESTINATION .)

View File

@ -9,7 +9,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#define YY_FLEX_SUBMINOR_VERSION 37
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@ -47,7 +47,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
@ -55,7 +54,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@ -86,6 +84,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@ -176,7 +176,7 @@ extern FILE *yyin, *yyout;
*/
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
--yylineno;\
@ -369,7 +369,7 @@ static void yy_fatal_error (yyconst char msg[] );
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
@ -513,7 +513,7 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 1 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
/**
* Tencent is pleased to support the open source community by making Tars available.
*
@ -529,7 +529,7 @@ char *yytext;
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
#line 20 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 20 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
#include <map>
#include <string>
#include <sstream>
@ -649,7 +649,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( yytext, yyleng, 1, yyout )
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@ -660,7 +660,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@ -742,7 +742,7 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 67 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 67 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
#line 749 "tars.lex.cpp"
@ -840,12 +840,12 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 69 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 69 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{ BEGIN(INCL); }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 71 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 71 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
if ( include_file_stack_ptr >= MAX_INCLUDE_DEPTH )
{
@ -878,7 +878,7 @@ YY_RULE_SETUP
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(INCL):
#line 101 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 101 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
--include_file_stack_ptr;
if ( include_file_stack_ptr < 0 )
@ -897,14 +897,14 @@ case YY_STATE_EOF(INCL):
YY_BREAK
case 3:
YY_RULE_SETUP
#line 117 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 117 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
return TARS_SCOPE_DELIMITER;
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 121 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 121 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
// C++ comment
bool e = false;
@ -925,7 +925,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 139 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 139 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
// C comment
bool e = false;
@ -976,7 +976,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
#line 187 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 187 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr ident = new StringGrammar;
ident->v = yytext;
@ -987,7 +987,7 @@ YY_RULE_SETUP
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
#line 194 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 194 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr ident = new StringGrammar;
ident->v = yytext;
@ -1000,7 +1000,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 204 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 204 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
StringGrammarPtr str = new StringGrammar;
bool e = false;
@ -1115,7 +1115,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
#line 316 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 316 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
errno = 0;
IntergerGrammarPtr ptr = new IntergerGrammar;
@ -1140,7 +1140,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 338 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 338 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
errno = 0;
FloatGrammarPtr ptr = new FloatGrammar;
@ -1175,7 +1175,7 @@ YY_RULE_SETUP
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
#line 369 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 369 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
if(yytext[0] == '\n')
{
@ -1185,7 +1185,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 376 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 376 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
{
if(yytext[0] < 32 || yytext[0] > 126)
{
@ -1204,7 +1204,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 392 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"
ECHO;
YY_BREAK
#line 1211 "tars.lex.cpp"
@ -1398,7 +1398,7 @@ static int yy_get_next_buffer (void)
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
@ -1531,7 +1531,7 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 51);
return yy_is_jam ? 0 : yy_current_state;
return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp )
@ -1623,7 +1623,7 @@ static int yy_get_next_buffer (void)
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return 0;
return EOF;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@ -1764,10 +1764,6 @@ static void yy_load_buffer_state (void)
yyfree((void *) b );
}
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
@ -1972,8 +1968,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
@ -1981,7 +1977,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
yy_size_t n;
yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
@ -2214,7 +2211,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
#line 392 "/data/shared/Tars/framework/tarscpp/tools/tarsgrammar/tars.l"

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.2.2. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,9 +30,6 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_YY_TARS_TAB_HPP_INCLUDED
# define YY_YY_TARS_TAB_HPP_INCLUDED
/* Debug traces. */

View File

@ -536,6 +536,13 @@ public:
*/
string &getContent() { return _content; }
/**
* @brief body内容,
*
* @return
*/
void clearContent() { _content.clear(); }
/**
* append content
* @param append

View File

@ -18,7 +18,7 @@
#define __TC_MYSQL_H
#include "util/tc_ex.h"
// #include "mysql.h"
#include "mysql.h"
#include <map>
#include <vector>
#include <stdlib.h>