ClickHouse/contrib/nuraft-cmake/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.6 KiB
CMake
Raw Permalink Normal View History

2022-01-17 18:45:54 +00:00
set(ENABLE_NURAFT_DEFAULT ${ENABLE_LIBRARIES})
if (OS_FREEBSD)
set(ENABLE_NURAFT_DEFAULT OFF)
message (STATUS "Using internal NuRaft library on FreeBSD and Darwin is not supported")
endif()
option(ENABLE_NURAFT "Enable NuRaft" ${ENABLE_NURAFT_DEFAULT})
if (NOT ENABLE_NURAFT)
message(STATUS "Not using NuRaft")
return()
endif()
set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/NuRaft")
2020-12-24 20:10:47 +00:00
2020-12-25 08:06:10 +00:00
set(SRCS
"${LIBRARY_DIR}/src/handle_priority.cxx"
"${LIBRARY_DIR}/src/buffer_serializer.cxx"
"${LIBRARY_DIR}/src/peer.cxx"
"${LIBRARY_DIR}/src/global_mgr.cxx"
"${LIBRARY_DIR}/src/buffer.cxx"
"${LIBRARY_DIR}/src/asio_service.cxx"
"${LIBRARY_DIR}/src/handle_client_request.cxx"
"${LIBRARY_DIR}/src/raft_server.cxx"
"${LIBRARY_DIR}/src/snapshot.cxx"
"${LIBRARY_DIR}/src/handle_commit.cxx"
"${LIBRARY_DIR}/src/error_code.cxx"
"${LIBRARY_DIR}/src/crc32.cxx"
"${LIBRARY_DIR}/src/handle_snapshot_sync.cxx"
"${LIBRARY_DIR}/src/stat_mgr.cxx"
"${LIBRARY_DIR}/src/handle_join_leave.cxx"
"${LIBRARY_DIR}/src/handle_user_cmd.cxx"
"${LIBRARY_DIR}/src/handle_custom_notification.cxx"
"${LIBRARY_DIR}/src/handle_vote.cxx"
"${LIBRARY_DIR}/src/launcher.cxx"
2024-04-02 09:10:09 +00:00
"${LIBRARY_DIR}/src/log_entry.cxx"
"${LIBRARY_DIR}/src/srv_config.cxx"
"${LIBRARY_DIR}/src/snapshot_sync_req.cxx"
2021-07-29 11:18:44 +00:00
"${LIBRARY_DIR}/src/snapshot_sync_ctx.cxx"
"${LIBRARY_DIR}/src/handle_timeout.cxx"
"${LIBRARY_DIR}/src/handle_append_entries.cxx"
"${LIBRARY_DIR}/src/cluster_config.cxx"
2020-12-24 20:10:47 +00:00
)
2022-01-17 18:45:54 +00:00
add_library(_nuraft ${SRCS})
2020-12-24 20:10:47 +00:00
2021-01-26 08:33:16 +00:00
if(NOT TARGET OpenSSL::Crypto)
2022-01-17 18:45:54 +00:00
target_compile_definitions(_nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1 SSL_LIBRARY_NOT_FOUND=1)
2021-01-26 08:33:16 +00:00
else()
2022-01-17 18:45:54 +00:00
target_compile_definitions(_nuraft PRIVATE USE_BOOST_ASIO=1 BOOST_ASIO_STANDALONE=1)
2021-01-26 08:33:16 +00:00
endif()
2020-12-24 20:10:47 +00:00
2024-04-02 18:44:52 +00:00
target_link_libraries (_nuraft PRIVATE clickhouse_common_io)
2024-04-04 14:36:12 +00:00
# We must have it PUBLIC here because some headers which depend on it directly
# included in clickhouse
2024-04-04 14:32:29 +00:00
target_compile_definitions(_nuraft PUBLIC USE_CLICKHOUSE_THREADS=1)
2024-04-02 18:44:52 +00:00
MESSAGE(STATUS "Will use clickhouse threads for NuRaft")
2022-01-17 18:45:54 +00:00
target_include_directories (_nuraft SYSTEM PRIVATE "${LIBRARY_DIR}/include/libnuraft")
2020-12-24 20:10:47 +00:00
# for some reason include "asio.h" directly without "boost/" prefix.
2022-01-17 18:45:54 +00:00
target_include_directories (_nuraft SYSTEM PRIVATE "${ClickHouse_SOURCE_DIR}/contrib/boost/boost")
2020-12-25 11:04:39 +00:00
2022-01-17 18:45:54 +00:00
target_link_libraries (_nuraft PRIVATE boost::headers_only boost::coroutine)
2020-12-24 20:10:47 +00:00
if(TARGET OpenSSL::Crypto)
2022-01-17 18:45:54 +00:00
target_link_libraries (_nuraft PRIVATE OpenSSL::Crypto OpenSSL::SSL)
2020-12-25 11:04:39 +00:00
endif()
2022-01-17 18:45:54 +00:00
target_include_directories (_nuraft SYSTEM PUBLIC "${LIBRARY_DIR}/include")
add_library(ch_contrib::nuraft ALIAS _nuraft)