fix build without CAPNP

This commit is contained in:
chertus 2018-07-13 16:47:13 +03:00
parent 4e0d9aa8d4
commit 2c4949dd5d
6 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,9 @@
option (ENABLE_CAPNP "Enable Cap'n Proto" ${NOT_MSVC})
unset (USE_CAPNP CACHE)
unset (USE_INTERNAL_CAPNP_LIBRARY CACHE)
unset (MISSING_INTERNAL_CAPNP_LIBRARY CACHE)
if (ENABLE_CAPNP)
# cmake 3.5.1 bug:
# capnproto uses this cmake feature:

View File

@ -1,5 +1,5 @@
add_library (clickhouse-client-lib Client.cpp)
target_link_libraries (clickhouse-client-lib clickhouse_functions clickhouse_aggregate_functions clickhouse_proto
target_link_libraries (clickhouse-client-lib clickhouse_functions clickhouse_aggregate_functions ${PROTO_LIB}
${LINE_EDITING_LIBS} ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_include_directories (clickhouse-client-lib SYSTEM PRIVATE ${READLINE_INCLUDE_DIR})

View File

@ -1082,7 +1082,9 @@ private:
return false;
case Protocol::Server::CapnProto:
#if USE_CAPNP
loadTableMetadata(packet.block, table_meta);
#endif
return receiveSampleBlock(out, table_meta);
default:

View File

@ -312,6 +312,7 @@ void TCPHandler::processInsertQuery(const Settings & global_settings)
*/
state.io.out->writePrefix();
#if USE_CAPNP
/// Send query metadata (column defaults)
if (global_settings.insert_sample_with_metadata &&
query_context.getSettingsRef().insert_sample_with_metadata)
@ -319,6 +320,7 @@ void TCPHandler::processInsertQuery(const Settings & global_settings)
Block meta_block = storeContextBlock(query_context);
sendMetadata(meta_block);
}
#endif
/// Send block to the client - table structure.
Block block = state.io.out->getHeader();

View File

@ -6,6 +6,7 @@ add_custom_command (OUTPUT ServerMessage.capnp.c++ ServerMessage.capnp.h
COMMAND ${CMAKE_COMMAND} -E env PATH=${CAPNP_PATH} ${CAPNP_BIN} compile -I ${CAPNP_INCLUDE_DIR} -oc++ ServerMessage.capnp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ServerMessage.capnp)
set (PROTO_LIB clickhouse_proto)
add_library (clickhouse_proto ServerMessage.capnp.c++ protoHelpers.cpp)
target_link_libraries (clickhouse_proto clickhouse_common_io ${CAPNP_LIBRARY})
target_include_directories (clickhouse_proto PUBLIC ${CAPNP_INCLUDE_DIR} ${DBMS_INCLUDE_DIR})

View File

@ -1,4 +1,5 @@
#pragma once
#if USE_CAPNP
namespace DB
{
@ -9,3 +10,5 @@ namespace DB
Block storeContextBlock(Context & context);
void loadTableMetadata(const Block & block, TableMetadata & table_meta);
}
#endif