Files
scylladb/service/CMakeLists.txt
Radosław Cybulski d589e68642 Add precompiled headers to CMakeLists.txt
Add precompiled header support to CMakeLists.txt and configure.py -
it improves compilation time by approximately 10%.

New header `stdafx.hh` is added, don't include it manually -
the compiler will include it for you. The header contains includes from
external libraries used by Scylla - seastar, standard library,
linux headers and zlib.

The feature is enabled by default, use CMake option `Scylla_USE_PRECOMPILED_HEADER`
or configure.py --disable-precompiled-header to disable.

The feature should be disabled, when trying to check headers - otherwise
you might get false negatives on missing includes from seastar / abseil and so on.

Note: following configuration needs to be added to ccache.conf:

    sloppiness = pch_defines,time_macros,include_file_mtime,include_file_ctime

Closes scylladb/scylladb#26617
2025-11-21 12:27:41 +02:00

75 lines
1.9 KiB
CMake

add_library(service STATIC)
target_sources(service
PRIVATE
broadcast_tables/experimental/lang.cc
client_state.cc
mapreduce_service.cc
migration_manager.cc
misc_services.cc
pager/paging_state.cc
pager/query_pagers.cc
paxos/paxos_state.cc
paxos/prepare_response.cc
paxos/prepare_summary.cc
paxos/proposal.cc
qos/qos_common.cc
qos/service_level_controller.cc
qos/standard_service_level_distributed_data_accessor.cc
qos/raft_service_level_distributed_data_accessor.cc
raft/discovery.cc
raft/group0_state_id_handler.cc
raft/group0_state_machine.cc
raft/group0_state_machine_merger.cc
raft/group0_voter_handler.cc
raft/raft_group0.cc
raft/raft_group0_client.cc
raft/raft_group_registry.cc
raft/raft_rpc.cc
raft/raft_sys_table_storage.cc
session.cc
storage_proxy.cc
storage_service.cc
tablet_allocator.cc
task_manager_module.cc
topology_coordinator.cc
topology_mutation.cc
topology_state_machine.cc)
target_include_directories(service
PUBLIC
${CMAKE_SOURCE_DIR})
target_link_libraries(service
PUBLIC
db
absl::headers
Seastar::seastar
xxHash::xxhash
PRIVATE
cql3
mutation
node_ops
raft
repair
streaming
systemd)
if (Scylla_USE_PRECOMPILED_HEADER_USE)
target_precompile_headers(service REUSE_FROM scylla-precompiled-header)
endif()
check_headers(check-headers service
GLOB_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/*.hh)
add_library(storage_proxy.o OBJECT EXCLUDE_FROM_ALL
storage_proxy.cc)
target_include_directories(storage_proxy.o
PRIVATE
${CMAKE_SOURCE_DIR})
target_link_libraries(storage_proxy.o
absl::headers
Seastar::seastar
xxHash::xxhash
idl)
add_custom_target(maybe-storage-proxy
DEPENDS $<$<CONFIG:RelWithDebInfo,Debug>:storage_proxy.o>)
add_dependencies(compiler-training
maybe-storage-proxy)