Merge remote-tracking branch 'origin/topic/timw/cleanup-cmake-summary-output'

* origin/topic/timw/cleanup-cmake-summary-output:
  Add utility methods to make CMake summary output nicer
This commit is contained in:
Tim Wojtulewicz 2025-05-30 12:16:27 -07:00
commit 70bc0d9deb
3 changed files with 118 additions and 65 deletions

View file

@ -1,3 +1,7 @@
8.0.0-dev.296 | 2025-05-30 12:16:27 -0700
* Add utility methods to make CMake summary output nicer (Tim Wojtulewicz, Corelight)
8.0.0-dev.294 | 2025-05-30 10:29:29 -0700 8.0.0-dev.294 | 2025-05-30 10:29:29 -0700
* CI: Add PR label for skipping all CI jobs (Tim Wojtulewicz, Corelight) * CI: Add PR label for skipping all CI jobs (Tim Wojtulewicz, Corelight)

View file

@ -68,7 +68,8 @@ option(INSTALL_ZEEKCTL "Install zeekctl." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_ZEEK_CLIENT "Install the zeek-client." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_ZEEK_CLIENT "Install the zeek-client." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(INSTALL_ZKG "Install zkg." ${ZEEK_INSTALL_TOOLS_DEFAULT}) option(INSTALL_ZKG "Install zkg." ${ZEEK_INSTALL_TOOLS_DEFAULT})
option(PREALLOCATE_PORT_ARRAY "Pre-allocate all ports for zeek::Val." ON) option(PREALLOCATE_PORT_ARRAY "Pre-allocate all ports for zeek::Val." ON)
option(ZEEK_STANDALONE "Build Zeek as stand-alone binary?" ON) option(ZEEK_STANDALONE "Build Zeek as stand-alone binary." ON)
option(ZEEK_ENABLE_FUZZERS "Build Zeek fuzzing targets." OFF)
# Non-boolean options. # Non-boolean options.
if (NOT WIN32) if (NOT WIN32)
@ -1494,68 +1495,116 @@ if (ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS)
) )
endif () endif ()
message( set(_zeek_builtin_plugins "${ZEEK_BUILTIN_PLUGINS}")
"\n====================| Zeek Build Summary |====================" if (NOT ZEEK_BUILTIN_PLUGINS)
"\n" set(_zeek_builtin_plugins "none")
"\nBuild type: ${CMAKE_BUILD_TYPE}" endif ()
"\nBuild dir: ${PROJECT_BINARY_DIR}"
"\n" set(_zeek_fuzzing_engine "${ZEEK_FUZZING_ENGINE}")
"\nInstall prefix: ${CMAKE_INSTALL_PREFIX}" if (NOT ZEEK_FUZZING_ENGINE)
"\nConfig file dir: ${ZEEK_ETC_INSTALL_DIR}" if (ZEEK_ENABLE_FUZZERS)
"\nLog dir: ${ZEEK_LOG_DIR}" # The default fuzzer used by gcc and clang is libFuzzer. This is if you
"\nPlugin dir: ${ZEEK_PLUGIN_DIR}" # simply pass '-fsanitize=fuzzer' to the compiler.
"\nPython module dir: ${PY_MOD_INSTALL_DIR}" set(_zeek_fuzzing_engine "libFuzzer")
"\nScript dir: ${ZEEK_SCRIPT_INSTALL_PATH}" endif ()
"\nSpool dir: ${ZEEK_SPOOL_DIR}" endif ()
"\nState dir: ${ZEEK_STATE_DIR}"
"\nSpicy modules dir: ${ZEEK_SPICY_MODULE_PATH}" ## Utility method for outputting status information for features that just have a
"\n" ## string representation. This can also take an option second argument that is a
"\nDebug mode: ${ENABLE_DEBUG}" ## value string to print.
"\nUnit tests: ${ENABLE_ZEEK_UNIT_TESTS}" function (output_summary_line what)
"\nBuiltin Plugins: ${ZEEK_BUILTIN_PLUGINS}" set(_spaces " ")
"\n" string(LENGTH ${what} _what_length)
"\nCC: ${CMAKE_C_COMPILER}" math(EXPR _num_spaces "25 - ${_what_length}")
"\nCFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}" string(SUBSTRING ${_spaces} 0 ${_num_spaces} _spacing)
"\nCXX: ${CMAKE_CXX_COMPILER}" message("${what}:${_spacing}${ARGV1}")
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}" endfunction ()
"\nCPP: ${CMAKE_CXX_COMPILER}"
"\n" ## Utility method for outputting status information for features that have an ON/OFF
"\nAF_PACKET: ${ZEEK_HAVE_AF_PACKET}" ## state.
"\nAux. Tools: ${INSTALL_AUX_TOOLS}" function (output_summary_state what state)
"\nBifCL: ${_bifcl_exe_path}" if (${state})
"\nBinPAC: ${_binpac_exe_path}" output_summary_line("${what}" "ON")
"\nBTest: ${INSTALL_BTEST}" else ()
"\nBTest tooling: ${_install_btest_tools_msg}" output_summary_line("${what}" "OFF")
"\nGen-ZAM: ${_gen_zam_exe_path}" endif ()
"\nJavaScript: ${ZEEK_HAVE_JAVASCRIPT}" endfunction ()
"\nSpicy: ${_spicy}"
"\nSpicy analyzers: ${USE_SPICY_ANALYZERS}" message("\n====================| Zeek Build Summary |====================\n")
"\nzeek-client: ${INSTALL_ZEEK_CLIENT}"
"\nZeekControl: ${INSTALL_ZEEKCTL}" output_summary_line("Build type" "${CMAKE_BUILD_TYPE}")
"\nzkg: ${INSTALL_ZKG}" output_summary_line("Build dir" "${PROJECT_BINARY_DIR}")
"\n" message("")
"\nlibmaxminddb: ${USE_GEOIP}"
"\nKerberos: ${USE_KRB5}" output_summary_line("Install prefix" "${CMAKE_INSTALL_PREFIX}")
"\ngperftools found: ${HAVE_PERFTOOLS}" output_summary_line("Config file dir" "${ZEEK_ETC_INSTALL_DIR}")
"\n - tcmalloc: ${USE_PERFTOOLS_TCMALLOC}" output_summary_line("Log dir" "${ZEEK_LOG_DIR}")
"\n - debugging: ${USE_PERFTOOLS_DEBUG}" output_summary_line("Plugin dir" "${ZEEK_PLUGIN_DIR}")
"\njemalloc: ${ENABLE_JEMALLOC}" output_summary_line("Python module dir" "${PY_MOD_INSTALL_DIR}")
"\n" output_summary_line("Script dir" "${ZEEK_SCRIPT_INSTALL_PATH}")
"\nCluster backends:" output_summary_line("Spool dir" "${ZEEK_SPOOL_DIR}")
"\n - Broker: ON" output_summary_line("State dir" "${ZEEK_STATE_DIR}")
"\n - ZeroMQ: ${ENABLE_CLUSTER_BACKEND_ZEROMQ}" output_summary_line("Spicy modules dir" "${ZEEK_SPICY_MODULE_PATH}")
"\n" message("")
"\nStorage backends:"
"\n - SQLite: ON" output_summary_state("Debug mode" ${ENABLE_DEBUG})
"\n - Redis: ${ENABLE_STORAGE_BACKEND_REDIS}" output_summary_state("Unit tests" ${ENABLE_ZEEK_UNIT_TESTS})
"\n" message("")
"\nFuzz Targets: ${ZEEK_ENABLE_FUZZERS}"
"\nFuzz Engine: ${ZEEK_FUZZING_ENGINE}" output_summary_line("Builtin Plugins" "${_zeek_builtin_plugins}")
"\n" message("")
"\nInclude What You Use: ${ENABLE_IWYU}"
"\nClang-Tidy: ${ENABLE_CLANG_TIDY}" output_summary_line("CC" "${CMAKE_C_COMPILER}")
"${_analyzer_warning}" output_summary_line("CFLAGS" "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}")
"\n" output_summary_line("CXX" "${CMAKE_CXX_COMPILER}")
"\n================================================================\n") output_summary_line("CXXFLAGS" "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}")
output_summary_line("CPP" "${CMAKE_CXX_COMPILER}")
message("")
output_summary_state("AF_PACKET" ${ZEEK_HAVE_AF_PACKET})
output_summary_state("Aux. Tools" ${INSTALL_AUX_TOOLS})
output_summary_line("BifCL" ${_bifcl_exe_path})
output_summary_line("BinPAC" ${_binpac_exe_path})
output_summary_state("BTest" ${INSTALL_BTEST})
output_summary_line("BTest tooling" ${_install_btest_tools_msg})
output_summary_line("Gen-ZAM" ${_gen_zam_exe_path})
output_summary_state("JavaScript" ${ZEEK_HAVE_JAVASCRIPT})
output_summary_line("Spicy" ${_spicy})
output_summary_state("Spicy analyzers" ${USE_SPICY_ANALYZERS})
output_summary_state("zeek-client" ${INSTALL_ZEEK_CLIENT})
output_summary_state("ZeekControl" ${INSTALL_ZEEKCTL})
output_summary_state("zkg" ${INSTALL_ZKG})
message("")
output_summary_state("libmaxminddb" ${USE_GEOIP})
output_summary_state("Kerberos" ${USE_KRB5})
output_summary_state("gperftools" ${HAVE_PERFTOOLS})
output_summary_state(" - tcmalloc" ${USE_PERFTOOLS_TCMALLOC})
output_summary_state(" - debugging" ${USE_PERFTOOLS_DEBUG})
output_summary_state("jemalloc" ${ENABLE_JEMALLOC})
message("")
output_summary_line("Cluster backends")
output_summary_state(" - Broker" ON)
output_summary_state(" - ZeroMQ" ${ENABLE_CLUSTER_BACKEND_ZEROMQ})
message("")
output_summary_line("Storage backends")
output_summary_state(" - SQLite" ON)
output_summary_state(" - Redis" ${ENABLE_STORAGE_BACKEND_REDIS})
message("")
output_summary_state("Fuzz Targets" ${ZEEK_ENABLE_FUZZERS})
output_summary_line("Fuzz Engine" "${_zeek_fuzzing_engine}")
message("")
output_summary_line("External Tools/Linters")
output_summary_state(" - Include What You Use" ${ENABLE_IWYU})
output_summary_state(" - Clang-Tidy" ${ENABLE_CLANG_TIDY})
if (${_analyzer_warning})
message("${_analyzer_warning}\n")
endif ()
message("\n================================================================")
include(UserChangedWarning) include(UserChangedWarning)

View file

@ -1 +1 @@
8.0.0-dev.294 8.0.0-dev.296