2022-01-17 20:57:21 +00:00
|
|
|
option (ENABLE_CAPNP "Enable Cap'n Proto" ${ENABLE_LIBRARIES})
|
|
|
|
|
|
|
|
if (NOT ENABLE_CAPNP)
|
|
|
|
message(STATUS "Not using Cap'n Proto library")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
set (CAPNPROTO_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/capnproto/c++/src")
|
2019-08-28 20:49:37 +00:00
|
|
|
|
2019-12-28 16:42:58 +00:00
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2019-08-28 20:49:37 +00:00
|
|
|
set (KJ_SRCS
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/array.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/common.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/debug.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/exception.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/io.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/memory.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/mutex.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/string.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/hash.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/table.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/thread.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/main.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/arena.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/test-helpers.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/units.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/encoding.c++"
|
2019-08-28 20:49:37 +00:00
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/refcount.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/string-tree.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/time.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/filesystem.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/filesystem-disk-unix.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/filesystem-disk-win32.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/kj/parse/char.c++"
|
2019-08-28 20:49:37 +00:00
|
|
|
)
|
|
|
|
|
2022-01-20 14:09:45 +00:00
|
|
|
add_library(_kj ${KJ_SRCS})
|
|
|
|
target_include_directories(_kj SYSTEM PUBLIC ${CAPNPROTO_SOURCE_DIR})
|
2019-08-28 20:49:37 +00:00
|
|
|
|
|
|
|
set (CAPNP_SRCS
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/c++.capnp.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/blob.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/arena.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/layout.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/list.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/any.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/message.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/schema.capnp.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/serialize.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/serialize-packed.c++"
|
2019-08-28 20:49:37 +00:00
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/schema.c++"
|
2021-10-04 13:02:32 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/stream.capnp.c++"
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/schema-loader.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/dynamic.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/stringify.c++"
|
2019-08-28 20:49:37 +00:00
|
|
|
)
|
|
|
|
|
2022-01-20 14:09:45 +00:00
|
|
|
add_library(_capnp ${CAPNP_SRCS})
|
|
|
|
set_target_properties(_capnp
|
2019-12-15 06:34:43 +00:00
|
|
|
PROPERTIES LINKER_LANGUAGE CXX
|
|
|
|
)
|
2022-01-20 14:09:45 +00:00
|
|
|
target_link_libraries(_capnp PUBLIC _kj)
|
2019-12-15 22:32:11 +00:00
|
|
|
|
2019-08-28 20:49:37 +00:00
|
|
|
set (CAPNPC_SRCS
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/type-id.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/error-reporter.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/lexer.capnp.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/lexer.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/grammar.capnp.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/parser.c++"
|
2021-10-05 11:12:54 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/generics.c++"
|
2021-04-24 19:47:52 +00:00
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/node-translator.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/compiler/compiler.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/schema-parser.c++"
|
|
|
|
"${CAPNPROTO_SOURCE_DIR}/capnp/serialize-text.c++"
|
2019-08-28 20:49:37 +00:00
|
|
|
)
|
|
|
|
|
2022-01-20 14:09:45 +00:00
|
|
|
add_library(_capnpc ${CAPNPC_SRCS})
|
|
|
|
target_link_libraries(_capnpc PUBLIC _capnp)
|
2019-12-18 20:01:16 +00:00
|
|
|
|
|
|
|
# The library has substandard code
|
|
|
|
if (COMPILER_GCC)
|
2020-09-04 00:39:56 +00:00
|
|
|
set (SUPPRESS_WARNINGS -w)
|
2019-12-18 20:01:16 +00:00
|
|
|
elseif (COMPILER_CLANG)
|
2020-09-04 00:39:56 +00:00
|
|
|
set (SUPPRESS_WARNINGS -w)
|
2020-09-01 16:07:26 +00:00
|
|
|
set (CAPNP_PRIVATE_CXX_FLAGS -fno-char8_t)
|
2019-12-18 20:01:16 +00:00
|
|
|
endif ()
|
|
|
|
|
2022-01-20 14:09:45 +00:00
|
|
|
target_compile_options(_kj PRIVATE ${SUPPRESS_WARNINGS} ${CAPNP_PRIVATE_CXX_FLAGS})
|
|
|
|
target_compile_options(_capnp PRIVATE ${SUPPRESS_WARNINGS} ${CAPNP_PRIVATE_CXX_FLAGS})
|
|
|
|
target_compile_options(_capnpc PRIVATE ${SUPPRESS_WARNINGS} ${CAPNP_PRIVATE_CXX_FLAGS})
|
2022-01-17 20:57:21 +00:00
|
|
|
|
2022-01-20 14:09:45 +00:00
|
|
|
add_library(ch_contrib::capnp ALIAS _capnpc)
|