add missing files

This commit is contained in:
taiyang-li 2021-11-08 18:41:30 +08:00
parent bb0feaa191
commit cd28324e1c
2 changed files with 87 additions and 0 deletions

23
cmake/find/thrift.cmake Normal file
View File

@ -0,0 +1,23 @@
option(ENABLE_THRIFT "Enable Thrift" ON)
option(USE_INTERNAL_THRIFT_LIBRARY "Set to FALSE to use system thrift library instead of bundled" ${NOT_UNBUNDLED})
if(ENABLE_THRIFT)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/thrift")
message (WARNING "submodule contrib is missing. to fix try run: \n git submodule update --init --recursive")
set (MISSING_THRIFT 1)
endif()
if (USE_INTERNAL_THRIFT_LIBRARY AND NOT MISSING_THRIFT)
if (MAKE_STATIC_LIBRARIES)
set(THRIFT_LIBRARY thrift_static)
else()
set(THRIFT_LIBRARY thrift)
endif()
set (THRIFT_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src")
set (THRIFT_COMPILER "thrift-compiler")
else()
find_library(THRIFT_LIBRARY thrift)
endif ()
endif()
message (STATUS "Using_THRIFT=${ENABLE_THRIFT}: ${THRIFT_INCLUDE_DIR} : ${THRIFT_LIBRARY}")

View File

@ -0,0 +1,64 @@
# === thrift
set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp")
set(thriftcpp_SOURCES
"${LIBRARY_DIR}/src/thrift/TApplicationException.cpp"
"${LIBRARY_DIR}/src/thrift/TOutput.cpp"
"${LIBRARY_DIR}/src/thrift/async/TAsyncChannel.cpp"
"${LIBRARY_DIR}/src/thrift/async/TAsyncProtocolProcessor.cpp"
"${LIBRARY_DIR}/src/thrift/async/TConcurrentClientSyncInfo.h"
"${LIBRARY_DIR}/src/thrift/async/TConcurrentClientSyncInfo.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/ThreadManager.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/TimerManager.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/Util.cpp"
"${LIBRARY_DIR}/src/thrift/processor/PeekProcessor.cpp"
"${LIBRARY_DIR}/src/thrift/protocol/TBase64Utils.cpp"
"${LIBRARY_DIR}/src/thrift/protocol/TDebugProtocol.cpp"
"${LIBRARY_DIR}/src/thrift/protocol/TJSONProtocol.cpp"
"${LIBRARY_DIR}/src/thrift/protocol/TMultiplexedProtocol.cpp"
"${LIBRARY_DIR}/src/thrift/protocol/TProtocol.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TTransportException.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TFDTransport.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TSimpleFileTransport.cpp"
"${LIBRARY_DIR}/src/thrift/transport/THttpTransport.cpp"
"${LIBRARY_DIR}/src/thrift/transport/THttpClient.cpp"
"${LIBRARY_DIR}/src/thrift/transport/THttpServer.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TSocket.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TSocketPool.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TServerSocket.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TTransportUtils.cpp"
"${LIBRARY_DIR}/src/thrift/transport/TBufferTransports.cpp"
"${LIBRARY_DIR}/src/thrift/server/TConnectedClient.cpp"
"${LIBRARY_DIR}/src/thrift/server/TServerFramework.cpp"
"${LIBRARY_DIR}/src/thrift/server/TSimpleServer.cpp"
"${LIBRARY_DIR}/src/thrift/server/TThreadPoolServer.cpp"
"${LIBRARY_DIR}/src/thrift/server/TThreadedServer.cpp"
)
set(thriftcpp_threads_SOURCES
"${LIBRARY_DIR}/src/thrift/concurrency/ThreadFactory.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/Thread.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/Monitor.cpp"
"${LIBRARY_DIR}/src/thrift/concurrency/Mutex.cpp"
)
add_library(${THRIFT_LIBRARY} ${thriftcpp_SOURCES} ${thriftcpp_threads_SOURCES})
# set_target_properties(${THRIFT_LIBRARY} PROPERTIES CXX_STANDARD 14) # REMOVE after https://github.com/apache/thrift/pull/1641
# target_include_directories(${THRIFT_LIBRARY} SYSTEM PUBLIC "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src")
target_include_directories(${THRIFT_LIBRARY} SYSTEM PUBLIC "${THRIFT_INCLUDE_DIR}")
target_link_libraries (${THRIFT_LIBRARY} PRIVATE boost::headers_only)
set(COMPILER_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/compiler/cpp")
configure_file(${COMPILER_DIR}/src/thrift/version.h.in ${COMPILER_DIR}/src/thrift/version.h)
set(thrift_compiler_SOURCES
${COMPILER_DIR}/src/thrift/main.cc
${COMPILER_DIR}/src/thrift/audit/t_audit.cpp
${COMPILER_DIR}/src/thrift/generate/t_cpp_generator.cc
${COMPILER_DIR}/src/thrift/common.cc
${COMPILER_DIR}/src/thrift/generate/t_generator.cc
${COMPILER_DIR}/src/thrift/parse/t_typedef.cc
${COMPILER_DIR}/src/thrift/parse/parse.cc
${COMPILER_DIR}/src/thrift/version.h
${COMPILER_DIR}/src/thrift/thrifty.cc
${COMPILER_DIR}/src/thrift/thriftl.cc
${COMPILER_DIR}/src/thrift/thrifty.hh
)
add_executable(${THRIFT_COMPILER} ${thrift_compiler_SOURCES})
include_directories(${THRIFT_COMPILER} SYSTEM ${COMPILER_DIR}/src)