Skip to content
127 changes: 24 additions & 103 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,90 +347,6 @@ add_subdirectory(src/clp/make_dictionaries_readable)
add_subdirectory(src/clp_s)
add_subdirectory(src/reducer)

set(SOURCE_FILES_clp_s_unitTest
src/clp_s/ArchiveReader.cpp
src/clp_s/ArchiveReader.hpp
src/clp_s/ArchiveReaderAdaptor.cpp
src/clp_s/ArchiveReaderAdaptor.hpp
src/clp_s/ArchiveWriter.cpp
src/clp_s/ArchiveWriter.hpp
src/clp_s/ColumnReader.cpp
src/clp_s/ColumnReader.hpp
src/clp_s/ColumnWriter.cpp
src/clp_s/ColumnWriter.hpp
src/clp_s/DictionaryEntry.cpp
src/clp_s/DictionaryEntry.hpp
src/clp_s/DictionaryWriter.cpp
src/clp_s/DictionaryWriter.hpp
src/clp_s/FileReader.cpp
src/clp_s/FileReader.hpp
src/clp_s/FileWriter.cpp
src/clp_s/FileWriter.hpp
src/clp_s/filter/tests/test-clp_s-bloom_filter.cpp
src/clp_s/filter/tests/test-clp_s-xxhash.cpp
src/clp_s/FloatFormatEncoding.cpp
src/clp_s/FloatFormatEncoding.hpp
src/clp_s/ffi/sfa/ClpArchiveReader.cpp
src/clp_s/ffi/sfa/ClpArchiveReader.hpp
src/clp_s/ffi/sfa/SfaErrorCode.cpp
src/clp_s/ffi/sfa/SfaErrorCode.hpp
src/clp_s/InputConfig.cpp
src/clp_s/InputConfig.hpp
src/clp_s/JsonConstructor.cpp
src/clp_s/JsonConstructor.hpp
src/clp_s/JsonFileIterator.cpp
src/clp_s/JsonFileIterator.hpp
src/clp_s/JsonParser.cpp
src/clp_s/JsonParser.hpp
src/clp_s/OutputHandlerImpl.cpp
src/clp_s/OutputHandlerImpl.hpp
src/clp_s/PackedStreamReader.cpp
src/clp_s/PackedStreamReader.hpp
src/clp_s/RangeIndexWriter.cpp
src/clp_s/RangeIndexWriter.hpp
src/clp_s/ReaderUtils.cpp
src/clp_s/ReaderUtils.hpp
src/clp_s/Schema.cpp
src/clp_s/Schema.hpp
src/clp_s/SchemaMap.cpp
src/clp_s/SchemaMap.hpp
src/clp_s/SchemaReader.cpp
src/clp_s/SchemaReader.hpp
src/clp_s/SchemaTree.cpp
src/clp_s/SchemaTree.hpp
src/clp_s/SchemaWriter.cpp
src/clp_s/SchemaWriter.hpp
src/clp_s/search/AddTimestampConditions.cpp
src/clp_s/search/AddTimestampConditions.hpp
src/clp_s/search/EvaluateRangeIndexFilters.cpp
src/clp_s/search/EvaluateRangeIndexFilters.hpp
src/clp_s/search/EvaluateTimestampIndex.cpp
src/clp_s/search/EvaluateTimestampIndex.hpp
src/clp_s/search/Output.cpp
src/clp_s/search/Output.hpp
src/clp_s/search/OutputHandler.hpp
src/clp_s/search/Projection.cpp
src/clp_s/search/Projection.hpp
src/clp_s/search/QueryRunner.cpp
src/clp_s/search/QueryRunner.hpp
src/clp_s/search/SchemaMatch.cpp
src/clp_s/search/SchemaMatch.hpp
src/clp_s/test/test_InputConfig.cpp
src/clp_s/TimestampDictionaryReader.cpp
src/clp_s/TimestampDictionaryReader.hpp
src/clp_s/TimestampDictionaryWriter.cpp
src/clp_s/TimestampDictionaryWriter.hpp
src/clp_s/TimestampEntry.cpp
src/clp_s/TimestampEntry.hpp
src/clp_s/timestamp_parser/test/test_TimestampParser.cpp
src/clp_s/Utils.cpp
src/clp_s/Utils.hpp
src/clp_s/ZstdCompressor.cpp
src/clp_s/ZstdCompressor.hpp
src/clp_s/ZstdDecompressor.cpp
src/clp_s/ZstdDecompressor.hpp
)

set(SOURCE_FILES_reducer_unitTest
src/reducer/BufferedSocketWriter.cpp
src/reducer/BufferedSocketWriter.hpp
Expand Down Expand Up @@ -714,8 +630,6 @@ set(SOURCE_FILES_unitTest
src/clp/version.hpp
src/clp/WriterInterface.cpp
src/clp/WriterInterface.hpp
tests/clp_s_test_utils.cpp
tests/clp_s_test_utils.hpp
tests/LogSuppressor.hpp
tests/MockLogTypeDictionary.hpp
tests/MockVariableDictionary.hpp
Expand All @@ -725,25 +639,18 @@ set(SOURCE_FILES_unitTest
tests/TestOutputCleaner.hpp
tests/test-BoundedReader.cpp
tests/test-BufferedReader.cpp
tests/test-clp_s-delta-encode-log-order.cpp
tests/test-clp_s-end_to_end.cpp
tests/test-clp_s-ffi_sfa_reader.cpp
tests/test-clp_s-range_index.cpp
tests/test-clp_s-search.cpp
tests/test-EncodedVariableInterpreter.cpp
tests/test-encoding_methods.cpp
tests/test-ffi_IrUnitHandlerReq.cpp
tests/test-ffi_KeyValuePairLogEvent.cpp
tests/test-ffi_SchemaTree.cpp
tests/test-FileDescriptorReader.cpp
tests/test-FloatFormatEncoding.cpp
tests/test-GlobalMetadataDBConfig.cpp
tests/test-GrepCore.cpp
tests/test-hash_utils.cpp
tests/test-ir_encoding_methods.cpp
tests/test-ir_parsing.cpp
tests/test-ir_serializer.cpp
tests/test-kql.cpp
tests/test-math_utils.cpp
tests/test-MemoryMappedFile.cpp
tests/test-NetworkReader.cpp
Expand All @@ -756,21 +663,41 @@ set(SOURCE_FILES_unitTest
tests/test-Stopwatch.cpp
tests/test-StreamingCompression.cpp
tests/test-string_utils.cpp
tests/test-sql.cpp
tests/test-TimestampPattern.cpp
tests/test-utf8_utils.cpp
tests/test-Utils.cpp
)

if(CLP_ENABLE_TESTS)
# Runtime dependencies built by clp-core for unit tests. Keep in sync with flags required by
# `CLP_BUILD_TESTING` in options.cmake.
add_library(clp_unit_test_runtime INTERFACE)
add_library(clp::unit_test_runtime ALIAS clp_unit_test_runtime)
target_link_libraries(clp_unit_test_runtime
INTERFACE
clp::regex_utils
clp::string_utils
clp_s::archive_reader
clp_s::archive_writer
clp_s::ffi::sfa
clp_s::filter
clp_s::json_constructor
clp_s::search
clp_s::search::ast
clp_s::search::kql
clp_s::search::sql
clp_s::timestamp_parser
clp_s::timestamp_pattern
)

add_executable(unitTest
${SOURCE_FILES_unitTest}
${SOURCE_FILES_clp_s_unitTest}
${SOURCE_FILES_reducer_unitTest}
)
target_include_directories(unitTest
PRIVATE
${CLP_SQLITE3_INCLUDE_DIRECTORY}
${CMAKE_CURRENT_SOURCE_DIR}/tests
)
target_link_libraries(unitTest
PRIVATE
Expand All @@ -781,13 +708,9 @@ if(CLP_ENABLE_TESTS)
Boost::regex
Boost::url
Catch2::Catch2WithMain
clp::unit_test_runtime
clp_s::unit_test_sources
${CURL_LIBRARIES}
clp_s::search::ast
clp_s::search::kql
clp_s::search::sql
clp_s::timestamp_parser
clp_s::timestamp_pattern
clp_s::filter
date::date
fmt::fmt
log_surgeon::log_surgeon
Expand All @@ -802,8 +725,6 @@ if(CLP_ENABLE_TESTS)
OpenSSL::Crypto
${sqlite_LIBRARY_DEPENDENCIES}
${STD_FS_LIBS}
clp::regex_utils
clp::string_utils
ystdlib::containers
ystdlib::error_handling
zstd::libzstd_static
Expand Down
75 changes: 52 additions & 23 deletions components/core/cmake/Options/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ option(
ON
)

option(
CLP_BUILD_CLP_S_ENABLE_CURL
"Include libcurl support for clp-s."
ON
)

option(
CLP_BUILD_CLP_S_FFI_SFA
"Build clp_s::ffi::sfa."
ON
)

option(
CLP_BUILD_CLP_S_FILTER
"Build clp_s::filter."
ON
)

option(
CLP_BUILD_CLP_S_IO
"Build clp_s::io."
Expand Down Expand Up @@ -95,18 +113,6 @@ option(
ON
)

option(
CLP_BUILD_CLP_S_ENABLE_CURL
"Include libcurl support for clp-s."
ON
)

option(
CLP_BUILD_CLP_S_FILTER
"Build clp_s::filter."
ON
)

# Validates that the `CLP_BUILD_` options required by `TARGET_CLP_BUILD_OPTION` are `ON`.
#
# @param {string} TARGET_CLP_BUILD_OPTION
Expand Down Expand Up @@ -173,8 +179,13 @@ function(validate_clp_tests_dependencies)
validate_clp_dependencies_for_target(CLP_BUILD_TESTING
CLP_BUILD_CLP_REGEX_UTILS
CLP_BUILD_CLP_STRING_UTILS
CLP_BUILD_CLP_S_ARCHIVEREADER
CLP_BUILD_CLP_S_ARCHIVEWRITER
CLP_BUILD_CLP_S_ENABLE_CURL
CLP_BUILD_CLP_S_FFI_SFA
CLP_BUILD_CLP_S_FILTER
CLP_BUILD_CLP_S_JSONCONSTRUCTOR
CLP_BUILD_CLP_S_SEARCH
CLP_BUILD_CLP_S_SEARCH_AST
CLP_BUILD_CLP_S_SEARCH_KQL
CLP_BUILD_CLP_S_SEARCH_SQL
Expand Down Expand Up @@ -277,6 +288,26 @@ function(set_clp_s_clp_dependencies_dependencies)
)
endfunction()

function(set_clp_s_enable_curl_dependencies)
set_clp_need_flags(
CLP_NEED_CURL
CLP_NEED_OPENSSL
)
endfunction()

function(validate_clp_s_ffi_sfa_dependencies)
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_FFI_SFA
CLP_BUILD_CLP_S_ARCHIVEREADER
)
endfunction()

function(set_clp_s_ffi_sfa_dependencies)
set_clp_need_flags(
CLP_NEED_SPDLOG
CLP_NEED_YSTDLIB
)
endfunction()

function(validate_clp_s_filter_dependencies)
validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_FILTER
CLP_BUILD_CLP_S_CLP_DEPENDENCIES
Expand Down Expand Up @@ -412,13 +443,6 @@ function(set_clp_s_timestamppattern_dependencies)
)
endfunction()

function(set_clp_s_enable_curl_dependencies)
set_clp_need_flags(
CLP_NEED_CURL
CLP_NEED_OPENSSL
)
endfunction()

# Validates that for each target whose `CLP_BUILD_` option is `ON`, the `CLP_BUILD_` options for
# the target's dependencies are also `ON`; Sets the required `CLP_NEED_` flags for any target that
# will be built.
Expand Down Expand Up @@ -455,6 +479,15 @@ function(validate_and_setup_all_clp_dependency_flags)
set_clp_s_clp_dependencies_dependencies()
endif()

if (CLP_BUILD_CLP_S_ENABLE_CURL)
set_clp_s_enable_curl_dependencies()
endif()

if (CLP_BUILD_CLP_S_FFI_SFA)
validate_clp_s_ffi_sfa_dependencies()
set_clp_s_ffi_sfa_dependencies()
endif()

if (CLP_BUILD_CLP_S_FILTER)
validate_clp_s_filter_dependencies()
set_clp_s_filter_dependencies()
Expand Down Expand Up @@ -503,10 +536,6 @@ function(validate_and_setup_all_clp_dependency_flags)
validate_clp_s_timestamppattern_dependencies()
set_clp_s_timestamppattern_dependencies()
endif()

if (CLP_BUILD_CLP_S_ENABLE_CURL)
set_clp_s_enable_curl_dependencies()
endif()
endfunction()

function (convert_clp_dependency_properties_to_variables)
Expand Down
51 changes: 42 additions & 9 deletions components/core/src/clp_s/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,24 @@ set(
)

if(CLP_BUILD_EXECUTABLES)
# Runtime dependencies built by clp-s for the executable. Keep in sync with
# `CLP_BUILD_CLP_S_*` flags required by `CLP_BUILD_EXECUTABLES` inside options.cmake.
add_library(clp_s_binary_runtime INTERFACE)
target_link_libraries(
clp_s_binary_runtime
INTERFACE
clp_s::archive_reader
clp_s::archive_writer
clp_s::clp_dependencies
clp_s::io
clp_s::json_constructor
clp_s::reducer_dependencies
clp_s::search
clp_s::search::ast
clp_s::search::kql
clp_s::timestamp_parser
)

add_executable(
clp-s
clp-s.cpp
Expand All @@ -478,15 +496,7 @@ if(CLP_BUILD_EXECUTABLES)
clp-s
PRIVATE
Boost::program_options
clp_s::archive_reader
clp_s::archive_writer
clp_s::clp_dependencies
clp_s::io
clp_s::json_constructor
clp_s::reducer_dependencies
clp_s::search
clp_s::search::ast
clp_s::search::kql
clp_s_binary_runtime
${MONGOCXX_TARGET}
msgpack-cxx
spdlog::spdlog
Expand All @@ -498,3 +508,26 @@ if(CLP_BUILD_EXECUTABLES)
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
endif()

if(CLP_BUILD_TESTING)
add_library(clp_s_unit_test_sources INTERFACE)
add_library(clp_s::unit_test_sources ALIAS clp_s_unit_test_sources)
target_sources(
clp_s_unit_test_sources
INTERFACE
filter/tests/test-clp_s-bloom_filter.cpp
filter/tests/test-clp_s-xxhash.cpp
tests/clp_s_test_utils.cpp
tests/clp_s_test_utils.hpp
tests/test-FloatFormatEncoding.cpp
tests/test-clp_s-delta-encode-log-order.cpp
tests/test-clp_s-end_to_end.cpp
tests/test-clp_s-ffi_sfa_reader.cpp
tests/test-clp_s-range_index.cpp
tests/test-clp_s-search.cpp
tests/test-kql.cpp
tests/test-sql.cpp
tests/test_InputConfig.cpp
timestamp_parser/test/test_TimestampParser.cpp
)
endif()
2 changes: 1 addition & 1 deletion components/core/src/clp_s/ffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(
sfa/ClpArchiveReader.hpp
)

if(CLP_BUILD_CLP_S_ARCHIVEREADER)
if(CLP_BUILD_CLP_S_FFI_SFA)
add_library(
clp_s_ffi_sfa
${CLP_S_FFI_SFA_SOURCES}
Expand Down
Loading
Loading