From 19d49014ac896b9d8b942649e5f92e15629031c5 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 15 Jul 2025 18:48:47 +0000 Subject: [PATCH 01/24] Encapsulate logic for finding,setting up, and logging found dependencies in functions in cmake/Utils/utils.cmake. --- components/core/CMakeLists.txt | 166 +++--------------- components/core/cmake/Utils/utils.cmake | 220 ++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 142 deletions(-) create mode 100644 components/core/cmake/Utils/utils.cmake diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index f71f7056ea..d77e0b439f 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -15,6 +15,9 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Options/options.cmake") validate_and_setup_all_clp_dependency_flags() convert_clp_dependency_properties_to_variables() +# Include utilities to find and configure dependencies +include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Utils/utils.cmake") + if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(default_build_type "Release") message(STATUS "No build type specified. Setting to '${default_build_type}'.") @@ -128,211 +131,90 @@ if(PROJECT_IS_TOP_LEVEL) endif() if(CLP_NEED_ABSL) - find_package(absl REQUIRED) - if (absl_FOUND) - message(STATUS "Found absl ${absl_VERSION}") - endif() + find_absl() endif() -# Find and setup ANTLR Library if(CLP_NEED_ANTLR) - find_package(antlr4-runtime REQUIRED) - if (antlr4-runtime_FOUND) - message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") - endif() + find_antlr() endif() -# Find and setup Boost Library if(CLP_NEED_BOOST) - if(CLP_USE_STATIC_LIBS) - set(Boost_USE_STATIC_LIBS ON) - endif() - find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url) - if(Boost_FOUND) - message(STATUS "Found Boost ${Boost_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") - endif() + find_boost() endif() if(CLP_NEED_CATCH2) - find_package(Catch2 REQUIRED) - if (Catch2_FOUND) - message(STATUS "Found Catch2 ${Catch2_VERSION}") - endif() + find_catch2() endif() if(CLP_NEED_DATE) - find_package(date REQUIRED) - if (date_FOUND) - message(STATUS "Found date ${date_VERSION}") - endif() + find_date() endif() if(CLP_NEED_FMT) - find_package(fmt REQUIRED) - if(fmt_FOUND) - message(STATUS "Found fmt ${fmt_VERSION}") - endif() + find_fmt() endif() if(CLP_NEED_LOG_SURGEON) - find_package(log_surgeon REQUIRED) - if(log_surgeon_FOUND) - message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") - endif() + find_log_surgeon() endif() if(CLP_NEED_NLOHMANN_JSON) - find_package(nlohmann_json REQUIRED) - if(nlohmann_json_FOUND) - message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") - endif() + find_nlohmann_json() endif() if(CLP_NEED_SIMDJSON) - find_package(simdjson REQUIRED) - if(simdjson_FOUND) - message(STATUS "Found simdjson ${simdjson_VERSION}") - endif() + find_simdjson() endif() if(CLP_NEED_SPDLOG) - find_package(spdlog REQUIRED) - if(spdlog_FOUND) - message(STATUS "Found spdlog ${spdlog_VERSION}") - endif() + find_spdlog() endif() -# Find and setup libarchive if(CLP_NEED_LIBARCHIVE) - if(CLP_USE_STATIC_LIBS) - set(LibArchive_USE_STATIC_LIBS ON) - endif() - find_package(LibArchive REQUIRED) - if(LibArchive_FOUND) - message(STATUS "Found LibArchive ${LibArchive_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for LibArchive") - endif() + find_libarchive() endif() -# Find and setup libcurl -# By default, CURL does not provide static libraries if(CLP_NEED_CURL) - find_package(CURL 7.61.1 REQUIRED) - if(CURL_FOUND) - message(STATUS "Found CURL ${CURL_VERSION_STRING}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL") - endif() + find_curl() endif() -# Find OpenSSL if(CLP_NEED_OPENSSL) - find_package(OpenSSL REQUIRED) - if(OPENSSL_FOUND) - message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") - else() - message(FATAL_ERROR "OpenSSL not found") - endif() + find_openssl() endif() -# Find and setup MariaDBClient library if(CLP_NEED_MARIADB) - if(CLP_USE_STATIC_LIBS) - # NOTE: We can't statically link to MariaDBClient since it's GPL - message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") - endif() - find_package(MariaDBClient 3.1.0 REQUIRED) - if(MariaDBClient_FOUND) - message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient") - endif() + find_mariadb() endif() -# Find and setup mongocxx if(CLP_NEED_MONGOCXX) - find_package(mongocxx REQUIRED) - message(STATUS "Found mongocxx ${mongocxx_VERSION}") - if(CLP_USE_STATIC_LIBS) - set(MONGOCXX_TARGET mongo::mongocxx_static) - else() - set(MONGOCXX_TARGET mongo::mongocxx_shared) - endif() + find_mongocxx() endif() -# Find and setup msgpack if(CLP_NEED_MSGPACKCXX) - find_package(msgpack-cxx 7.0.0 REQUIRED) - if(msgpack-cxx_FOUND) - message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") - else() - message(FATAL_ERROR "Could not find msgpack-cxx") - endif() + find_msgpack() endif() find_package(Threads REQUIRED) if(CLP_NEED_YAMLCPP) - find_package(yaml-cpp REQUIRED) - if(yaml-cpp_FOUND) - message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") - endif() + find_yamlcpp() endif() -# Add ystdlib if(CLP_NEED_YSTDLIB) - set(YSTDLIB_CPP_BUILD_TESTING OFF) - add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL) + find_ystdlib() endif() -# Find and setup ZStd Library if(CLP_NEED_ZSTD) - if(CLP_USE_STATIC_LIBS) - set(ZStd_USE_STATIC_LIBS ON) - endif() - find_package(ZStd 1.4.4 REQUIRED) - if(ZStd_FOUND) - message(STATUS "Found ZStd ${ZStd_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd") - endif() + find_zstd() endif() -# Find and setup LZMA Library -# TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode if(CLP_NEED_LZMA) - if(CLP_USE_STATIC_LIBS) - set(LIBLZMA_USE_STATIC_LIBS ON) - endif() - find_package(LibLZMA REQUIRED) - if(LIBLZMA_FOUND) - message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}") - message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}") - message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}") - - # Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115. - set(REQUIRED_LIBLZMA_VERSION "5.8.1") - if(LIBLZMA_VERSION_STRING VERSION_LESS ${REQUIRED_LIBLZMA_VERSION}) - message( - FATAL_ERROR - "Detected LibLZMA version ${LIBLZMA_VERSION_STRING} is older than required" - " ${REQUIRED_LIBLZMA_VERSION}" - ) - endif() - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma") - endif() - include_directories(${LIBLZMA_INCLUDE_DIRS}) + find_lzma() endif() # sqlite dependencies if(CLP_NEED_SQLITE) - set(sqlite_DYNAMIC_LIBS "dl;m;pthread") - include(cmake/Modules/FindLibraryDependencies.cmake) - FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") + find_sqlite() endif() add_subdirectory(src/clp/regex_utils) diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake new file mode 100644 index 0000000000..b29230f6df --- /dev/null +++ b/components/core/cmake/Utils/utils.cmake @@ -0,0 +1,220 @@ +# This file contains utility functions for our other cmake scripts. + +# Find and setup abseil library. +function(find_absl) + find_package(absl REQUIRED) + if (absl_FOUND) + message(STATUS "Found absl ${absl_VERSION}") + endif() +endfunction() + +# Find and setup ANTLR library. +function(find_antlr) + find_package(antlr4-runtime REQUIRED) + if (antlr4-runtime_FOUND) + message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") + endif() +endfunction() + +# Find and setup Boost library. +function(find_boost) + if(CLP_USE_STATIC_LIBS) + set(Boost_USE_STATIC_LIBS ON) + endif() + find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url) + if(Boost_FOUND) + message(STATUS "Found Boost ${Boost_VERSION}") + else() + message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") + endif() +endfunction() + +# Find and setup Catch2 library. +function(find_catch2) + find_package(Catch2 REQUIRED) + if (Catch2_FOUND) + message(STATUS "Found Catch2 ${Catch2_VERSION}") + endif() +endfunction() + +# Find and setup libcurl. +# By default, CURL does not provide static libraries. +# @return The list of libraries needed to link against CURL in the CURL_LIBRARIES variable. +function(find_curl) + find_package(CURL 7.61.1 REQUIRED) + if(CURL_FOUND) + message(STATUS "Found CURL ${CURL_VERSION_STRING}") + set(CURL_LIBRARIES ${CURL_LIBRARIES} PARENT_SCOPE) + else() + message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL") + endif() +endfunction() + +# Find and setup date library. +function(find_date) + find_package(date REQUIRED) + if (date_FOUND) + message(STATUS "Found date ${date_VERSION}") + endif() +endfunction() + +# Find and setup fmt library. +function(find_fmt) + if(CLP_NEED_FMT) + find_package(fmt REQUIRED) + if(fmt_FOUND) + message(STATUS "Found fmt ${fmt_VERSION}") + endif() + endif() +endfunction() + +# Find and setup libarchive. +function(find_libarchive) + if(CLP_USE_STATIC_LIBS) + set(LibArchive_USE_STATIC_LIBS ON) + endif() + find_package(LibArchive REQUIRED) + if(LibArchive_FOUND) + message(STATUS "Found LibArchive ${LibArchive_VERSION}") + endif() +endfunction() + +# Find and setup log_surgeon library. +function(find_log_surgeon) + find_package(log_surgeon REQUIRED) + if(log_surgeon_FOUND) + message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") + endif() +endfunction() + +# Find and setup LZMA library. +# TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode. +function(find_lzma) + if(CLP_USE_STATIC_LIBS) + set(LIBLZMA_USE_STATIC_LIBS ON) + endif() + find_package(LibLZMA REQUIRED) + if(LIBLZMA_FOUND) + message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}") + message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}") + message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}") + + # Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115. + set(REQUIRED_LIBLZMA_VERSION "5.8.1") + if(LIBLZMA_VERSION_STRING VERSION_LESS ${REQUIRED_LIBLZMA_VERSION}) + message( + FATAL_ERROR + "Detected LibLZMA version ${LIBLZMA_VERSION_STRING} is older than required" + " ${REQUIRED_LIBLZMA_VERSION}" + ) + endif() + else() + message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma") + endif() + include_directories(${LIBLZMA_INCLUDE_DIRS}) +endfunction() + + +# Find and setup MariaDBClient library. +function(find_mariadb) + if(CLP_USE_STATIC_LIBS) + # NOTE: We can't statically link to MariaDBClient since it's GPL + message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") + endif() + find_package(MariaDBClient 3.1.0 REQUIRED) + if(MariaDBClient_FOUND) + message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}") + else() + message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient") + endif() +endfunction() + +# Find and setup mongocxx library. +# @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable. +function(find_mongocxx) + find_package(mongocxx REQUIRED) + message(STATUS "Found mongocxx ${mongocxx_VERSION}") + if(CLP_USE_STATIC_LIBS) + set(MONGOCXX_TARGET mongo::mongocxx_static PARENT_SCOPE) + else() + set(MONGOCXX_TARGET mongo::mongocxx_shared PARENT_SCOPE) + endif() +endfunction() + +# Find and setup msgpack library. +function(find_msgpack) + find_package(msgpack-cxx 7.0.0 REQUIRED) + if(msgpack-cxx_FOUND) + message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") + else() + message(FATAL_ERROR "Could not find msgpack-cxx") + endif() +endfunction() + +# Find and setup nlohmann_json library. +function(find_nlohmann_json) + find_package(nlohmann_json REQUIRED) + if(nlohmann_json_FOUND) + message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") + endif() +endfunction() + +# Find and setup OpenSSL library. +function(find_openssl) + find_package(OpenSSL REQUIRED) + if(OPENSSL_FOUND) + message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") + else() + message(FATAL_ERROR "OpenSSL not found") + endif() +endfunction() + +# Find and setup simdjson library. +function(find_simdjson) + find_package(simdjson REQUIRED) + if(simdjson_FOUND) + message(STATUS "Found simdjson ${simdjson_VERSION}") + endif() +endfunction() + +# Find and setup spdlog library. +function(find_spdlog) + find_package(spdlog REQUIRED) + if(spdlog_FOUND) + message(STATUS "Found spdlog ${spdlog_VERSION}") + endif() +endfunction() + +# Find and setup sqlite library. +function(find_sqlite) + set(sqlite_DYNAMIC_LIBS "dl;m;pthread") + include(cmake/Modules/FindLibraryDependencies.cmake) + FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") +endfunction() + +# Find and setup yamlcpp library. +function(find_yamlcpp) + find_package(yaml-cpp REQUIRED) + if(yaml-cpp_FOUND) + message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") + endif() +endfunction() + +# Find and setup ystdlib. +function(find_ystdlib) + set(YSTDLIB_CPP_BUILD_TESTING OFF) + add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL) +endfunction() + +# Find and setup ZStd library. +function(find_zstd) + if(CLP_USE_STATIC_LIBS) + set(ZStd_USE_STATIC_LIBS ON) + endif() + find_package(ZStd 1.4.4 REQUIRED) + if(ZStd_FOUND) + message(STATUS "Found ZStd ${ZStd_VERSION}") + else() + message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd") + endif() +endfunction() From d60ffffa4af6e1bfce2ab88cfce62f9aff60f13c Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 15 Jul 2025 19:52:39 +0000 Subject: [PATCH 02/24] Update cmake scripts to point of just working after removing CLP_NEED_X flags. --- components/core/CMakeLists.txt | 110 ++-------- components/core/cmake/Modules/FindLZ4.cmake | 2 +- .../core/cmake/Modules/FindLibArchive.cmake | 2 +- .../cmake/Modules/FindMariaDBClient.cmake | 2 +- components/core/cmake/Modules/FindZStd.cmake | 2 +- components/core/cmake/Options/options.cmake | 202 +----------------- components/core/cmake/Utils/utils.cmake | 27 ++- components/core/src/clp/clg/CMakeLists.txt | 12 ++ components/core/src/clp/clo/CMakeLists.txt | 12 ++ components/core/src/clp/clp/CMakeLists.txt | 13 ++ .../make_dictionaries_readable/CMakeLists.txt | 6 + .../core/src/clp/regex_utils/CMakeLists.txt | 2 + components/core/src/clp_s/CMakeLists.txt | 47 ++++ .../core/src/clp_s/indexer/CMakeLists.txt | 13 ++ .../core/src/clp_s/search/CMakeLists.txt | 4 + .../core/src/clp_s/search/ast/CMakeLists.txt | 2 + .../core/src/clp_s/search/kql/CMakeLists.txt | 3 + .../core/src/clp_s/search/sql/CMakeLists.txt | 3 + components/core/src/glt/glt/CMakeLists.txt | 12 ++ components/core/src/reducer/CMakeLists.txt | 7 + 20 files changed, 188 insertions(+), 295 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index d77e0b439f..81ab6d2c56 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -12,8 +12,7 @@ validate_compiler_versions() # Include options for CLP build include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Options/options.cmake") -validate_and_setup_all_clp_dependency_flags() -convert_clp_dependency_properties_to_variables() +validate_all_clp_dependency_flags() # Include utilities to find and configure dependencies include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Utils/utils.cmake") @@ -130,93 +129,6 @@ if(PROJECT_IS_TOP_LEVEL) endif() endif() -if(CLP_NEED_ABSL) - find_absl() -endif() - -if(CLP_NEED_ANTLR) - find_antlr() -endif() - -if(CLP_NEED_BOOST) - find_boost() -endif() - -if(CLP_NEED_CATCH2) - find_catch2() -endif() - -if(CLP_NEED_DATE) - find_date() -endif() - -if(CLP_NEED_FMT) - find_fmt() -endif() - -if(CLP_NEED_LOG_SURGEON) - find_log_surgeon() -endif() - -if(CLP_NEED_NLOHMANN_JSON) - find_nlohmann_json() -endif() - -if(CLP_NEED_SIMDJSON) - find_simdjson() -endif() - -if(CLP_NEED_SPDLOG) - find_spdlog() -endif() - -if(CLP_NEED_LIBARCHIVE) - find_libarchive() -endif() - -if(CLP_NEED_CURL) - find_curl() -endif() - -if(CLP_NEED_OPENSSL) - find_openssl() -endif() - -if(CLP_NEED_MARIADB) - find_mariadb() -endif() - -if(CLP_NEED_MONGOCXX) - find_mongocxx() -endif() - -if(CLP_NEED_MSGPACKCXX) - find_msgpack() -endif() - -find_package(Threads REQUIRED) - -if(CLP_NEED_YAMLCPP) - find_yamlcpp() -endif() - -if(CLP_NEED_YSTDLIB) - find_ystdlib() -endif() - -if(CLP_NEED_ZSTD) - find_zstd() -endif() - -if(CLP_NEED_LZMA) - find_lzma() -endif() - -# sqlite dependencies -if(CLP_NEED_SQLITE) - find_sqlite() -endif() - add_subdirectory(src/clp/regex_utils) add_subdirectory(src/clp/string_utils) @@ -614,6 +526,26 @@ set(SOURCE_FILES_unitTest ) if(CLP_BUILD_TESTING) + find_absl() + find_boost() + find_catch2() + find_curl() + find_date() + find_fmt() + find_libarchive() + find_log_surgeon() + find_mariadb() + find_mongocxx() + find_nlohmann_json() + find_openssl() + find_simdjson() + find_spdlog() + find_sqlite() + find_yamlcpp() + find_ystdlib() + find_lzma() + find_zstd() + add_executable(unitTest ${SOURCE_FILES_unitTest} ${SOURCE_FILES_clp_s_unitTest} diff --git a/components/core/cmake/Modules/FindLZ4.cmake b/components/core/cmake/Modules/FindLZ4.cmake index 66ad14ff0d..b8c7a592fb 100644 --- a/components/core/cmake/Modules/FindLZ4.cmake +++ b/components/core/cmake/Modules/FindLZ4.cmake @@ -13,7 +13,7 @@ set(lz4_LIBNAME "lz4") -include(cmake/Modules/FindLibraryDependencies.cmake) +include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") # Run pkg-config find_package(PkgConfig) diff --git a/components/core/cmake/Modules/FindLibArchive.cmake b/components/core/cmake/Modules/FindLibArchive.cmake index c257e88341..3845094320 100644 --- a/components/core/cmake/Modules/FindLibArchive.cmake +++ b/components/core/cmake/Modules/FindLibArchive.cmake @@ -14,7 +14,7 @@ set(libarchive_LIBNAME "archive") -include(cmake/Modules/FindLibraryDependencies.cmake) +include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") # On macOS, libarchive installed through brew is not linked into prefix by default. # So it cannot be found by pkg-config and we need to manually find it. diff --git a/components/core/cmake/Modules/FindMariaDBClient.cmake b/components/core/cmake/Modules/FindMariaDBClient.cmake index 5801be2e6b..091229cbd9 100644 --- a/components/core/cmake/Modules/FindMariaDBClient.cmake +++ b/components/core/cmake/Modules/FindMariaDBClient.cmake @@ -14,7 +14,7 @@ set(mariadbclient_LIBNAME "mariadb") -include(cmake/Modules/FindLibraryDependencies.cmake) +include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") # Run pkg-config find_package(PkgConfig) diff --git a/components/core/cmake/Modules/FindZStd.cmake b/components/core/cmake/Modules/FindZStd.cmake index 503dfebfac..672aa75f92 100644 --- a/components/core/cmake/Modules/FindZStd.cmake +++ b/components/core/cmake/Modules/FindZStd.cmake @@ -13,7 +13,7 @@ set(zstd_LIBNAME "zstd") -include(cmake/Modules/FindLibraryDependencies.cmake) +include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") # Run pkg-config find_package(PkgConfig) diff --git a/components/core/cmake/Options/options.cmake b/components/core/cmake/Options/options.cmake index ad125cfcc4..97a86e2607 100644 --- a/components/core/cmake/Options/options.cmake +++ b/components/core/cmake/Options/options.cmake @@ -105,15 +105,6 @@ function(validate_clp_dependencies_for_target TARGET_CLP_BUILD_OPTION) endforeach() endfunction() -# Sets the given `CLP_NEED_` flags as directory properties -# -# @param {string[]} ARGV The `CLP_NEED_` flags to set. -function(set_clp_need_flags) - foreach(NEEDS_FLAG IN LISTS ARGV) - set_property(DIRECTORY PROPERTY "${NEEDS_FLAG}" ON) - endforeach() -endfunction() - function(validate_clp_binaries_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_EXECUTABLES CLP_BUILD_CLP_STRING_UTILS @@ -129,29 +120,6 @@ function(validate_clp_binaries_dependencies) ) endfunction() -function(set_clp_binaries_dependencies) - set_clp_need_flags( - CLP_NEED_ABSL - CLP_NEED_BOOST - CLP_NEED_CURL - CLP_NEED_DATE - CLP_NEED_FMT - CLP_NEED_LIBARCHIVE - CLP_NEED_LOG_SURGEON - CLP_NEED_MARIADB - CLP_NEED_MONGOCXX - CLP_NEED_MSGPACKCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_OPENSSL - CLP_NEED_SIMDJSON - CLP_NEED_SPDLOG - CLP_NEED_SQLITE - CLP_NEED_YAMLCPP - CLP_NEED_YSTDLIB - CLP_NEED_ZSTD - ) -endfunction() - function(validate_clp_tests_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_TESTING CLP_BUILD_CLP_REGEX_UTILS @@ -163,29 +131,6 @@ function(validate_clp_tests_dependencies) ) endfunction() -function(set_clp_tests_dependencies) - set_clp_need_flags( - CLP_NEED_ABSL - CLP_NEED_BOOST - CLP_NEED_CATCH2 - CLP_NEED_DATE - CLP_NEED_FMT - CLP_NEED_LIBARCHIVE - CLP_NEED_LOG_SURGEON - CLP_NEED_LZMA - CLP_NEED_MARIADB - CLP_NEED_MONGOCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_OPENSSL - CLP_NEED_SIMDJSON - CLP_NEED_SPDLOG - CLP_NEED_SQLITE - CLP_NEED_YAMLCPP - CLP_NEED_YSTDLIB - CLP_NEED_ZSTD - ) -endfunction() - function(validate_clp_regex_utils_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_REGEX_UTILS CLP_BUILD_CLP_STRING_UTILS @@ -204,18 +149,6 @@ function(validate_clp_s_archivereader_dependencies) ) endfunction() -function(set_clp_s_archivereader_dependencies) - set_clp_need_flags( - CLP_NEED_ABSL - CLP_NEED_BOOST - CLP_NEED_CURL - CLP_NEED_FMT - CLP_NEED_MSGPACKCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_archivewriter_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_ARCHIVEWRITER CLP_BUILD_CLP_S_CLP_DEPENDENCIES @@ -224,80 +157,30 @@ function(validate_clp_s_archivewriter_dependencies) ) endfunction() -function(set_clp_s_archivewriter_dependencies) - set_clp_need_flags( - CLP_NEED_ABSL - CLP_NEED_BOOST - CLP_NEED_CURL - CLP_NEED_FMT - CLP_NEED_MSGPACKCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_SIMDJSON - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_clp_dependencies_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_CLP_DEPENDENCIES CLP_BUILD_CLP_STRING_UTILS ) endfunction() -function(set_clp_s_clp_dependencies_dependencies) - set_clp_need_flags( - CLP_NEED_BOOST - CLP_NEED_CURL - CLP_NEED_FMT - CLP_NEED_MSGPACKCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_OPENSSL - CLP_NEED_SPDLOG - CLP_NEED_YSTDLIB - CLP_NEED_ZSTD - ) -endfunction() - function(validate_clp_s_io_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_IO CLP_BUILD_CLP_S_CLP_DEPENDENCIES ) endfunction() -function(set_clp_s_io_dependencies) - set_clp_need_flags( - CLP_NEED_BOOST - CLP_NEED_FMT - CLP_NEED_SPDLOG - CLP_NEED_ZSTD - ) -endfunction() - function(validate_clp_s_json_constructor_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_JSONCONSTRUCTOR CLP_BUILD_CLP_S_ARCHIVEREADER ) endfunction() -function(set_clp_s_json_constructor_dependencies) - set_clp_need_flags( - CLP_NEED_FMT - CLP_NEED_MONGOCXX - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_reducer_dependencies_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES CLP_BUILD_CLP_S_CLP_DEPENDENCIES ) endfunction() -function(set_clp_s_reducer_dependencies_dependencies) - set_clp_need_flags( - CLP_NEED_NLOHMANN_JSON - ) -endfunction() - function(validate_clp_s_search_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH CLP_BUILD_CLP_S_ARCHIVEREADER @@ -306,26 +189,12 @@ function(validate_clp_s_search_dependencies) ) endfunction() -function(set_clp_s_search_dependencies) - set_clp_need_flags( - CLP_NEED_ABSL - CLP_NEED_SIMDJSON - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_search_ast_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH_AST CLP_BUILD_CLP_S_TIMESTAMPPATTERN ) endfunction() -function(set_clp_s_search_ast_dependencies) - set_clp_need_flags( - CLP_NEED_SIMDJSON - ) -endfunction() - function(validate_clp_s_search_kql_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH_KQL CLP_BUILD_CLP_STRING_UTILS @@ -333,143 +202,76 @@ function(validate_clp_s_search_kql_dependencies) ) endfunction() -function(set_clp_s_search_kql_dependencies) - set_clp_need_flags( - CLP_NEED_ANTLR - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_search_sql_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_SEARCH_SQL CLP_BUILD_CLP_S_SEARCH_AST ) endfunction() -function(set_clp_s_search_sql_dependencies) - set_clp_need_flags( - CLP_NEED_ANTLR - CLP_NEED_SPDLOG - ) -endfunction() - function(validate_clp_s_timestamppattern_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_TIMESTAMPPATTERN CLP_BUILD_CLP_STRING_UTILS ) endfunction() -function(set_clp_s_timestamppattern_dependencies) - set_clp_need_flags( - CLP_NEED_DATE - CLP_NEED_SPDLOG - ) -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. -function(validate_and_setup_all_clp_dependency_flags) +# the target's dependencies are also `ON`. +function(validate_all_clp_dependency_flags) if (CLP_BUILD_EXECUTABLES) validate_clp_binaries_dependencies() - set_clp_binaries_dependencies() endif() if (CLP_BUILD_TESTING) validate_clp_tests_dependencies() - set_clp_tests_dependencies() endif() if (CLP_BUILD_CLP_REGEX_UTILS) validate_clp_regex_utils_dependencies() - set_clp_regex_utils_dependencies() endif() # clp::string_utils has no dependencies if (CLP_BUILD_CLP_S_ARCHIVEREADER) validate_clp_s_archivereader_dependencies() - set_clp_s_archivereader_dependencies() endif() if (CLP_BUILD_CLP_S_ARCHIVEWRITER) validate_clp_s_archivewriter_dependencies() - set_clp_s_archivewriter_dependencies() endif() if (CLP_BUILD_CLP_S_CLP_DEPENDENCIES) validate_clp_s_clp_dependencies_dependencies() - set_clp_s_clp_dependencies_dependencies() endif() if (CLP_BUILD_CLP_S_IO) validate_clp_s_io_dependencies() - set_clp_s_io_dependencies() endif() if (CLP_BUILD_CLP_S_JSONCONSTRUCTOR) validate_clp_s_json_constructor_dependencies() - set_clp_s_json_constructor_dependencies() endif() if (CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) validate_clp_s_reducer_dependencies_dependencies() - set_clp_s_reducer_dependencies_dependencies() endif() if (CLP_BUILD_CLP_S_SEARCH) validate_clp_s_search_dependencies() - set_clp_s_search_dependencies() endif() if (CLP_BUILD_CLP_S_SEARCH_AST) validate_clp_s_search_ast_dependencies() - set_clp_s_search_ast_dependencies() endif() if (CLP_BUILD_CLP_S_SEARCH_KQL) validate_clp_s_search_kql_dependencies() - set_clp_s_search_kql_dependencies() endif() if (CLP_BUILD_CLP_S_SEARCH_SQL) validate_clp_s_search_sql_dependencies() - set_clp_s_search_sql_dependencies() endif() if (CLP_BUILD_CLP_S_TIMESTAMPPATTERN) validate_clp_s_timestamppattern_dependencies() - set_clp_s_timestamppattern_dependencies() endif() endfunction() - -function (convert_clp_dependency_properties_to_variables) - list(APPEND CLP_NEED_FLAGS - CLP_NEED_ABSL - CLP_NEED_ANTLR - CLP_NEED_BOOST - CLP_NEED_CATCH2 - CLP_NEED_CURL - CLP_NEED_DATE - CLP_NEED_FMT - CLP_NEED_LOG_SURGEON - CLP_NEED_LIBARCHIVE - CLP_NEED_LZMA - CLP_NEED_MARIADB - CLP_NEED_MONGOCXX - CLP_NEED_MSGPACKCXX - CLP_NEED_NLOHMANN_JSON - CLP_NEED_OPENSSL - CLP_NEED_SIMDJSON - CLP_NEED_SPDLOG - CLP_NEED_SQLITE - CLP_NEED_YAMLCPP - CLP_NEED_YSTDLIB - CLP_NEED_ZSTD - ) - - foreach(FLAG IN LISTS CLP_NEED_FLAGS) - get_property(VALUE DIRECTORY PROPERTY "${FLAG}") - set("${FLAG}" "${VALUE}" PARENT_SCOPE) - endforeach() -endfunction() diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index b29230f6df..5ead0c44ec 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -1,7 +1,24 @@ # This file contains utility functions for our other cmake scripts. +# @param {string} LIBRARY +# @return {bool} Whether we have already run the find function for LIBRARY in the CLP_CHECKED_FIND +# variable. +function(get_clp_checked_find LIBRARY) + get_property(CLP_CHECKED_FIND + DIRECTORY "${PROJECT_SOURCE_DIR}" + PROPERTY "clp_checked_find_${LIBRARY}" + ) + set(CLP_CHECKED_FIND "${CLP_CHECKED_FIND}" PARENT_SCOPE) +endfunction() + +# Sets a flag indicating that we have run the find function for LIBRARY. +# @param {string} LIBRARY +function(set_clp_checked_find LIBRARY) + set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY "clp_checked_find_${LIBRARY}" TRUE) +endfunction() + # Find and setup abseil library. -function(find_absl) +function(find_absl) find_package(absl REQUIRED) if (absl_FOUND) message(STATUS "Found absl ${absl_VERSION}") @@ -188,7 +205,7 @@ endfunction() # Find and setup sqlite library. function(find_sqlite) set(sqlite_DYNAMIC_LIBS "dl;m;pthread") - include(cmake/Modules/FindLibraryDependencies.cmake) + include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") endfunction() @@ -202,6 +219,12 @@ endfunction() # Find and setup ystdlib. function(find_ystdlib) + get_clp_checked_find(ystdlib) + if (CLP_CHECKED_FIND) + return() + endif() + set_clp_checked_find(ystdlib) + set(YSTDLIB_CPP_BUILD_TESTING OFF) add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL) endfunction() diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index b8e2f1962b..4215e1b9b4 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -124,6 +124,18 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_date() + find_fmt() + find_log_surgeon() + find_mariadb() + find_nlohmann_json() + find_spdlog() + find_sqlite() + find_yamlcpp() + find_ystdlib() + find_zstd() + add_executable(clg ${CLG_SOURCES}) target_compile_features(clg PRIVATE cxx_std_20) target_include_directories(clg diff --git a/components/core/src/clp/clo/CMakeLists.txt b/components/core/src/clp/clo/CMakeLists.txt index a4cf0ddf47..77b346c229 100644 --- a/components/core/src/clp/clo/CMakeLists.txt +++ b/components/core/src/clp/clo/CMakeLists.txt @@ -152,6 +152,18 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_date() + find_fmt() + find_log_surgeon() + find_mongocxx() + find_msgpack() + find_nlohmann_json() + find_spdlog() + find_sqlite() + find_ystdlib() + find_zstd() + add_executable(clo ${CLO_SOURCES} ${REDUCER_SOURCES}) target_compile_features(clo PRIVATE cxx_std_20) target_include_directories(clo diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index c9782c509f..3e190e7bb0 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -166,6 +166,19 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_date() + find_fmt() + find_log_surgeon() + find_spdlog() + find_sqlite() + find_libarchive() + find_mariadb() + find_nlohmann_json() + find_yamlcpp() + find_ystdlib() + find_zstd() + add_executable(clp ${CLP_SOURCES}) target_compile_features(clp PRIVATE cxx_std_20) target_include_directories(clp diff --git a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt index 65bf33e03e..92fd41e5be 100644 --- a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt +++ b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt @@ -40,6 +40,12 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_log_surgeon() + find_spdlog() + find_ystdlib() + find_zstd() + add_executable(make-dictionaries-readable ${MAKE_DICTIONARIES_READABLE_SOURCES}) target_compile_features(make-dictionaries-readable PRIVATE cxx_std_20) target_link_libraries(make-dictionaries-readable diff --git a/components/core/src/clp/regex_utils/CMakeLists.txt b/components/core/src/clp/regex_utils/CMakeLists.txt index ecc3bc5553..d8dda783da 100644 --- a/components/core/src/clp/regex_utils/CMakeLists.txt +++ b/components/core/src/clp/regex_utils/CMakeLists.txt @@ -6,6 +6,8 @@ set( "RegexToWildcardTranslatorConfig.hpp" ) if(CLP_BUILD_CLP_REGEX_UTILS) + find_ystdlib() + add_library( regex_utils ErrorCode.cpp diff --git a/components/core/src/clp_s/CMakeLists.txt b/components/core/src/clp_s/CMakeLists.txt index 2e4cae6e81..dc93c77d18 100644 --- a/components/core/src/clp_s/CMakeLists.txt +++ b/components/core/src/clp_s/CMakeLists.txt @@ -82,6 +82,16 @@ set( # This library is intended as a temporary stand-in until clp has been packaged into libraries. if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES) + find_boost() + find_curl() + find_fmt() + find_msgpack() + find_nlohmann_json() + find_openssl() + find_spdlog() + find_ystdlib() + find_zstd() + add_library( clp_s_clp_dependencies ${CLP_S_CLP_SOURCES} @@ -132,6 +142,8 @@ set( # This library is intended as a temporary stand-in until the reducer has been packaged into # libraries. if(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) + find_nlohmann_json() + add_library( clp_s_reducer_dependencies ${CLP_S_REDUCER_SOURCES} @@ -168,6 +180,11 @@ set( ) if(CLP_BUILD_CLP_S_IO) + find_boost() + find_fmt() + find_spdlog() + find_zstd() + add_library( clp_s_io ${CLP_S_IO_SOURCES} @@ -228,6 +245,15 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEWRITER) + find_absl() + find_boost() + find_curl() + find_fmt() + find_msgpack() + find_nlohmann_json() + find_simdjson() + find_spdlog() + add_library( clp_s_archive_writer ${CLP_S_ARCHIVE_WRITER_SOURCES} @@ -291,6 +317,14 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEREADER) + find_absl() + find_boost() + find_curl() + find_fmt() + find_msgpack() + find_nlohmann_json() + find_spdlog() + add_library( clp_s_archive_reader ${CLP_S_ARCHIVE_READER_SOURCES} @@ -324,6 +358,10 @@ set( ) if(CLP_BUILD_CLP_S_JSONCONSTRUCTOR) + find_fmt() + find_mongocxx() + find_spdlog() + add_library( clp_s_json_constructor ${CLP_S_JSON_CONSTRUCTOR_SOURCES} @@ -352,6 +390,9 @@ set( ) if(CLP_BUILD_CLP_S_TIMESTAMPPATTERN) + find_date() + find_spdlog() + add_library( clp_s_timestamp_pattern ${CLP_S_TIMESTAMP_PATTERN_SOURCES} @@ -381,6 +422,12 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_mongocxx() + find_msgpack() + find_spdlog() + find_ystdlib() + add_executable( clp-s clp-s.cpp diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index 20e9e9a1e0..f2c7079ae8 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -81,6 +81,19 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_absl() + find_boost() + find_curl() + find_date() + find_mariadb() + find_nlohmann_json() + find_openssl() + find_simdjson() + find_spdlog() + find_yamlcpp() + find_ystdlib() + find_zstd() + add_executable(indexer ${INDEXER_SOURCES}) target_compile_features(indexer PRIVATE cxx_std_20) target_link_libraries(indexer diff --git a/components/core/src/clp_s/search/CMakeLists.txt b/components/core/src/clp_s/search/CMakeLists.txt index 901e4f4aee..bceacdbd90 100644 --- a/components/core/src/clp_s/search/CMakeLists.txt +++ b/components/core/src/clp_s/search/CMakeLists.txt @@ -35,6 +35,10 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH) + find_absl() + find_simdjson() + find_spdlog() + add_library( clp_s_search ${CLP_S_SEARCH_SOURCES} diff --git a/components/core/src/clp_s/search/ast/CMakeLists.txt b/components/core/src/clp_s/search/ast/CMakeLists.txt index eda1c26a3f..2b028d99c2 100644 --- a/components/core/src/clp_s/search/ast/CMakeLists.txt +++ b/components/core/src/clp_s/search/ast/CMakeLists.txt @@ -50,6 +50,8 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH_AST) + find_simdjson() + add_library( clp_s_search_ast ${CLP_S_AST_SOURCES} diff --git a/components/core/src/clp_s/search/kql/CMakeLists.txt b/components/core/src/clp_s/search/kql/CMakeLists.txt index 5fd7ecc58d..8b529789f2 100644 --- a/components/core/src/clp_s/search/kql/CMakeLists.txt +++ b/components/core/src/clp_s/search/kql/CMakeLists.txt @@ -12,6 +12,9 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_KQL) + find_antlr() + find_spdlog() + add_library( clp_s_search_kql ${ANTLR_GENERATED_SOURCES} diff --git a/components/core/src/clp_s/search/sql/CMakeLists.txt b/components/core/src/clp_s/search/sql/CMakeLists.txt index 7e62d7d493..789d8b6df7 100644 --- a/components/core/src/clp_s/search/sql/CMakeLists.txt +++ b/components/core/src/clp_s/search/sql/CMakeLists.txt @@ -12,6 +12,9 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_SQL) + find_antlr() + find_spdlog() + add_library( clp_s_search_sql ${ANTLR_GENERATED_SOURCES} diff --git a/components/core/src/glt/glt/CMakeLists.txt b/components/core/src/glt/glt/CMakeLists.txt index 8576f391f5..51c87d31a7 100644 --- a/components/core/src/glt/glt/CMakeLists.txt +++ b/components/core/src/glt/glt/CMakeLists.txt @@ -172,6 +172,18 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_date() + find_fmt() + find_spdlog() + find_sqlite() + find_libarchive() + find_mariadb() + find_nlohmann_json() + find_yamlcpp() + find_ystdlib() + find_zstd() + add_executable(glt ${GLT_SOURCES}) target_compile_features(glt PRIVATE cxx_std_20) target_include_directories(glt diff --git a/components/core/src/reducer/CMakeLists.txt b/components/core/src/reducer/CMakeLists.txt index ec830624b8..7359248848 100644 --- a/components/core/src/reducer/CMakeLists.txt +++ b/components/core/src/reducer/CMakeLists.txt @@ -39,6 +39,13 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_boost() + find_fmt() + find_mongocxx() + find_msgpack() + find_nlohmann_json() + find_spdlog() + add_executable(reducer-server ${REDUCER_SOURCES}) target_compile_features(reducer-server PRIVATE cxx_std_20) target_link_libraries(reducer-server From 47cd6a6a421c87d221a2954bec83d0f86e7e1e7a Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 14:25:02 +0000 Subject: [PATCH 03/24] Comment out status messages that would repeat on every call to find_X --- components/core/cmake/Utils/utils.cmake | 47 +++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index 5ead0c44ec..01c5645826 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -21,7 +21,7 @@ endfunction() function(find_absl) find_package(absl REQUIRED) if (absl_FOUND) - message(STATUS "Found absl ${absl_VERSION}") + #message(STATUS "Found absl ${absl_VERSION}") endif() endfunction() @@ -29,7 +29,7 @@ endfunction() function(find_antlr) find_package(antlr4-runtime REQUIRED) if (antlr4-runtime_FOUND) - message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") + #message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") endif() endfunction() @@ -40,7 +40,7 @@ function(find_boost) endif() find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url) if(Boost_FOUND) - message(STATUS "Found Boost ${Boost_VERSION}") + #message(STATUS "Found Boost ${Boost_VERSION}") else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") endif() @@ -50,7 +50,7 @@ endfunction() function(find_catch2) find_package(Catch2 REQUIRED) if (Catch2_FOUND) - message(STATUS "Found Catch2 ${Catch2_VERSION}") + #message(STATUS "Found Catch2 ${Catch2_VERSION}") endif() endfunction() @@ -60,7 +60,7 @@ endfunction() function(find_curl) find_package(CURL 7.61.1 REQUIRED) if(CURL_FOUND) - message(STATUS "Found CURL ${CURL_VERSION_STRING}") + #message(STATUS "Found CURL ${CURL_VERSION_STRING}") set(CURL_LIBRARIES ${CURL_LIBRARIES} PARENT_SCOPE) else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL") @@ -71,7 +71,7 @@ endfunction() function(find_date) find_package(date REQUIRED) if (date_FOUND) - message(STATUS "Found date ${date_VERSION}") + #message(STATUS "Found date ${date_VERSION}") endif() endfunction() @@ -80,7 +80,7 @@ function(find_fmt) if(CLP_NEED_FMT) find_package(fmt REQUIRED) if(fmt_FOUND) - message(STATUS "Found fmt ${fmt_VERSION}") + #message(STATUS "Found fmt ${fmt_VERSION}") endif() endif() endfunction() @@ -92,7 +92,7 @@ function(find_libarchive) endif() find_package(LibArchive REQUIRED) if(LibArchive_FOUND) - message(STATUS "Found LibArchive ${LibArchive_VERSION}") + #message(STATUS "Found LibArchive ${LibArchive_VERSION}") endif() endfunction() @@ -100,7 +100,7 @@ endfunction() function(find_log_surgeon) find_package(log_surgeon REQUIRED) if(log_surgeon_FOUND) - message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") + #message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") endif() endfunction() @@ -112,9 +112,9 @@ function(find_lzma) endif() find_package(LibLZMA REQUIRED) if(LIBLZMA_FOUND) - message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}") - message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}") - message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}") + #message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}") + #message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}") + #message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}") # Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115. set(REQUIRED_LIBLZMA_VERSION "5.8.1") @@ -136,11 +136,11 @@ endfunction() function(find_mariadb) if(CLP_USE_STATIC_LIBS) # NOTE: We can't statically link to MariaDBClient since it's GPL - message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") + #message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") endif() find_package(MariaDBClient 3.1.0 REQUIRED) if(MariaDBClient_FOUND) - message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}") + #message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}") else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient") endif() @@ -150,7 +150,7 @@ endfunction() # @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable. function(find_mongocxx) find_package(mongocxx REQUIRED) - message(STATUS "Found mongocxx ${mongocxx_VERSION}") + #message(STATUS "Found mongocxx ${mongocxx_VERSION}") if(CLP_USE_STATIC_LIBS) set(MONGOCXX_TARGET mongo::mongocxx_static PARENT_SCOPE) else() @@ -162,7 +162,7 @@ endfunction() function(find_msgpack) find_package(msgpack-cxx 7.0.0 REQUIRED) if(msgpack-cxx_FOUND) - message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") + #message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") else() message(FATAL_ERROR "Could not find msgpack-cxx") endif() @@ -172,7 +172,7 @@ endfunction() function(find_nlohmann_json) find_package(nlohmann_json REQUIRED) if(nlohmann_json_FOUND) - message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") + #message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") endif() endfunction() @@ -180,7 +180,7 @@ endfunction() function(find_openssl) find_package(OpenSSL REQUIRED) if(OPENSSL_FOUND) - message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") + #message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") else() message(FATAL_ERROR "OpenSSL not found") endif() @@ -190,7 +190,7 @@ endfunction() function(find_simdjson) find_package(simdjson REQUIRED) if(simdjson_FOUND) - message(STATUS "Found simdjson ${simdjson_VERSION}") + #message(STATUS "Found simdjson ${simdjson_VERSION}") endif() endfunction() @@ -198,7 +198,7 @@ endfunction() function(find_spdlog) find_package(spdlog REQUIRED) if(spdlog_FOUND) - message(STATUS "Found spdlog ${spdlog_VERSION}") + #message(STATUS "Found spdlog ${spdlog_VERSION}") endif() endfunction() @@ -213,20 +213,21 @@ endfunction() function(find_yamlcpp) find_package(yaml-cpp REQUIRED) if(yaml-cpp_FOUND) - message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") + #message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") endif() endfunction() # Find and setup ystdlib. function(find_ystdlib) + # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) if (CLP_CHECKED_FIND) return() endif() - set_clp_checked_find(ystdlib) set(YSTDLIB_CPP_BUILD_TESTING OFF) add_subdirectory("${CLP_YSTDLIB_SOURCE_DIRECTORY}" "${CMAKE_BINARY_DIR}/ystdlib" EXCLUDE_FROM_ALL) + set_clp_checked_find(ystdlib) endfunction() # Find and setup ZStd library. @@ -236,7 +237,7 @@ function(find_zstd) endif() find_package(ZStd 1.4.4 REQUIRED) if(ZStd_FOUND) - message(STATUS "Found ZStd ${ZStd_VERSION}") + #message(STATUS "Found ZStd ${ZStd_VERSION}") else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd") endif() From c98d66438f4979559aabf853f609695289e146a7 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 14:31:16 +0000 Subject: [PATCH 04/24] Rename find_X functions to clp_find_X --- components/core/CMakeLists.txt | 38 ++++----- components/core/cmake/Utils/utils.cmake | 42 +++++----- components/core/src/clp/clg/CMakeLists.txt | 22 +++--- components/core/src/clp/clo/CMakeLists.txt | 22 +++--- components/core/src/clp/clp/CMakeLists.txt | 24 +++--- .../make_dictionaries_readable/CMakeLists.txt | 10 +-- .../core/src/clp/regex_utils/CMakeLists.txt | 2 +- components/core/src/clp_s/CMakeLists.txt | 78 +++++++++---------- .../core/src/clp_s/indexer/CMakeLists.txt | 24 +++--- .../core/src/clp_s/search/CMakeLists.txt | 6 +- .../core/src/clp_s/search/ast/CMakeLists.txt | 2 +- .../core/src/clp_s/search/kql/CMakeLists.txt | 4 +- .../core/src/clp_s/search/sql/CMakeLists.txt | 4 +- components/core/src/glt/glt/CMakeLists.txt | 22 +++--- components/core/src/reducer/CMakeLists.txt | 12 +-- 15 files changed, 156 insertions(+), 156 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 81ab6d2c56..d743071be7 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -526,25 +526,25 @@ set(SOURCE_FILES_unitTest ) if(CLP_BUILD_TESTING) - find_absl() - find_boost() - find_catch2() - find_curl() - find_date() - find_fmt() - find_libarchive() - find_log_surgeon() - find_mariadb() - find_mongocxx() - find_nlohmann_json() - find_openssl() - find_simdjson() - find_spdlog() - find_sqlite() - find_yamlcpp() - find_ystdlib() - find_lzma() - find_zstd() + clp_find_absl() + clp_find_boost() + clp_find_catch2() + clp_find_curl() + clp_find_date() + clp_find_fmt() + clp_find_libarchive() + clp_find_log_surgeon() + clp_find_mariadb_client() + clp_find_mongocxx() + clp_find_nlohmann_json() + clp_find_openssl() + clp_find_simdjson() + clp_find_spdlog() + clp_find_sqlite() + clp_find_yamlcpp() + clp_find_ystdlib() + clp_find_lzma() + clp_find_zstd() add_executable(unitTest ${SOURCE_FILES_unitTest} diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index 01c5645826..c587a933c2 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -18,7 +18,7 @@ function(set_clp_checked_find LIBRARY) endfunction() # Find and setup abseil library. -function(find_absl) +function(clp_find_absl) find_package(absl REQUIRED) if (absl_FOUND) #message(STATUS "Found absl ${absl_VERSION}") @@ -26,7 +26,7 @@ function(find_absl) endfunction() # Find and setup ANTLR library. -function(find_antlr) +function(clp_find_antlr) find_package(antlr4-runtime REQUIRED) if (antlr4-runtime_FOUND) #message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") @@ -34,7 +34,7 @@ function(find_antlr) endfunction() # Find and setup Boost library. -function(find_boost) +function(clp_find_boost) if(CLP_USE_STATIC_LIBS) set(Boost_USE_STATIC_LIBS ON) endif() @@ -47,7 +47,7 @@ function(find_boost) endfunction() # Find and setup Catch2 library. -function(find_catch2) +function(clp_find_catch2) find_package(Catch2 REQUIRED) if (Catch2_FOUND) #message(STATUS "Found Catch2 ${Catch2_VERSION}") @@ -57,7 +57,7 @@ endfunction() # Find and setup libcurl. # By default, CURL does not provide static libraries. # @return The list of libraries needed to link against CURL in the CURL_LIBRARIES variable. -function(find_curl) +function(clp_find_curl) find_package(CURL 7.61.1 REQUIRED) if(CURL_FOUND) #message(STATUS "Found CURL ${CURL_VERSION_STRING}") @@ -68,7 +68,7 @@ function(find_curl) endfunction() # Find and setup date library. -function(find_date) +function(clp_find_date) find_package(date REQUIRED) if (date_FOUND) #message(STATUS "Found date ${date_VERSION}") @@ -76,7 +76,7 @@ function(find_date) endfunction() # Find and setup fmt library. -function(find_fmt) +function(clp_find_fmt) if(CLP_NEED_FMT) find_package(fmt REQUIRED) if(fmt_FOUND) @@ -86,7 +86,7 @@ function(find_fmt) endfunction() # Find and setup libarchive. -function(find_libarchive) +function(clp_find_libarchive) if(CLP_USE_STATIC_LIBS) set(LibArchive_USE_STATIC_LIBS ON) endif() @@ -97,7 +97,7 @@ function(find_libarchive) endfunction() # Find and setup log_surgeon library. -function(find_log_surgeon) +function(clp_find_log_surgeon) find_package(log_surgeon REQUIRED) if(log_surgeon_FOUND) #message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") @@ -106,7 +106,7 @@ endfunction() # Find and setup LZMA library. # TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode. -function(find_lzma) +function(clp_find_lzma) if(CLP_USE_STATIC_LIBS) set(LIBLZMA_USE_STATIC_LIBS ON) endif() @@ -133,7 +133,7 @@ endfunction() # Find and setup MariaDBClient library. -function(find_mariadb) +function(clp_find_mariadb_client) if(CLP_USE_STATIC_LIBS) # NOTE: We can't statically link to MariaDBClient since it's GPL #message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") @@ -148,7 +148,7 @@ endfunction() # Find and setup mongocxx library. # @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable. -function(find_mongocxx) +function(clp_find_mongocxx) find_package(mongocxx REQUIRED) #message(STATUS "Found mongocxx ${mongocxx_VERSION}") if(CLP_USE_STATIC_LIBS) @@ -159,7 +159,7 @@ function(find_mongocxx) endfunction() # Find and setup msgpack library. -function(find_msgpack) +function(clp_find_msgpack) find_package(msgpack-cxx 7.0.0 REQUIRED) if(msgpack-cxx_FOUND) #message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") @@ -169,7 +169,7 @@ function(find_msgpack) endfunction() # Find and setup nlohmann_json library. -function(find_nlohmann_json) +function(clp_find_nlohmann_json) find_package(nlohmann_json REQUIRED) if(nlohmann_json_FOUND) #message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") @@ -177,7 +177,7 @@ function(find_nlohmann_json) endfunction() # Find and setup OpenSSL library. -function(find_openssl) +function(clp_find_openssl) find_package(OpenSSL REQUIRED) if(OPENSSL_FOUND) #message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") @@ -187,7 +187,7 @@ function(find_openssl) endfunction() # Find and setup simdjson library. -function(find_simdjson) +function(clp_find_simdjson) find_package(simdjson REQUIRED) if(simdjson_FOUND) #message(STATUS "Found simdjson ${simdjson_VERSION}") @@ -195,7 +195,7 @@ function(find_simdjson) endfunction() # Find and setup spdlog library. -function(find_spdlog) +function(clp_find_spdlog) find_package(spdlog REQUIRED) if(spdlog_FOUND) #message(STATUS "Found spdlog ${spdlog_VERSION}") @@ -203,14 +203,14 @@ function(find_spdlog) endfunction() # Find and setup sqlite library. -function(find_sqlite) +function(clp_find_sqlite) set(sqlite_DYNAMIC_LIBS "dl;m;pthread") include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") endfunction() # Find and setup yamlcpp library. -function(find_yamlcpp) +function(clp_find_yamlcpp) find_package(yaml-cpp REQUIRED) if(yaml-cpp_FOUND) #message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") @@ -218,7 +218,7 @@ function(find_yamlcpp) endfunction() # Find and setup ystdlib. -function(find_ystdlib) +function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) if (CLP_CHECKED_FIND) @@ -231,7 +231,7 @@ function(find_ystdlib) endfunction() # Find and setup ZStd library. -function(find_zstd) +function(clp_find_zstd) if(CLP_USE_STATIC_LIBS) set(ZStd_USE_STATIC_LIBS ON) endif() diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index 4215e1b9b4..543fa6eeb8 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -124,17 +124,17 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_date() - find_fmt() - find_log_surgeon() - find_mariadb() - find_nlohmann_json() - find_spdlog() - find_sqlite() - find_yamlcpp() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_date() + clp_find_fmt() + clp_find_log_surgeon() + clp_find_mariadb_client() + clp_find_nlohmann_json() + clp_find_spdlog() + clp_find_sqlite() + clp_find_yamlcpp() + clp_find_ystdlib() + clp_find_zstd() add_executable(clg ${CLG_SOURCES}) target_compile_features(clg PRIVATE cxx_std_20) diff --git a/components/core/src/clp/clo/CMakeLists.txt b/components/core/src/clp/clo/CMakeLists.txt index 77b346c229..3653613e29 100644 --- a/components/core/src/clp/clo/CMakeLists.txt +++ b/components/core/src/clp/clo/CMakeLists.txt @@ -152,17 +152,17 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_date() - find_fmt() - find_log_surgeon() - find_mongocxx() - find_msgpack() - find_nlohmann_json() - find_spdlog() - find_sqlite() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_date() + clp_find_fmt() + clp_find_log_surgeon() + clp_find_mongocxx() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_spdlog() + clp_find_sqlite() + clp_find_ystdlib() + clp_find_zstd() add_executable(clo ${CLO_SOURCES} ${REDUCER_SOURCES}) target_compile_features(clo PRIVATE cxx_std_20) diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index 3e190e7bb0..896fbfac50 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -166,18 +166,18 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_date() - find_fmt() - find_log_surgeon() - find_spdlog() - find_sqlite() - find_libarchive() - find_mariadb() - find_nlohmann_json() - find_yamlcpp() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_date() + clp_find_fmt() + clp_find_log_surgeon() + clp_find_spdlog() + clp_find_sqlite() + clp_find_libarchive() + clp_find_mariadb_client() + clp_find_nlohmann_json() + clp_find_yamlcpp() + clp_find_ystdlib() + clp_find_zstd() add_executable(clp ${CLP_SOURCES}) target_compile_features(clp PRIVATE cxx_std_20) diff --git a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt index 92fd41e5be..17223e656e 100644 --- a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt +++ b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt @@ -40,11 +40,11 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_log_surgeon() - find_spdlog() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_log_surgeon() + clp_find_spdlog() + clp_find_ystdlib() + clp_find_zstd() add_executable(make-dictionaries-readable ${MAKE_DICTIONARIES_READABLE_SOURCES}) target_compile_features(make-dictionaries-readable PRIVATE cxx_std_20) diff --git a/components/core/src/clp/regex_utils/CMakeLists.txt b/components/core/src/clp/regex_utils/CMakeLists.txt index d8dda783da..b5c6de6dbf 100644 --- a/components/core/src/clp/regex_utils/CMakeLists.txt +++ b/components/core/src/clp/regex_utils/CMakeLists.txt @@ -6,7 +6,7 @@ set( "RegexToWildcardTranslatorConfig.hpp" ) if(CLP_BUILD_CLP_REGEX_UTILS) - find_ystdlib() + clp_find_ystdlib() add_library( regex_utils diff --git a/components/core/src/clp_s/CMakeLists.txt b/components/core/src/clp_s/CMakeLists.txt index dc93c77d18..bd2f1911bf 100644 --- a/components/core/src/clp_s/CMakeLists.txt +++ b/components/core/src/clp_s/CMakeLists.txt @@ -82,15 +82,15 @@ set( # This library is intended as a temporary stand-in until clp has been packaged into libraries. if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES) - find_boost() - find_curl() - find_fmt() - find_msgpack() - find_nlohmann_json() - find_openssl() - find_spdlog() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_curl() + clp_find_fmt() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_openssl() + clp_find_spdlog() + clp_find_ystdlib() + clp_find_zstd() add_library( clp_s_clp_dependencies @@ -142,7 +142,7 @@ set( # This library is intended as a temporary stand-in until the reducer has been packaged into # libraries. if(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) - find_nlohmann_json() + clp_find_nlohmann_json() add_library( clp_s_reducer_dependencies @@ -180,10 +180,10 @@ set( ) if(CLP_BUILD_CLP_S_IO) - find_boost() - find_fmt() - find_spdlog() - find_zstd() + clp_find_boost() + clp_find_fmt() + clp_find_spdlog() + clp_find_zstd() add_library( clp_s_io @@ -245,14 +245,14 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEWRITER) - find_absl() - find_boost() - find_curl() - find_fmt() - find_msgpack() - find_nlohmann_json() - find_simdjson() - find_spdlog() + clp_find_absl() + clp_find_boost() + clp_find_curl() + clp_find_fmt() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_simdjson() + clp_find_spdlog() add_library( clp_s_archive_writer @@ -317,13 +317,13 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEREADER) - find_absl() - find_boost() - find_curl() - find_fmt() - find_msgpack() - find_nlohmann_json() - find_spdlog() + clp_find_absl() + clp_find_boost() + clp_find_curl() + clp_find_fmt() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_spdlog() add_library( clp_s_archive_reader @@ -358,9 +358,9 @@ set( ) if(CLP_BUILD_CLP_S_JSONCONSTRUCTOR) - find_fmt() - find_mongocxx() - find_spdlog() + clp_find_fmt() + clp_find_mongocxx() + clp_find_spdlog() add_library( clp_s_json_constructor @@ -390,8 +390,8 @@ set( ) if(CLP_BUILD_CLP_S_TIMESTAMPPATTERN) - find_date() - find_spdlog() + clp_find_date() + clp_find_spdlog() add_library( clp_s_timestamp_pattern @@ -422,11 +422,11 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_mongocxx() - find_msgpack() - find_spdlog() - find_ystdlib() + clp_find_boost() + clp_find_mongocxx() + clp_find_msgpack() + clp_find_spdlog() + clp_find_ystdlib() add_executable( clp-s diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index f2c7079ae8..92c0185501 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -81,18 +81,18 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_absl() - find_boost() - find_curl() - find_date() - find_mariadb() - find_nlohmann_json() - find_openssl() - find_simdjson() - find_spdlog() - find_yamlcpp() - find_ystdlib() - find_zstd() + clp_find_absl() + clp_find_boost() + clp_find_curl() + clp_find_date() + clp_find_mariadb_client() + clp_find_nlohmann_json() + clp_find_openssl() + clp_find_simdjson() + clp_find_spdlog() + clp_find_yamlcpp() + clp_find_ystdlib() + clp_find_zstd() add_executable(indexer ${INDEXER_SOURCES}) target_compile_features(indexer PRIVATE cxx_std_20) diff --git a/components/core/src/clp_s/search/CMakeLists.txt b/components/core/src/clp_s/search/CMakeLists.txt index bceacdbd90..a76084ce51 100644 --- a/components/core/src/clp_s/search/CMakeLists.txt +++ b/components/core/src/clp_s/search/CMakeLists.txt @@ -35,9 +35,9 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH) - find_absl() - find_simdjson() - find_spdlog() + clp_find_absl() + clp_find_simdjson() + clp_find_spdlog() add_library( clp_s_search diff --git a/components/core/src/clp_s/search/ast/CMakeLists.txt b/components/core/src/clp_s/search/ast/CMakeLists.txt index 2b028d99c2..db4c7f9b95 100644 --- a/components/core/src/clp_s/search/ast/CMakeLists.txt +++ b/components/core/src/clp_s/search/ast/CMakeLists.txt @@ -50,7 +50,7 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH_AST) - find_simdjson() + clp_find_simdjson() add_library( clp_s_search_ast diff --git a/components/core/src/clp_s/search/kql/CMakeLists.txt b/components/core/src/clp_s/search/kql/CMakeLists.txt index 8b529789f2..1266fcf8e9 100644 --- a/components/core/src/clp_s/search/kql/CMakeLists.txt +++ b/components/core/src/clp_s/search/kql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_KQL) - find_antlr() - find_spdlog() + clp_find_antlr() + clp_find_spdlog() add_library( clp_s_search_kql diff --git a/components/core/src/clp_s/search/sql/CMakeLists.txt b/components/core/src/clp_s/search/sql/CMakeLists.txt index 789d8b6df7..0f0362d10f 100644 --- a/components/core/src/clp_s/search/sql/CMakeLists.txt +++ b/components/core/src/clp_s/search/sql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_SQL) - find_antlr() - find_spdlog() + clp_find_antlr() + clp_find_spdlog() add_library( clp_s_search_sql diff --git a/components/core/src/glt/glt/CMakeLists.txt b/components/core/src/glt/glt/CMakeLists.txt index 51c87d31a7..8b23e9c0b1 100644 --- a/components/core/src/glt/glt/CMakeLists.txt +++ b/components/core/src/glt/glt/CMakeLists.txt @@ -172,17 +172,17 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_date() - find_fmt() - find_spdlog() - find_sqlite() - find_libarchive() - find_mariadb() - find_nlohmann_json() - find_yamlcpp() - find_ystdlib() - find_zstd() + clp_find_boost() + clp_find_date() + clp_find_fmt() + clp_find_spdlog() + clp_find_sqlite() + clp_find_libarchive() + clp_find_mariadb_client() + clp_find_nlohmann_json() + clp_find_yamlcpp() + clp_find_ystdlib() + clp_find_zstd() add_executable(glt ${GLT_SOURCES}) target_compile_features(glt PRIVATE cxx_std_20) diff --git a/components/core/src/reducer/CMakeLists.txt b/components/core/src/reducer/CMakeLists.txt index 7359248848..ca6be3f930 100644 --- a/components/core/src/reducer/CMakeLists.txt +++ b/components/core/src/reducer/CMakeLists.txt @@ -39,12 +39,12 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_boost() - find_fmt() - find_mongocxx() - find_msgpack() - find_nlohmann_json() - find_spdlog() + clp_find_boost() + clp_find_fmt() + clp_find_mongocxx() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_spdlog() add_executable(reducer-server ${REDUCER_SOURCES}) target_compile_features(reducer-server PRIVATE cxx_std_20) From 7d1da0be39b3e0a635f1ed58f27228759c157f8b Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 16:53:11 +0000 Subject: [PATCH 05/24] Use macros for most clp_find_X functions to avoid having to manually forward results of find_package calls. --- components/core/cmake/Utils/utils.cmake | 109 ++++++++++++++---------- 1 file changed, 64 insertions(+), 45 deletions(-) diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index c587a933c2..2727b5d8c9 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -18,23 +18,26 @@ function(set_clp_checked_find LIBRARY) endfunction() # Find and setup abseil library. -function(clp_find_absl) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_absl) find_package(absl REQUIRED) if (absl_FOUND) #message(STATUS "Found absl ${absl_VERSION}") endif() -endfunction() +endmacro() # Find and setup ANTLR library. -function(clp_find_antlr) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_antlr) find_package(antlr4-runtime REQUIRED) if (antlr4-runtime_FOUND) #message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") endif() -endfunction() +endmacro() # Find and setup Boost library. -function(clp_find_boost) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_boost) if(CLP_USE_STATIC_LIBS) set(Boost_USE_STATIC_LIBS ON) endif() @@ -44,49 +47,52 @@ function(clp_find_boost) else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") endif() -endfunction() +endmacro() # Find and setup Catch2 library. -function(clp_find_catch2) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_catch2) find_package(Catch2 REQUIRED) if (Catch2_FOUND) #message(STATUS "Found Catch2 ${Catch2_VERSION}") endif() -endfunction() +endmacro() # Find and setup libcurl. # By default, CURL does not provide static libraries. -# @return The list of libraries needed to link against CURL in the CURL_LIBRARIES variable. -function(clp_find_curl) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_curl) find_package(CURL 7.61.1 REQUIRED) if(CURL_FOUND) #message(STATUS "Found CURL ${CURL_VERSION_STRING}") - set(CURL_LIBRARIES ${CURL_LIBRARIES} PARENT_SCOPE) else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL") endif() -endfunction() +endmacro() # Find and setup date library. -function(clp_find_date) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_date) find_package(date REQUIRED) if (date_FOUND) #message(STATUS "Found date ${date_VERSION}") endif() -endfunction() +endmacro() # Find and setup fmt library. -function(clp_find_fmt) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_fmt) if(CLP_NEED_FMT) find_package(fmt REQUIRED) if(fmt_FOUND) #message(STATUS "Found fmt ${fmt_VERSION}") endif() endif() -endfunction() +endmacro() # Find and setup libarchive. -function(clp_find_libarchive) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_libarchive) if(CLP_USE_STATIC_LIBS) set(LibArchive_USE_STATIC_LIBS ON) endif() @@ -94,19 +100,21 @@ function(clp_find_libarchive) if(LibArchive_FOUND) #message(STATUS "Found LibArchive ${LibArchive_VERSION}") endif() -endfunction() +endmacro() # Find and setup log_surgeon library. -function(clp_find_log_surgeon) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_log_surgeon) find_package(log_surgeon REQUIRED) if(log_surgeon_FOUND) #message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") endif() -endfunction() +endmacro() # Find and setup LZMA library. # TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode. -function(clp_find_lzma) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_lzma) if(CLP_USE_STATIC_LIBS) set(LIBLZMA_USE_STATIC_LIBS ON) endif() @@ -129,11 +137,12 @@ function(clp_find_lzma) message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma") endif() include_directories(${LIBLZMA_INCLUDE_DIRS}) -endfunction() +endmacro() # Find and setup MariaDBClient library. -function(clp_find_mariadb_client) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_mariadb_client) if(CLP_USE_STATIC_LIBS) # NOTE: We can't statically link to MariaDBClient since it's GPL #message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") @@ -144,80 +153,89 @@ function(clp_find_mariadb_client) else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient") endif() -endfunction() +endmacro() # Find and setup mongocxx library. -# @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable. -function(clp_find_mongocxx) +# @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable, and +# forwards any variables from the `find_package` call. +macro(clp_find_mongocxx) find_package(mongocxx REQUIRED) #message(STATUS "Found mongocxx ${mongocxx_VERSION}") if(CLP_USE_STATIC_LIBS) - set(MONGOCXX_TARGET mongo::mongocxx_static PARENT_SCOPE) + set(MONGOCXX_TARGET mongo::mongocxx_static) else() - set(MONGOCXX_TARGET mongo::mongocxx_shared PARENT_SCOPE) + set(MONGOCXX_TARGET mongo::mongocxx_shared) endif() -endfunction() +endmacro() # Find and setup msgpack library. -function(clp_find_msgpack) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_msgpack) find_package(msgpack-cxx 7.0.0 REQUIRED) if(msgpack-cxx_FOUND) #message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") else() message(FATAL_ERROR "Could not find msgpack-cxx") endif() -endfunction() +endmacro() # Find and setup nlohmann_json library. -function(clp_find_nlohmann_json) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_nlohmann_json) find_package(nlohmann_json REQUIRED) if(nlohmann_json_FOUND) #message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") endif() -endfunction() +endmacro() # Find and setup OpenSSL library. -function(clp_find_openssl) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_openssl) find_package(OpenSSL REQUIRED) if(OPENSSL_FOUND) #message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") else() message(FATAL_ERROR "OpenSSL not found") endif() -endfunction() +endmacro() # Find and setup simdjson library. -function(clp_find_simdjson) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_simdjson) find_package(simdjson REQUIRED) if(simdjson_FOUND) #message(STATUS "Found simdjson ${simdjson_VERSION}") endif() -endfunction() +endmacro() # Find and setup spdlog library. -function(clp_find_spdlog) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_spdlog) find_package(spdlog REQUIRED) if(spdlog_FOUND) #message(STATUS "Found spdlog ${spdlog_VERSION}") endif() -endfunction() +endmacro() # Find and setup sqlite library. -function(clp_find_sqlite) +# @return Forwards any variables from the `FindDynamicLibraryDependencies` call. +macro(clp_find_sqlite) set(sqlite_DYNAMIC_LIBS "dl;m;pthread") include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") -endfunction() +endmacro() # Find and setup yamlcpp library. -function(clp_find_yamlcpp) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_yamlcpp) find_package(yaml-cpp REQUIRED) if(yaml-cpp_FOUND) #message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") endif() -endfunction() +endmacro() # Find and setup ystdlib. +# @return Forwards any variables from the `find_package` call. function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) @@ -231,7 +249,8 @@ function(clp_find_ystdlib) endfunction() # Find and setup ZStd library. -function(clp_find_zstd) +# @return Forwards any variables from the `find_package` call. +macro(clp_find_zstd) if(CLP_USE_STATIC_LIBS) set(ZStd_USE_STATIC_LIBS ON) endif() @@ -241,4 +260,4 @@ function(clp_find_zstd) else() message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd") endif() -endfunction() +endmacro() From d588c3f40d03381cd2c1ea33c45410fbbe3ea58f Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 16:53:59 +0000 Subject: [PATCH 06/24] Fix docstring --- components/core/cmake/Utils/utils.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index 2727b5d8c9..5316ca7775 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -235,7 +235,6 @@ macro(clp_find_yamlcpp) endmacro() # Find and setup ystdlib. -# @return Forwards any variables from the `find_package` call. function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) From 4a39d14eaa1d860ff5e8ef7897122ce18dde5d4c Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 19:15:27 +0000 Subject: [PATCH 07/24] Delete macros that are equivalent to a simple find_package call --- components/core/CMakeLists.txt | 20 ++-- components/core/cmake/Utils/utils.cmake | 103 ------------------ components/core/src/clp/clg/CMakeLists.txt | 12 +- components/core/src/clp/clo/CMakeLists.txt | 10 +- components/core/src/clp/clp/CMakeLists.txt | 12 +- .../make_dictionaries_readable/CMakeLists.txt | 4 +- components/core/src/clp_s/CMakeLists.txt | 42 +++---- .../core/src/clp_s/indexer/CMakeLists.txt | 14 +-- .../core/src/clp_s/search/CMakeLists.txt | 6 +- .../core/src/clp_s/search/ast/CMakeLists.txt | 2 +- .../core/src/clp_s/search/kql/CMakeLists.txt | 4 +- .../core/src/clp_s/search/sql/CMakeLists.txt | 4 +- components/core/src/glt/glt/CMakeLists.txt | 10 +- components/core/src/reducer/CMakeLists.txt | 6 +- 14 files changed, 73 insertions(+), 176 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index d743071be7..2111949918 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -526,22 +526,22 @@ set(SOURCE_FILES_unitTest ) if(CLP_BUILD_TESTING) - clp_find_absl() + find_package(absl REQUIRED) clp_find_boost() - clp_find_catch2() + find_package(Catch2 REQUIRED) clp_find_curl() - clp_find_date() - clp_find_fmt() + find_package(date REQUIRED) + find_package(fmt REQUIRED) clp_find_libarchive() - clp_find_log_surgeon() + find_package(log_surgeon REQUIRED) clp_find_mariadb_client() clp_find_mongocxx() - clp_find_nlohmann_json() - clp_find_openssl() - clp_find_simdjson() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(OpenSSL REQUIRED) + find_package(simdjson REQUIRED) + find_package(spdlog REQUIRED) clp_find_sqlite() - clp_find_yamlcpp() + find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_lzma() clp_find_zstd() diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index 5316ca7775..26a63b237c 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -17,24 +17,6 @@ function(set_clp_checked_find LIBRARY) set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY "clp_checked_find_${LIBRARY}" TRUE) endfunction() -# Find and setup abseil library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_absl) - find_package(absl REQUIRED) - if (absl_FOUND) - #message(STATUS "Found absl ${absl_VERSION}") - endif() -endmacro() - -# Find and setup ANTLR library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_antlr) - find_package(antlr4-runtime REQUIRED) - if (antlr4-runtime_FOUND) - #message(STATUS "Found antlr4-runtime ${antlr4-runtime_VERSION}") - endif() -endmacro() - # Find and setup Boost library. # @return Forwards any variables from the `find_package` call. macro(clp_find_boost) @@ -49,15 +31,6 @@ macro(clp_find_boost) endif() endmacro() -# Find and setup Catch2 library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_catch2) - find_package(Catch2 REQUIRED) - if (Catch2_FOUND) - #message(STATUS "Found Catch2 ${Catch2_VERSION}") - endif() -endmacro() - # Find and setup libcurl. # By default, CURL does not provide static libraries. # @return Forwards any variables from the `find_package` call. @@ -70,26 +43,6 @@ macro(clp_find_curl) endif() endmacro() -# Find and setup date library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_date) - find_package(date REQUIRED) - if (date_FOUND) - #message(STATUS "Found date ${date_VERSION}") - endif() -endmacro() - -# Find and setup fmt library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_fmt) - if(CLP_NEED_FMT) - find_package(fmt REQUIRED) - if(fmt_FOUND) - #message(STATUS "Found fmt ${fmt_VERSION}") - endif() - endif() -endmacro() - # Find and setup libarchive. # @return Forwards any variables from the `find_package` call. macro(clp_find_libarchive) @@ -102,15 +55,6 @@ macro(clp_find_libarchive) endif() endmacro() -# Find and setup log_surgeon library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_log_surgeon) - find_package(log_surgeon REQUIRED) - if(log_surgeon_FOUND) - #message(STATUS "Found log_surgeon ${log_surgeon_VERSION}") - endif() -endmacro() - # Find and setup LZMA library. # TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode. # @return Forwards any variables from the `find_package` call. @@ -179,44 +123,6 @@ macro(clp_find_msgpack) endif() endmacro() -# Find and setup nlohmann_json library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_nlohmann_json) - find_package(nlohmann_json REQUIRED) - if(nlohmann_json_FOUND) - #message(STATUS "Found nlohmann_json ${nlohmann_json_VERSION}") - endif() -endmacro() - -# Find and setup OpenSSL library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_openssl) - find_package(OpenSSL REQUIRED) - if(OPENSSL_FOUND) - #message(STATUS "Found OpenSSL (${OPENSSL_VERSION})") - else() - message(FATAL_ERROR "OpenSSL not found") - endif() -endmacro() - -# Find and setup simdjson library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_simdjson) - find_package(simdjson REQUIRED) - if(simdjson_FOUND) - #message(STATUS "Found simdjson ${simdjson_VERSION}") - endif() -endmacro() - -# Find and setup spdlog library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_spdlog) - find_package(spdlog REQUIRED) - if(spdlog_FOUND) - #message(STATUS "Found spdlog ${spdlog_VERSION}") - endif() -endmacro() - # Find and setup sqlite library. # @return Forwards any variables from the `FindDynamicLibraryDependencies` call. macro(clp_find_sqlite) @@ -225,15 +131,6 @@ macro(clp_find_sqlite) FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") endmacro() -# Find and setup yamlcpp library. -# @return Forwards any variables from the `find_package` call. -macro(clp_find_yamlcpp) - find_package(yaml-cpp REQUIRED) - if(yaml-cpp_FOUND) - #message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") - endif() -endmacro() - # Find and setup ystdlib. function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index 543fa6eeb8..8db2dc3d2b 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -125,14 +125,14 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_date() - clp_find_fmt() - clp_find_log_surgeon() + find_package(date REQUIRED) + find_package(fmt REQUIRED) + find_package(log_surgeon REQUIRED) clp_find_mariadb_client() - clp_find_nlohmann_json() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(spdlog REQUIRED) clp_find_sqlite() - clp_find_yamlcpp() + find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clo/CMakeLists.txt b/components/core/src/clp/clo/CMakeLists.txt index 3653613e29..fe11917059 100644 --- a/components/core/src/clp/clo/CMakeLists.txt +++ b/components/core/src/clp/clo/CMakeLists.txt @@ -153,13 +153,13 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_date() - clp_find_fmt() - clp_find_log_surgeon() + find_package(date REQUIRED) + find_package(fmt REQUIRED) + find_package(log_surgeon REQUIRED) clp_find_mongocxx() clp_find_msgpack() - clp_find_nlohmann_json() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(spdlog REQUIRED) clp_find_sqlite() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index 896fbfac50..3ee1b57906 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -167,15 +167,15 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_date() - clp_find_fmt() - clp_find_log_surgeon() - clp_find_spdlog() + find_package(date REQUIRED) + find_package(fmt REQUIRED) + find_package(log_surgeon REQUIRED) + find_package(spdlog REQUIRED) clp_find_sqlite() clp_find_libarchive() clp_find_mariadb_client() - clp_find_nlohmann_json() - clp_find_yamlcpp() + find_package(nlohmann_json REQUIRED) + find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt index 17223e656e..d31fc2d914 100644 --- a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt +++ b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt @@ -41,8 +41,8 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_log_surgeon() - clp_find_spdlog() + find_package(log_surgeon REQUIRED) + find_package(spdlog REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp_s/CMakeLists.txt b/components/core/src/clp_s/CMakeLists.txt index bd2f1911bf..3d49777281 100644 --- a/components/core/src/clp_s/CMakeLists.txt +++ b/components/core/src/clp_s/CMakeLists.txt @@ -84,11 +84,11 @@ set( if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES) clp_find_boost() clp_find_curl() - clp_find_fmt() + find_package(fmt REQUIRED) clp_find_msgpack() - clp_find_nlohmann_json() - clp_find_openssl() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(OpenSSL REQUIRED) + find_package(spdlog REQUIRED) clp_find_ystdlib() clp_find_zstd() @@ -142,7 +142,7 @@ set( # This library is intended as a temporary stand-in until the reducer has been packaged into # libraries. if(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) - clp_find_nlohmann_json() + find_package(nlohmann_json REQUIRED) add_library( clp_s_reducer_dependencies @@ -181,8 +181,8 @@ set( if(CLP_BUILD_CLP_S_IO) clp_find_boost() - clp_find_fmt() - clp_find_spdlog() + find_package(fmt REQUIRED) + find_package(spdlog REQUIRED) clp_find_zstd() add_library( @@ -245,14 +245,14 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEWRITER) - clp_find_absl() + find_package(absl REQUIRED) clp_find_boost() clp_find_curl() - clp_find_fmt() + find_package(fmt REQUIRED) clp_find_msgpack() - clp_find_nlohmann_json() - clp_find_simdjson() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(simdjson REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_archive_writer @@ -317,13 +317,13 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEREADER) - clp_find_absl() + find_package(absl REQUIRED) clp_find_boost() clp_find_curl() - clp_find_fmt() + find_package(fmt REQUIRED) clp_find_msgpack() - clp_find_nlohmann_json() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_archive_reader @@ -358,9 +358,9 @@ set( ) if(CLP_BUILD_CLP_S_JSONCONSTRUCTOR) - clp_find_fmt() + find_package(fmt REQUIRED) clp_find_mongocxx() - clp_find_spdlog() + find_package(spdlog REQUIRED) add_library( clp_s_json_constructor @@ -390,8 +390,8 @@ set( ) if(CLP_BUILD_CLP_S_TIMESTAMPPATTERN) - clp_find_date() - clp_find_spdlog() + find_package(date REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_timestamp_pattern @@ -425,7 +425,7 @@ if(CLP_BUILD_EXECUTABLES) clp_find_boost() clp_find_mongocxx() clp_find_msgpack() - clp_find_spdlog() + find_package(spdlog REQUIRED) clp_find_ystdlib() add_executable( diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index 92c0185501..b06760c13a 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -81,16 +81,16 @@ set( ) if(CLP_BUILD_EXECUTABLES) - clp_find_absl() + find_package(absl REQUIRED) clp_find_boost() clp_find_curl() - clp_find_date() + find_package(date REQUIRED) clp_find_mariadb_client() - clp_find_nlohmann_json() - clp_find_openssl() - clp_find_simdjson() - clp_find_spdlog() - clp_find_yamlcpp() + find_package(nlohmann_json REQUIRED) + find_package(OpenSSL REQUIRED) + find_package(simdjson REQUIRED) + find_package(spdlog REQUIRED) + find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp_s/search/CMakeLists.txt b/components/core/src/clp_s/search/CMakeLists.txt index a76084ce51..f2e25bf586 100644 --- a/components/core/src/clp_s/search/CMakeLists.txt +++ b/components/core/src/clp_s/search/CMakeLists.txt @@ -35,9 +35,9 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH) - clp_find_absl() - clp_find_simdjson() - clp_find_spdlog() + find_package(absl REQUIRED) + find_package(simdjson REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_search diff --git a/components/core/src/clp_s/search/ast/CMakeLists.txt b/components/core/src/clp_s/search/ast/CMakeLists.txt index db4c7f9b95..25efea63c5 100644 --- a/components/core/src/clp_s/search/ast/CMakeLists.txt +++ b/components/core/src/clp_s/search/ast/CMakeLists.txt @@ -50,7 +50,7 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH_AST) - clp_find_simdjson() + find_package(simdjson REQUIRED) add_library( clp_s_search_ast diff --git a/components/core/src/clp_s/search/kql/CMakeLists.txt b/components/core/src/clp_s/search/kql/CMakeLists.txt index 1266fcf8e9..5f1f11e382 100644 --- a/components/core/src/clp_s/search/kql/CMakeLists.txt +++ b/components/core/src/clp_s/search/kql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_KQL) - clp_find_antlr() - clp_find_spdlog() + find_package(antlr4-runtime REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_search_kql diff --git a/components/core/src/clp_s/search/sql/CMakeLists.txt b/components/core/src/clp_s/search/sql/CMakeLists.txt index 0f0362d10f..63c71187d2 100644 --- a/components/core/src/clp_s/search/sql/CMakeLists.txt +++ b/components/core/src/clp_s/search/sql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_SQL) - clp_find_antlr() - clp_find_spdlog() + find_package(antlr4-runtime REQUIRED) + find_package(spdlog REQUIRED) add_library( clp_s_search_sql diff --git a/components/core/src/glt/glt/CMakeLists.txt b/components/core/src/glt/glt/CMakeLists.txt index 8b23e9c0b1..9cd38dd2f6 100644 --- a/components/core/src/glt/glt/CMakeLists.txt +++ b/components/core/src/glt/glt/CMakeLists.txt @@ -173,14 +173,14 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_date() - clp_find_fmt() - clp_find_spdlog() + find_package(date REQUIRED) + find_package(fmt REQUIRED) + find_package(spdlog REQUIRED) clp_find_sqlite() clp_find_libarchive() clp_find_mariadb_client() - clp_find_nlohmann_json() - clp_find_yamlcpp() + find_package(nlohmann_json REQUIRED) + find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/reducer/CMakeLists.txt b/components/core/src/reducer/CMakeLists.txt index ca6be3f930..812c4628c2 100644 --- a/components/core/src/reducer/CMakeLists.txt +++ b/components/core/src/reducer/CMakeLists.txt @@ -40,11 +40,11 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - clp_find_fmt() + find_package(fmt REQUIRED) clp_find_mongocxx() clp_find_msgpack() - clp_find_nlohmann_json() - clp_find_spdlog() + find_package(nlohmann_json REQUIRED) + find_package(spdlog REQUIRED) add_executable(reducer-server ${REDUCER_SOURCES}) target_compile_features(reducer-server PRIVATE cxx_std_20) From 4200b50858ebb298eebdedc6819d8cd43210da75 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 16 Jul 2025 19:33:52 +0000 Subject: [PATCH 08/24] Remove most messages in utils --- components/core/cmake/Utils/utils.cmake | 44 ++++--------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/Utils/utils.cmake index 26a63b237c..3459546b63 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/Utils/utils.cmake @@ -24,11 +24,6 @@ macro(clp_find_boost) set(Boost_USE_STATIC_LIBS ON) endif() find_package(Boost 1.81 REQUIRED iostreams program_options filesystem system regex url) - if(Boost_FOUND) - #message(STATUS "Found Boost ${Boost_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Boost") - endif() endmacro() # Find and setup libcurl. @@ -36,11 +31,6 @@ endmacro() # @return Forwards any variables from the `find_package` call. macro(clp_find_curl) find_package(CURL 7.61.1 REQUIRED) - if(CURL_FOUND) - #message(STATUS "Found CURL ${CURL_VERSION_STRING}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for CURL") - endif() endmacro() # Find and setup libarchive. @@ -50,9 +40,6 @@ macro(clp_find_libarchive) set(LibArchive_USE_STATIC_LIBS ON) endif() find_package(LibArchive REQUIRED) - if(LibArchive_FOUND) - #message(STATUS "Found LibArchive ${LibArchive_VERSION}") - endif() endmacro() # Find and setup LZMA library. @@ -64,10 +51,6 @@ macro(clp_find_lzma) endif() find_package(LibLZMA REQUIRED) if(LIBLZMA_FOUND) - #message(STATUS "Found Lzma ${LIBLZMA_VERSION_STRING}") - #message(STATUS "Lzma library location: ${LIBLZMA_LIBRARIES}") - #message(STATUS "Lzma Include Dir: ${LIBLZMA_INCLUDE_DIRS}") - # Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115. set(REQUIRED_LIBLZMA_VERSION "5.8.1") if(LIBLZMA_VERSION_STRING VERSION_LESS ${REQUIRED_LIBLZMA_VERSION}) @@ -77,26 +60,22 @@ macro(clp_find_lzma) " ${REQUIRED_LIBLZMA_VERSION}" ) endif() - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for Lzma") + include_directories(${LIBLZMA_INCLUDE_DIRS}) endif() - include_directories(${LIBLZMA_INCLUDE_DIRS}) endmacro() # Find and setup MariaDBClient library. # @return Forwards any variables from the `find_package` call. macro(clp_find_mariadb_client) - if(CLP_USE_STATIC_LIBS) + # Only log static linking warning one time + get_clp_checked_find(mariadb_client) + if(CLP_USE_STATIC_LIBS AND NOT CLP_CHECKED_FIND) # NOTE: We can't statically link to MariaDBClient since it's GPL - #message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") + message(AUTHOR_WARNING "MariaDBClient cannot be statically linked due to its license.") endif() find_package(MariaDBClient 3.1.0 REQUIRED) - if(MariaDBClient_FOUND) - #message(STATUS "Found MariaDBClient ${MariaDBClient_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for MariaDBClient") - endif() + set_clp_checked_find(mariadb_client) endmacro() # Find and setup mongocxx library. @@ -104,7 +83,6 @@ endmacro() # forwards any variables from the `find_package` call. macro(clp_find_mongocxx) find_package(mongocxx REQUIRED) - #message(STATUS "Found mongocxx ${mongocxx_VERSION}") if(CLP_USE_STATIC_LIBS) set(MONGOCXX_TARGET mongo::mongocxx_static) else() @@ -116,11 +94,6 @@ endmacro() # @return Forwards any variables from the `find_package` call. macro(clp_find_msgpack) find_package(msgpack-cxx 7.0.0 REQUIRED) - if(msgpack-cxx_FOUND) - #message(STATUS "Found msgpack-cxx ${msgpack-cxx_VERSION}") - else() - message(FATAL_ERROR "Could not find msgpack-cxx") - endif() endmacro() # Find and setup sqlite library. @@ -151,9 +124,4 @@ macro(clp_find_zstd) set(ZStd_USE_STATIC_LIBS ON) endif() find_package(ZStd 1.4.4 REQUIRED) - if(ZStd_FOUND) - #message(STATUS "Found ZStd ${ZStd_VERSION}") - else() - message(FATAL_ERROR "Could not find ${CLP_LIBS_STRING} libraries for ZStd") - endif() endmacro() From c806443f2d8208d2e622f69ccc73536a48f8e2c7 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Thu, 17 Jul 2025 15:35:09 +0000 Subject: [PATCH 09/24] Move cmake/Utils/utils.cmake -> cmake/find_utils.cmake --- components/core/CMakeLists.txt | 2 +- components/core/cmake/{Utils/utils.cmake => find_utils.cmake} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename components/core/cmake/{Utils/utils.cmake => find_utils.cmake} (98%) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 2111949918..a73f45a4e3 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -15,7 +15,7 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Options/options.cmake") validate_all_clp_dependency_flags() # Include utilities to find and configure dependencies -include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/Utils/utils.cmake") +include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/find_utils.cmake") if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(default_build_type "Release") diff --git a/components/core/cmake/Utils/utils.cmake b/components/core/cmake/find_utils.cmake similarity index 98% rename from components/core/cmake/Utils/utils.cmake rename to components/core/cmake/find_utils.cmake index 3459546b63..19c8c008a5 100644 --- a/components/core/cmake/Utils/utils.cmake +++ b/components/core/cmake/find_utils.cmake @@ -1,4 +1,4 @@ -# This file contains utility functions for our other cmake scripts. +# This file contains utility functions for finding dependencies. # @param {string} LIBRARY # @return {bool} Whether we have already run the find function for LIBRARY in the CLP_CHECKED_FIND From 1afacc53aebebd7773215b12f46b284973c1c42b Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 19 Aug 2025 18:30:49 +0000 Subject: [PATCH 10/24] Minor fixup after merge. --- components/core/src/clp/clg/CMakeLists.txt | 1 + components/core/src/clp/clo/CMakeLists.txt | 1 + components/core/src/clp/clp/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index 5129db170e..2ff21ca635 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -130,6 +130,7 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_package(absl REQUIRED) clp_find_boost() find_package(date REQUIRED) find_package(fmt REQUIRED) diff --git a/components/core/src/clp/clo/CMakeLists.txt b/components/core/src/clp/clo/CMakeLists.txt index 2736391798..dc2007a35e 100644 --- a/components/core/src/clp/clo/CMakeLists.txt +++ b/components/core/src/clp/clo/CMakeLists.txt @@ -156,6 +156,7 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_package(absl REQUIRED) clp_find_boost() find_package(date REQUIRED) find_package(fmt REQUIRED) diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index 000ffcd333..e9d1a09307 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -168,6 +168,7 @@ set( ) if(CLP_BUILD_EXECUTABLES) + find_package(absl REQUIRED) clp_find_boost() find_package(date REQUIRED) find_package(fmt REQUIRED) From 609ea59e7a46fd8880aafb31477236672abb2c35 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 19 Aug 2025 19:24:55 +0000 Subject: [PATCH 11/24] Delete files accidentally added back in merge. --- components/core/cmake/Modules/FindLZ4.cmake | 103 ------------------ components/core/cmake/Modules/FindZStd.cmake | 106 ------------------- 2 files changed, 209 deletions(-) delete mode 100644 components/core/cmake/Modules/FindLZ4.cmake delete mode 100644 components/core/cmake/Modules/FindZStd.cmake diff --git a/components/core/cmake/Modules/FindLZ4.cmake b/components/core/cmake/Modules/FindLZ4.cmake deleted file mode 100644 index b8c7a592fb..0000000000 --- a/components/core/cmake/Modules/FindLZ4.cmake +++ /dev/null @@ -1,103 +0,0 @@ -# Try to find LZ4 -# -# Set LZ4_USE_STATIC_LIBS=ON to look for static libraries. -# -# Once done this will define: -# LZ4_FOUND - Whether LZ4 was found on the system -# LZ4_INCLUDE_DIR - The LZ4 include directories -# LZ4_VERSION - The version of LZ4 installed on the system -# -# Conventions: -# - Variables only for use within the script are prefixed with "lz4_" -# - Variables that should be externally visible are prefixed with "LZ4_" - -set(lz4_LIBNAME "lz4") - -include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") - -# Run pkg-config -find_package(PkgConfig) -pkg_check_modules(lz4_PKGCONF QUIET "lib${lz4_LIBNAME}") - -# Set include directory -find_path(LZ4_INCLUDE_DIR lz4.h - HINTS ${lz4_PKGCONF_INCLUDEDIR} - PATH_SUFFIXES include - ) - -# Handle static libraries -if(LZ4_USE_STATIC_LIBS) - # Save current value of CMAKE_FIND_LIBRARY_SUFFIXES - set(lz4_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - - # Temporarily change CMAKE_FIND_LIBRARY_SUFFIXES to static library suffix - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) -endif() - -# Find library -find_library(LZ4_LIBRARY - NAMES ${lz4_LIBNAME} - HINTS ${lz4_PKGCONF_LIBDIR} - PATH_SUFFIXES lib - ) -if (LZ4_LIBRARY) - # NOTE: This must be set for find_package_handle_standard_args to work - set(LZ4_FOUND ON) -endif() - -if(LZ4_USE_STATIC_LIBS) - FindStaticLibraryDependencies(${lz4_LIBNAME} lz4 "${lz4_PKGCONF_STATIC_LIBRARIES}") - - # Restore original value of CMAKE_FIND_LIBRARY_SUFFIXES - set(CMAKE_FIND_LIBRARY_SUFFIXES ${lz4_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - unset(lz4_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) -endif() - -FindDynamicLibraryDependencies(lz4 "${lz4_DYNAMIC_LIBS}") - -# Set version -set(LZ4_VERSION ${lz4_PKGCONF_VERSION}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LZ4 - REQUIRED_VARS LZ4_INCLUDE_DIR - VERSION_VAR LZ4_VERSION - ) - -if(NOT TARGET LZ4::LZ4) - # Add library to build - if (LZ4_FOUND) - if (LZ4_USE_STATIC_LIBS) - add_library(LZ4::LZ4 STATIC IMPORTED) - else() - # NOTE: We use UNKNOWN so that if the user doesn't have the SHARED - # libraries installed, we can still use the STATIC libraries - add_library(LZ4::LZ4 UNKNOWN IMPORTED) - endif() - endif() - - # Set include directories for library - if(LZ4_INCLUDE_DIR) - set_target_properties(LZ4::LZ4 - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}" - ) - endif() - - # Set location of library - if(EXISTS "${LZ4_LIBRARY}") - set_target_properties(LZ4::LZ4 - PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${LZ4_LIBRARY}" - ) - - # Add component's dependencies for linking - if(lz4_LIBRARY_DEPENDENCIES) - set_target_properties(LZ4::LZ4 - PROPERTIES - INTERFACE_LINK_LIBRARIES "${lz4_LIBRARY_DEPENDENCIES}" - ) - endif() - endif() -endif() diff --git a/components/core/cmake/Modules/FindZStd.cmake b/components/core/cmake/Modules/FindZStd.cmake deleted file mode 100644 index 672aa75f92..0000000000 --- a/components/core/cmake/Modules/FindZStd.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# Try to find ZStd -# -# Set ZStd_USE_STATIC_LIBS=ON to look for static libraries. -# -# Once done this will define: -# ZStd_FOUND - Whether ZStd was found on the system -# ZStd_INCLUDE_DIR - The ZStd include directories -# ZStd_VERSION - The version of ZStd installed on the system -# -# Conventions: -# - Variables only for use within the script are prefixed with "zstd_" -# - Variables that should be externally visible are prefixed with "ZStd_" - -set(zstd_LIBNAME "zstd") - -include("${PROJECT_SOURCE_DIR}/cmake/Modules/FindLibraryDependencies.cmake") - -# Run pkg-config -find_package(PkgConfig) -pkg_check_modules(zstd_PKGCONF QUIET lib${zstd_LIBNAME}) - -# Set include directory -find_path(ZStd_INCLUDE_DIR zstd.h - HINTS ${zstd_PKGCONF_INCLUDEDIR} - PATH_SUFFIXES include - ) - -# Handle static libraries -if(ZStd_USE_STATIC_LIBS) - # Save current value of CMAKE_FIND_LIBRARY_SUFFIXES - set(zstd_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - - # Temporarily change CMAKE_FIND_LIBRARY_SUFFIXES to static library suffix - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) -endif() - -# Find library -find_library(ZStd_LIBRARY - NAMES zstd - HINTS ${zstd_PKGCONF_LIBDIR} - PATH_SUFFIXES lib - ) -if (ZStd_LIBRARY) - # NOTE: This must be set for find_package_handle_standard_args to work - set(ZStd_FOUND ON) -endif() - -if(ZStd_USE_STATIC_LIBS) - FindStaticLibraryDependencies(${zstd_LIBNAME} zstd "${zstd_PKGCONF_STATIC_LIBRARIES}") - - # Restore original value of CMAKE_FIND_LIBRARY_SUFFIXES - set(CMAKE_FIND_LIBRARY_SUFFIXES ${zstd_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - unset(zstd_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) -endif() - -# Add pthread manually since zstd's pkgconfig doesn't include it -list(APPEND zstd_DYNAMIC_LIBS "pthread") - -FindDynamicLibraryDependencies(zstd "${zstd_DYNAMIC_LIBS}") - -# Set version -set(ZStd_VERSION ${zstd_PKGCONF_VERSION}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ZStd - REQUIRED_VARS ZStd_INCLUDE_DIR - VERSION_VAR ZStd_VERSION - ) - -if(NOT TARGET ZStd::ZStd) - # Add library to build - if (ZStd_FOUND) - if (ZStd_USE_STATIC_LIBS) - add_library(ZStd::ZStd STATIC IMPORTED) - else() - # NOTE: We use UNKNOWN so that if the user doesn't have the SHARED - # libraries installed, we can still use the STATIC libraries - add_library(ZStd::ZStd UNKNOWN IMPORTED) - endif() - endif() - - # Set include directories for library - if(ZStd_INCLUDE_DIR) - set_target_properties(ZStd::ZStd - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${ZStd_INCLUDE_DIR}" - ) - endif() - - # Set location of library - if(EXISTS "${ZStd_LIBRARY}") - set_target_properties(ZStd::ZStd - PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${ZStd_LIBRARY}" - ) - - # Add component's dependencies for linking - if(zstd_LIBRARY_DEPENDENCIES) - set_target_properties(ZStd::ZStd - PROPERTIES - INTERFACE_LINK_LIBRARIES "${zstd_LIBRARY_DEPENDENCIES}" - ) - endif() - endif() -endif() From d2c24ae917cc931c12cc72df3a5482ac85422524 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 26 Aug 2025 15:50:42 +0000 Subject: [PATCH 12/24] Add missing clp_find_msgpack() calls --- components/core/CMakeLists.txt | 1 + components/core/src/clp/clg/CMakeLists.txt | 1 + components/core/src/clp/clp/CMakeLists.txt | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 959503c803..666509e4cf 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -545,6 +545,7 @@ if(CLP_BUILD_TESTING) clp_find_lzma() clp_find_mariadb_client() clp_find_mongocxx() + clp_find_msgpack() find_package(nlohmann_json REQUIRED) find_package(OpenSSL REQUIRED) find_package(simdjson REQUIRED) diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index 02f75d2b45..2bdf77e5ca 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -136,6 +136,7 @@ if(CLP_BUILD_EXECUTABLES) find_package(fmt REQUIRED) find_package(log_surgeon REQUIRED) clp_find_mariadb_client() + clp_find_msgpack() find_package(nlohmann_json REQUIRED) find_package(spdlog REQUIRED) clp_find_sqlite() diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index d999d81b55..6d456609d6 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -172,12 +172,13 @@ if(CLP_BUILD_EXECUTABLES) clp_find_boost() find_package(date REQUIRED) find_package(fmt REQUIRED) - find_package(log_surgeon REQUIRED) - find_package(spdlog REQUIRED) - clp_find_sqlite() clp_find_libarchive() + find_package(log_surgeon REQUIRED) clp_find_mariadb_client() + clp_find_msgpack() find_package(nlohmann_json REQUIRED) + find_package(spdlog REQUIRED) + clp_find_sqlite() find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() From 4c2bc5090bc6915061f593ee7c8838fb50ab1882 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Tue, 26 Aug 2025 18:02:17 +0000 Subject: [PATCH 13/24] Add one more missing instance of clp_find_msgpack --- components/core/src/clp_s/indexer/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index 09c8cc31d3..a1629ab1ae 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -113,6 +113,7 @@ if(CLP_BUILD_EXECUTABLES) clp_find_curl() find_package(date REQUIRED) clp_find_mariadb_client() + clp_find_msgpack() find_package(nlohmann_json REQUIRED) find_package(OpenSSL REQUIRED) find_package(simdjson REQUIRED) From f76a40808ce162750474a3728ee55b5df35045e5 Mon Sep 17 00:00:00 2001 From: Devin Gibson Date: Wed, 3 Sep 2025 14:28:58 -0400 Subject: [PATCH 14/24] Update components/core/cmake/find_utils.cmake Co-authored-by: Bingran Hu --- components/core/cmake/find_utils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/core/cmake/find_utils.cmake b/components/core/cmake/find_utils.cmake index 694815c019..37a0db5a7f 100644 --- a/components/core/cmake/find_utils.cmake +++ b/components/core/cmake/find_utils.cmake @@ -115,7 +115,7 @@ endmacro() function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) - if (CLP_CHECKED_FIND) + if(CLP_CHECKED_FIND) return() endif() From 2d4ef0c64d30b167577dee53dbb49671a79ab634 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 3 Sep 2025 18:42:25 +0000 Subject: [PATCH 15/24] Remove unnecessary find_package(yaml-cpp) calls --- components/core/CMakeLists.txt | 1 - components/core/src/clp/clg/CMakeLists.txt | 1 - components/core/src/clp/clp/CMakeLists.txt | 1 - components/core/src/clp_s/indexer/CMakeLists.txt | 1 - 4 files changed, 4 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 666509e4cf..6535cd7c14 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -551,7 +551,6 @@ if(CLP_BUILD_TESTING) find_package(simdjson REQUIRED) find_package(spdlog REQUIRED) clp_find_sqlite() - find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index 2bdf77e5ca..c52654fd4b 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -140,7 +140,6 @@ if(CLP_BUILD_EXECUTABLES) find_package(nlohmann_json REQUIRED) find_package(spdlog REQUIRED) clp_find_sqlite() - find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index 6d456609d6..7ba2efaf54 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -179,7 +179,6 @@ if(CLP_BUILD_EXECUTABLES) find_package(nlohmann_json REQUIRED) find_package(spdlog REQUIRED) clp_find_sqlite() - find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index a1629ab1ae..0d204f9648 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -118,7 +118,6 @@ if(CLP_BUILD_EXECUTABLES) find_package(OpenSSL REQUIRED) find_package(simdjson REQUIRED) find_package(spdlog REQUIRED) - find_package(yaml-cpp REQUIRED) clp_find_ystdlib() clp_find_zstd() From 51d26f6f5ca8509c2107547eaddb19bf958e6801 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 3 Sep 2025 18:50:33 +0000 Subject: [PATCH 16/24] Address review comment --- components/core/cmake/Options/options.cmake | 78 ++++++--------------- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/components/core/cmake/Options/options.cmake b/components/core/cmake/Options/options.cmake index 20bf024f64..4ebd6bd1c6 100644 --- a/components/core/cmake/Options/options.cmake +++ b/components/core/cmake/Options/options.cmake @@ -94,12 +94,17 @@ option( # @param {string} TARGET_CLP_BUILD_OPTION # @param {string[]} ARGN The required `CLP_BUILD_` options function(validate_clp_dependencies_for_target TARGET_CLP_BUILD_OPTION) - if (NOT DEFINED TARGET_CLP_BUILD_OPTION OR TARGET_CLP_BUILD_OPTION STREQUAL "") + if(NOT DEFINED TARGET_CLP_BUILD_OPTION OR TARGET_CLP_BUILD_OPTION STREQUAL "") message(FATAL_ERROR "TARGET_CLP_BUILD_OPTION can't be unset or empty.") endif() + # Only validate dependencies for this option if the option is enabled. + if(NOT "${${TARGET_CLP_BUILD_OPTION}}") + return() + endif() + foreach(DEPENDENCY IN LISTS ARGN) - if (NOT "${${DEPENDENCY}}") + if(NOT "${${DEPENDENCY}}") message(FATAL_ERROR "${TARGET_CLP_BUILD_OPTION} requires ${DEPENDENCY}=ON") endif() endforeach() @@ -219,61 +224,20 @@ endfunction() # Validates that for each target whose `CLP_BUILD_` option is `ON`, the `CLP_BUILD_` options for # the target's dependencies are also `ON`. function(validate_all_clp_dependency_flags) - if (CLP_BUILD_EXECUTABLES) - validate_clp_binaries_dependencies() - endif() - - if (CLP_BUILD_TESTING) - validate_clp_tests_dependencies() - endif() - - if (CLP_BUILD_CLP_REGEX_UTILS) - validate_clp_regex_utils_dependencies() - endif() - + validate_clp_binaries_dependencies() + validate_clp_tests_dependencies() + validate_clp_regex_utils_dependencies() # clp::string_utils has no dependencies - if (CLP_BUILD_CLP_S_ARCHIVEREADER) - validate_clp_s_archivereader_dependencies() - endif() - - if (CLP_BUILD_CLP_S_ARCHIVEWRITER) - validate_clp_s_archivewriter_dependencies() - endif() - - if (CLP_BUILD_CLP_S_CLP_DEPENDENCIES) - validate_clp_s_clp_dependencies_dependencies() - endif() - - if (CLP_BUILD_CLP_S_IO) - validate_clp_s_io_dependencies() - endif() - - if (CLP_BUILD_CLP_S_JSONCONSTRUCTOR) - validate_clp_s_json_constructor_dependencies() - endif() - - if (CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) - validate_clp_s_reducer_dependencies_dependencies() - endif() - - if (CLP_BUILD_CLP_S_SEARCH) - validate_clp_s_search_dependencies() - endif() - - if (CLP_BUILD_CLP_S_SEARCH_AST) - validate_clp_s_search_ast_dependencies() - endif() - - if (CLP_BUILD_CLP_S_SEARCH_KQL) - validate_clp_s_search_kql_dependencies() - endif() - - if (CLP_BUILD_CLP_S_SEARCH_SQL) - validate_clp_s_search_sql_dependencies() - endif() - - if (CLP_BUILD_CLP_S_TIMESTAMPPATTERN) - validate_clp_s_timestamppattern_dependencies() - endif() + validate_clp_s_archivereader_dependencies() + validate_clp_s_archivewriter_dependencies() + validate_clp_s_clp_dependencies_dependencies() + validate_clp_s_io_dependencies() + validate_clp_s_json_constructor_dependencies() + validate_clp_s_reducer_dependencies_dependencies() + validate_clp_s_search_dependencies() + validate_clp_s_search_ast_dependencies() + validate_clp_s_search_kql_dependencies() + validate_clp_s_search_sql_dependencies() + validate_clp_s_timestamppattern_dependencies() endfunction() From 1251b95343dbcddba41ee2bf2783d7d4d8ec4c66 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Thu, 4 Sep 2025 15:12:27 +0000 Subject: [PATCH 17/24] Move remaining find_package calls into macros. --- components/core/CMakeLists.txt | 16 ++-- components/core/cmake/find_utils.cmake | 83 ++++++++++++++++--- components/core/src/clp/clg/CMakeLists.txt | 12 +-- components/core/src/clp/clo/CMakeLists.txt | 12 +-- components/core/src/clp/clp/CMakeLists.txt | 12 +-- .../make_dictionaries_readable/CMakeLists.txt | 4 +- components/core/src/clp_s/CMakeLists.txt | 44 +++++----- .../core/src/clp_s/indexer/CMakeLists.txt | 12 +-- .../core/src/clp_s/search/CMakeLists.txt | 8 +- .../core/src/clp_s/search/ast/CMakeLists.txt | 2 +- .../core/src/clp_s/search/kql/CMakeLists.txt | 4 +- .../core/src/clp_s/search/sql/CMakeLists.txt | 4 +- components/core/src/glt/glt/CMakeLists.txt | 10 +-- components/core/src/reducer/CMakeLists.txt | 6 +- 14 files changed, 145 insertions(+), 84 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 6535cd7c14..81ed7b4359 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -534,22 +534,22 @@ set(SOURCE_FILES_unitTest ) if(CLP_BUILD_TESTING) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() clp_find_catch2() clp_find_curl() - find_package(date REQUIRED) - find_package(fmt REQUIRED) + clp_find_date() + clp_find_fmt() clp_find_libarchive() - find_package(log_surgeon REQUIRED) + clp_find_log_surgeon() clp_find_lzma() clp_find_mariadb_client() clp_find_mongocxx() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(OpenSSL REQUIRED) - find_package(simdjson REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_open_ssl() + clp_find_simdjson() + clp_find_spdlog() clp_find_sqlite() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/cmake/find_utils.cmake b/components/core/cmake/find_utils.cmake index 37a0db5a7f..4ccf1cde67 100644 --- a/components/core/cmake/find_utils.cmake +++ b/components/core/cmake/find_utils.cmake @@ -17,7 +17,19 @@ function(set_clp_checked_find LIBRARY) set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY "clp_checked_find_${LIBRARY}" TRUE) endfunction() -# Find and setup Boost library. +# Finds and sets up the the absl library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_absl) + find_package(absl REQUIRED) +endmacro() + +# Finds and sets up the the antlr4-runtime library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_antlr4_runtime) + find_package(antlr4-runtime REQUIRED) +endmacro() + +# Finds and sets up the the Boost library. # @return Forwards any variables from the `find_package` call. macro(clp_find_boost) if(CLP_USE_STATIC_LIBS) @@ -36,20 +48,32 @@ macro(clp_find_boost) ) endmacro() -# Find and setup Catch2. +# Finds and sets up Catch2. # @return Forwards any variables from the `find_package` call. macro(clp_find_catch2) find_package(Catch2 3.8.0 REQUIRED) endmacro() -# Find and setup libcurl. +# Finds and sets up libcurl. # By default, CURL does not provide static libraries. # @return Forwards any variables from the `find_package` call. macro(clp_find_curl) find_package(CURL 7.61.1 REQUIRED) endmacro() -# Find and setup libarchive. +# Finds and sets up the date library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_date) + find_package(date REQUIRED) +endmacro() + +# Finds and sets up the fmt library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_fmt) + find_package(fmt REQUIRED) +endmacro() + +# Finds and sets up libarchive. # @return Forwards any variables from the `find_package` call. macro(clp_find_libarchive) if(CLP_USE_STATIC_LIBS) @@ -58,7 +82,13 @@ macro(clp_find_libarchive) find_package(LibArchive REQUIRED) endmacro() -# Find and setup LZMA library. +# Finds and sets up the log_surgeon library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_log_surgeon) + find_package(log_surgeon REQUIRED) +endmacro() + +# Finds and sets up the LZMA library. # TODO: Add a script in ./cmake/Modules to properly import LZMA in find_package()'s module mode. # @return Forwards any variables from the `find_package` call. macro(clp_find_lzma) @@ -72,7 +102,7 @@ macro(clp_find_lzma) find_package(LibLZMA 5.8.1 REQUIRED) endmacro() -# Find and setup MariaDBClient library. +# Finds and sets up the MariaDBClient library. # @return Forwards any variables from the `find_package` call. macro(clp_find_mariadb_client) # Only log static linking warning one time @@ -85,7 +115,7 @@ macro(clp_find_mariadb_client) set_clp_checked_find(mariadb_client) endmacro() -# Find and setup mongocxx library. +# Finds and sets up the mongocxx library. # @return The name of the mongocxx target in the `MONGOCXX_TARGET` variable, and # forwards any variables from the `find_package` call. macro(clp_find_mongocxx) @@ -97,13 +127,37 @@ macro(clp_find_mongocxx) endif() endmacro() -# Find and setup msgpack library. +# Finds and sets up the msgpack library. # @return Forwards any variables from the `find_package` call. macro(clp_find_msgpack) find_package(msgpack-cxx 7.0.0 REQUIRED) endmacro() -# Find and setup sqlite library. +# Finds and sets up the nlohmann json library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_nlohmann_json) + find_package(nlohmann_json REQUIRED) +endmacro() + +# Finds and sets up OpenSSL. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_open_ssl) + find_package(OpenSSL REQUIRED) +endmacro() + +# Finds and sets up the simdjson library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_simdjson) + find_package(simdjson REQUIRED) +endmacro() + +# Finds and sets up the spdlog library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_spdlog) + find_package(spdlog REQUIRED) +endmacro() + +# Finds and sets up the sqlite library. # @return Forwards any variables from the `FindDynamicLibraryDependencies` call. macro(clp_find_sqlite) set(sqlite_DYNAMIC_LIBS "dl;m;pthread") @@ -111,7 +165,14 @@ macro(clp_find_sqlite) FindDynamicLibraryDependencies(sqlite "${sqlite_DYNAMIC_LIBS}") endmacro() -# Find and setup ystdlib. +# Finds and sets up the yaml-cpp library. +# @return Forwards any variables from the `find_package` call. +macro(clp_find_yaml_cpp) + find_package(yaml-cpp REQUIRED) +endmacro() + + +# Finds and sets up ystdlib. function(clp_find_ystdlib) # We can not call `add_subdirectory` for the same directory multiple times. get_clp_checked_find(ystdlib) @@ -124,7 +185,7 @@ function(clp_find_ystdlib) set_clp_checked_find(ystdlib) endfunction() -# Find and setup ZStd library. +# Finds and sets up the ZStd library. # @return Forwards any variables from the `find_package` call. macro(clp_find_zstd) # v1.4.8 is the lowest version available in the package managers of the OSes we support. diff --git a/components/core/src/clp/clg/CMakeLists.txt b/components/core/src/clp/clg/CMakeLists.txt index c52654fd4b..5647c90a83 100644 --- a/components/core/src/clp/clg/CMakeLists.txt +++ b/components/core/src/clp/clg/CMakeLists.txt @@ -130,15 +130,15 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() - find_package(date REQUIRED) - find_package(fmt REQUIRED) - find_package(log_surgeon REQUIRED) + clp_find_date() + clp_find_fmt() + clp_find_log_surgeon() clp_find_mariadb_client() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_spdlog() clp_find_sqlite() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clo/CMakeLists.txt b/components/core/src/clp/clo/CMakeLists.txt index dc2007a35e..3eb605ec03 100644 --- a/components/core/src/clp/clo/CMakeLists.txt +++ b/components/core/src/clp/clo/CMakeLists.txt @@ -156,15 +156,15 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() - find_package(date REQUIRED) - find_package(fmt REQUIRED) - find_package(log_surgeon REQUIRED) + clp_find_date() + clp_find_fmt() + clp_find_log_surgeon() clp_find_mongocxx() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_spdlog() clp_find_sqlite() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/clp/CMakeLists.txt b/components/core/src/clp/clp/CMakeLists.txt index 7ba2efaf54..ddfbc0e803 100644 --- a/components/core/src/clp/clp/CMakeLists.txt +++ b/components/core/src/clp/clp/CMakeLists.txt @@ -168,16 +168,16 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() - find_package(date REQUIRED) - find_package(fmt REQUIRED) + clp_find_date() + clp_find_fmt() clp_find_libarchive() - find_package(log_surgeon REQUIRED) + clp_find_log_surgeon() clp_find_mariadb_client() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_spdlog() clp_find_sqlite() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt index 0a71eff5f7..3890e28dd3 100644 --- a/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt +++ b/components/core/src/clp/make_dictionaries_readable/CMakeLists.txt @@ -41,8 +41,8 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - find_package(log_surgeon REQUIRED) - find_package(spdlog REQUIRED) + clp_find_log_surgeon() + clp_find_spdlog() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp_s/CMakeLists.txt b/components/core/src/clp_s/CMakeLists.txt index a56fbae39e..17caacc79e 100644 --- a/components/core/src/clp_s/CMakeLists.txt +++ b/components/core/src/clp_s/CMakeLists.txt @@ -105,12 +105,12 @@ set( if(CLP_BUILD_CLP_S_CLP_DEPENDENCIES) clp_find_boost() clp_find_curl() - find_package(fmt REQUIRED) - find_package(log_surgeon REQUIRED) + clp_find_fmt() + clp_find_log_surgeon() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(OpenSSL REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_open_ssl() + clp_find_spdlog() clp_find_ystdlib() clp_find_zstd() @@ -165,7 +165,7 @@ set( # This library is intended as a temporary stand-in until the reducer has been packaged into # libraries. if(CLP_BUILD_CLP_S_REDUCER_DEPENDENCIES) - find_package(nlohmann_json REQUIRED) + clp_find_nlohmann_json() add_library( clp_s_reducer_dependencies @@ -204,8 +204,8 @@ set( if(CLP_BUILD_CLP_S_IO) clp_find_boost() - find_package(fmt REQUIRED) - find_package(spdlog REQUIRED) + clp_find_fmt() + clp_find_spdlog() clp_find_zstd() add_library( @@ -266,14 +266,14 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEWRITER) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() clp_find_curl() - find_package(fmt REQUIRED) + clp_find_fmt() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(simdjson REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_simdjson() + clp_find_spdlog() add_library( clp_s_archive_writer @@ -336,13 +336,13 @@ set( ) if(CLP_BUILD_CLP_S_ARCHIVEREADER) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() clp_find_curl() - find_package(fmt REQUIRED) + clp_find_fmt() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_spdlog() add_library( clp_s_archive_reader @@ -378,9 +378,9 @@ set( ) if(CLP_BUILD_CLP_S_JSONCONSTRUCTOR) - find_package(fmt REQUIRED) + clp_find_fmt() clp_find_mongocxx() - find_package(spdlog REQUIRED) + clp_find_spdlog() clp_find_zstd() add_library( @@ -412,8 +412,8 @@ set( ) if(CLP_BUILD_CLP_S_TIMESTAMPPATTERN) - find_package(date REQUIRED) - find_package(spdlog REQUIRED) + clp_find_date() + clp_find_spdlog() add_library( clp_s_timestamp_pattern @@ -447,7 +447,7 @@ if(CLP_BUILD_EXECUTABLES) clp_find_boost() clp_find_mongocxx() clp_find_msgpack() - find_package(spdlog REQUIRED) + clp_find_spdlog() clp_find_ystdlib() add_executable( diff --git a/components/core/src/clp_s/indexer/CMakeLists.txt b/components/core/src/clp_s/indexer/CMakeLists.txt index 0d204f9648..62b6d91c82 100644 --- a/components/core/src/clp_s/indexer/CMakeLists.txt +++ b/components/core/src/clp_s/indexer/CMakeLists.txt @@ -108,16 +108,16 @@ set( ) if(CLP_BUILD_EXECUTABLES) - find_package(absl REQUIRED) + clp_find_absl() clp_find_boost() clp_find_curl() - find_package(date REQUIRED) + clp_find_date() clp_find_mariadb_client() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(OpenSSL REQUIRED) - find_package(simdjson REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_open_ssl() + clp_find_simdjson() + clp_find_spdlog() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/clp_s/search/CMakeLists.txt b/components/core/src/clp_s/search/CMakeLists.txt index 5258fdb254..4eb4e459cc 100644 --- a/components/core/src/clp_s/search/CMakeLists.txt +++ b/components/core/src/clp_s/search/CMakeLists.txt @@ -27,10 +27,10 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH) - find_package(absl REQUIRED) - find_package(log_surgeon REQUIRED) - find_package(simdjson REQUIRED) - find_package(spdlog REQUIRED) + clp_find_absl() + clp_find_log_surgeon() + clp_find_simdjson() + clp_find_spdlog() add_library( clp_s_search diff --git a/components/core/src/clp_s/search/ast/CMakeLists.txt b/components/core/src/clp_s/search/ast/CMakeLists.txt index 25efea63c5..db4c7f9b95 100644 --- a/components/core/src/clp_s/search/ast/CMakeLists.txt +++ b/components/core/src/clp_s/search/ast/CMakeLists.txt @@ -50,7 +50,7 @@ set( ) if(CLP_BUILD_CLP_S_SEARCH_AST) - find_package(simdjson REQUIRED) + clp_find_simdjson() add_library( clp_s_search_ast diff --git a/components/core/src/clp_s/search/kql/CMakeLists.txt b/components/core/src/clp_s/search/kql/CMakeLists.txt index 5f1f11e382..86da4dcfe2 100644 --- a/components/core/src/clp_s/search/kql/CMakeLists.txt +++ b/components/core/src/clp_s/search/kql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_KQL) - find_package(antlr4-runtime REQUIRED) - find_package(spdlog REQUIRED) + clp_find_antlr4_runtime() + clp_find_spdlog() add_library( clp_s_search_kql diff --git a/components/core/src/clp_s/search/sql/CMakeLists.txt b/components/core/src/clp_s/search/sql/CMakeLists.txt index 63c71187d2..5d38fb1c0b 100644 --- a/components/core/src/clp_s/search/sql/CMakeLists.txt +++ b/components/core/src/clp_s/search/sql/CMakeLists.txt @@ -12,8 +12,8 @@ set(ANTLR_GENERATED_SOURCES ) if(CLP_BUILD_CLP_S_SEARCH_SQL) - find_package(antlr4-runtime REQUIRED) - find_package(spdlog REQUIRED) + clp_find_antlr4_runtime() + clp_find_spdlog() add_library( clp_s_search_sql diff --git a/components/core/src/glt/glt/CMakeLists.txt b/components/core/src/glt/glt/CMakeLists.txt index 10d195c773..6a181913b7 100644 --- a/components/core/src/glt/glt/CMakeLists.txt +++ b/components/core/src/glt/glt/CMakeLists.txt @@ -173,14 +173,14 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - find_package(date REQUIRED) - find_package(fmt REQUIRED) - find_package(spdlog REQUIRED) + clp_find_date() + clp_find_fmt() + clp_find_spdlog() clp_find_sqlite() clp_find_libarchive() clp_find_mariadb_client() - find_package(nlohmann_json REQUIRED) - find_package(yaml-cpp REQUIRED) + clp_find_nlohmann_json() + clp_find_yaml_cpp() clp_find_ystdlib() clp_find_zstd() diff --git a/components/core/src/reducer/CMakeLists.txt b/components/core/src/reducer/CMakeLists.txt index 812c4628c2..ca6be3f930 100644 --- a/components/core/src/reducer/CMakeLists.txt +++ b/components/core/src/reducer/CMakeLists.txt @@ -40,11 +40,11 @@ set( if(CLP_BUILD_EXECUTABLES) clp_find_boost() - find_package(fmt REQUIRED) + clp_find_fmt() clp_find_mongocxx() clp_find_msgpack() - find_package(nlohmann_json REQUIRED) - find_package(spdlog REQUIRED) + clp_find_nlohmann_json() + clp_find_spdlog() add_executable(reducer-server ${REDUCER_SOURCES}) target_compile_features(reducer-server PRIVATE cxx_std_20) From 322bfb4a3dc4d43598d5f7079fa6a7cd32e5b023 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Thu, 4 Sep 2025 15:24:24 +0000 Subject: [PATCH 18/24] Fix boost warning --- components/core/cmake/find_utils.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/core/cmake/find_utils.cmake b/components/core/cmake/find_utils.cmake index 4ccf1cde67..b99a7260d0 100644 --- a/components/core/cmake/find_utils.cmake +++ b/components/core/cmake/find_utils.cmake @@ -37,7 +37,7 @@ macro(clp_find_boost) endif() find_package( Boost - 1.81...1.88 + 1.81 REQUIRED filesystem iostreams @@ -46,6 +46,12 @@ macro(clp_find_boost) system url ) + if(Boost_VERSION VERSION_GREATER 1.88) + message( + FATAL_ERROR + "Boost version ${Boost_VERSION} is newer than the maximum allowed version (1.88.0)." + ) + endif() endmacro() # Finds and sets up Catch2. From 02fc9f304dccdd0f3979071227047f001459e012 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Thu, 4 Sep 2025 15:35:48 +0000 Subject: [PATCH 19/24] Make boost find_package call silent after first invocation. --- components/core/cmake/find_utils.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/core/cmake/find_utils.cmake b/components/core/cmake/find_utils.cmake index b99a7260d0..4ee325c347 100644 --- a/components/core/cmake/find_utils.cmake +++ b/components/core/cmake/find_utils.cmake @@ -32,12 +32,20 @@ endmacro() # Finds and sets up the the Boost library. # @return Forwards any variables from the `find_package` call. macro(clp_find_boost) + get_clp_checked_find(boost) + if(CLP_CHECKED_FIND) + # Silence output from `find_package(Boost)` on repeated invocations. + set(CLP_QUIET_FIND_BOOST QUIET) + endif() + if(CLP_USE_STATIC_LIBS) set(Boost_USE_STATIC_LIBS ON) endif() + find_package( Boost 1.81 + ${CLP_QUIET_FIND_BOOST} REQUIRED filesystem iostreams @@ -52,6 +60,7 @@ macro(clp_find_boost) "Boost version ${Boost_VERSION} is newer than the maximum allowed version (1.88.0)." ) endif() + set_clp_checked_find(boost) endmacro() # Finds and sets up Catch2. From 3808fe20d8d22dacc9eaed5a96da12d40029370b Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Thu, 4 Sep 2025 18:39:08 +0000 Subject: [PATCH 20/24] Delete unnecessary function. --- components/core/cmake/Options/options.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/core/cmake/Options/options.cmake b/components/core/cmake/Options/options.cmake index 4ebd6bd1c6..9096b614dc 100644 --- a/components/core/cmake/Options/options.cmake +++ b/components/core/cmake/Options/options.cmake @@ -142,10 +142,6 @@ function(validate_clp_regex_utils_dependencies) ) endfunction() -function(set_clp_regex_utils_dependencies) - set_property(DIRECTORY PROPERTY CLP_NEED_YSTDLIB TRUE) -endfunction() - function(validate_clp_s_archivereader_dependencies) validate_clp_dependencies_for_target(CLP_BUILD_CLP_S_ARCHIVEREADER CLP_BUILD_CLP_STRING_UTILS From a42fd907931e1c9d793e6ca898896c70fcdd45a8 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 24 Sep 2025 20:14:57 +0000 Subject: [PATCH 21/24] Fix ystdlib-specific issue related to how ystdlib config scripts are written. --- components/core/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index 9c2e4ef01b..4a234d9c73 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -140,6 +140,11 @@ endif() find_package(Threads REQUIRED) +# Temporarily find ystdlib unconditionally, since the global include guards in ystdlib's cmake +# config files prevent clp_find_ystdlib() from correctly resolving ystdlib when called from multiple +# different scopes. +clp_find_ystdlib() + add_subdirectory(src/clp/regex_utils) add_subdirectory(src/clp/string_utils) From 735f91ef8820d08f4af8d9761a9426fa36c876d1 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Mon, 3 Nov 2025 18:01:25 +0000 Subject: [PATCH 22/24] Add missing clp_find statements to log-converter CMakeLists --- components/core/src/clp_s/log_converter/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/core/src/clp_s/log_converter/CMakeLists.txt b/components/core/src/clp_s/log_converter/CMakeLists.txt index 3d78443412..c3b397f4aa 100644 --- a/components/core/src/clp_s/log_converter/CMakeLists.txt +++ b/components/core/src/clp_s/log_converter/CMakeLists.txt @@ -9,6 +9,14 @@ set( ) if(CLP_BUILD_EXECUTABLES) + clp_find_boost() + clp_find_fmt() + clp_find_log_surgeon() + clp_find_msgpack() + clp_find_nlohmann_json() + clp_find_spdlog() + clp_find_ystdlib() + add_executable( log-converter log_converter.cpp From cf9f42abed8a8cc07bb9add488aa02ae093cc8db Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Mon, 3 Nov 2025 18:01:49 +0000 Subject: [PATCH 23/24] Bump ystdlib to c03806a --- taskfiles/deps/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/taskfiles/deps/main.yaml b/taskfiles/deps/main.yaml index 118ec1736e..947958aa73 100644 --- a/taskfiles/deps/main.yaml +++ b/taskfiles/deps/main.yaml @@ -600,8 +600,8 @@ tasks: - "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" - "-Dystdlib_BUILD_TESTING=OFF" LIB_NAME: "ystdlib" - TARBALL_SHA256: "65990dc2bcc4a355c2181bfe31a7800f492309d1bcd340f52a34e85047e61bc8" - TARBALL_URL: "https://github.com/y-scope/ystdlib-cpp/archive/9ed78cd.tar.gz" + TARBALL_SHA256: "379c04c86715f39cffa09bb3ebc22b4c45af9a63ea3efa2081d210289fcd2af6" + TARBALL_URL: "https://github.com/y-scope/ystdlib-cpp/archive/c03806a.tar.gz" zlib: internal: true From 32984670028f114486cc4798094faa529aee6dde Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Mon, 3 Nov 2025 18:02:13 +0000 Subject: [PATCH 24/24] Remove workaround for finding ystdlib --- components/core/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/core/CMakeLists.txt b/components/core/CMakeLists.txt index f9e3619572..7d6edb6ef3 100644 --- a/components/core/CMakeLists.txt +++ b/components/core/CMakeLists.txt @@ -140,11 +140,6 @@ endif() find_package(Threads REQUIRED) -# Temporarily find ystdlib unconditionally, since the global include guards in ystdlib's cmake -# config files prevent clp_find_ystdlib() from correctly resolving ystdlib when called from multiple -# different scopes. -clp_find_ystdlib() - add_subdirectory(src/clp/regex_utils) add_subdirectory(src/clp/string_utils)