Files
scylladb/cql3/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

146 lines
4.5 KiB
CMake

include(generate_cql_grammar)
find_package(ANTLR3 REQUIRED)
generate_cql_grammar(
GRAMMAR Cql.g
SOURCES cql_grammar_srcs)
set_source_files_properties(${cql_grammar_srcs}
PROPERTIES
COMPILE_OPTIONS "-Wno-uninitialized;-Wno-parentheses-equality")
set(cql_parser_srcs ${cql_grammar_srcs})
list(FILTER cql_parser_srcs INCLUDE REGEX "Parser.cpp$")
set(unoptimized_modes "Coverage,Debug,Sanitize")
set(sanitized_modes "Debug,Sanitize")
set_property(
SOURCE ${cql_parser_srcs}
APPEND
PROPERTY COMPILE_OPTIONS
# Unoptimized parsers end up using huge amounts of stack space and
# overflowing their stack
$<$<CONFIG:${unoptimized_modes}>:-O1>
# use-after-scope sanitizer also uses large amount of stack space
# and overflows the stack of CqlParser
$<$<CONFIG:${sanitized_modes}>:-fsanitize-address-use-after-scope>)
add_library(cql3 STATIC)
target_sources(cql3
PRIVATE
attributes.cc
cf_name.cc
cql3_type.cc
description.cc
operation.cc
index_name.cc
keyspace_element_name.cc
lists.cc
sets.cc
maps.cc
values.cc
expr/expression.cc
expr/restrictions.cc
expr/prepare_expr.cc
functions/user_function.cc
functions/functions.cc
functions/aggregate_fcts.cc
functions/castas_fcts.cc
functions/error_injection_fcts.cc
statements/cf_prop_defs.cc
statements/cf_statement.cc
statements/authentication_statement.cc
statements/create_keyspace_statement.cc
statements/create_table_statement.cc
statements/create_view_statement.cc
statements/create_type_statement.cc
statements/create_function_statement.cc
statements/create_aggregate_statement.cc
statements/drop_index_statement.cc
statements/drop_keyspace_statement.cc
statements/drop_table_statement.cc
statements/drop_view_statement.cc
statements/drop_type_statement.cc
statements/drop_function_statement.cc
statements/drop_aggregate_statement.cc
statements/schema_altering_statement.cc
statements/ks_prop_defs.cc
statements/function_statement.cc
statements/modification_statement.cc
statements/cas_request.cc
statements/raw/parsed_statement.cc
statements/property_definitions.cc
statements/update_statement.cc
statements/strongly_consistent_modification_statement.cc
statements/strongly_consistent_select_statement.cc
statements/delete_statement.cc
statements/prune_materialized_view_statement.cc
statements/batch_statement.cc
statements/select_statement.cc
statements/use_statement.cc
statements/index_prop_defs.cc
statements/index_target.cc
statements/create_index_statement.cc
statements/truncate_statement.cc
statements/alter_table_statement.cc
statements/alter_view_statement.cc
statements/list_users_statement.cc
statements/authorization_statement.cc
statements/permission_altering_statement.cc
statements/list_permissions_statement.cc
statements/grant_statement.cc
statements/revoke_statement.cc
statements/alter_type_statement.cc
statements/alter_keyspace_statement.cc
statements/role-management-statements.cc
statements/service_level_statement.cc
statements/create_service_level_statement.cc
statements/alter_service_level_statement.cc
statements/sl_prop_defs.cc
statements/drop_service_level_statement.cc
statements/attach_service_level_statement.cc
statements/detach_service_level_statement.cc
statements/list_service_level_statement.cc
statements/list_service_level_attachments_statement.cc
statements/list_effective_service_level_statement.cc
statements/describe_statement.cc
update_parameters.cc
util.cc
ut_name.cc
role_name.cc
column_identifier.cc
column_specification.cc
constants.cc
query_processor.cc
query_options.cc
user_types.cc
untyped_result_set.cc
selection/selectable.cc
selection/selection.cc
selection/selector.cc
restrictions/statement_restrictions.cc
result_set.cc
prepare_context.cc
${cql_grammar_srcs})
target_include_directories(cql3
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR})
target_link_libraries(cql3
PUBLIC
idl
wasmtime_bindings
Seastar::seastar
absl::headers
xxHash::xxhash
ANTLR3::antlr3
PRIVATE
lang
transport)
if (Scylla_USE_PRECOMPILED_HEADER_USE)
target_precompile_headers(cql3 REUSE_FROM scylla-precompiled-header)
endif()
check_headers(check-headers cql3
GLOB_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/*.hh)