From 0907d5b6863804b195bf4234e30dc3645819d6f0 Mon Sep 17 00:00:00 2001 From: Neil Abcouwer Date: Thu, 30 Sep 2021 11:07:12 -0700 Subject: [PATCH 1/2] Allow removal of text loggers from build with CMake variable. Otherwise build fails if FW_ENABLE_TEXT_LOGGING == 0. --- Svc/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Svc/CMakeLists.txt b/Svc/CMakeLists.txt index 120f0eef82..79797778a1 100644 --- a/Svc/CMakeLists.txt +++ b/Svc/CMakeLists.txt @@ -11,7 +11,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/WatchDog/") # Components add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ActiveLogger/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ActiveTextLogger/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ActiveRateGroup/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AssertFatalAdapter/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/BufferManager/") @@ -31,7 +30,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GroundInterface/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Framer/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FramingProtocol/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Health/") -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PassiveConsoleTextLogger/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PolyDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PrmDb/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RateGroupDriver/") @@ -40,6 +38,13 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Time/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmPacketizer/") +# Allow and check for disabling of text loggers +# Building these fails if FW_ENABLE_TEXT_LOGGING == 0 +if (NOT FPRIME_DISABLE_TEXT_LOGGERS) + add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PassiveConsoleTextLogger/") + add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ActiveTextLogger/") +endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTime/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTimer/") From a6072c4a696ee9edbbe6bce79c64b0ac3d8ee2b5 Mon Sep 17 00:00:00 2001 From: Neil Abcouwer Date: Fri, 1 Oct 2021 16:10:05 -0700 Subject: [PATCH 2/2] Rework based on review comments. Made switch named in the positive, and added a default to cmake/Options.cmake. --- Svc/CMakeLists.txt | 6 +++--- cmake/Options.cmake | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Svc/CMakeLists.txt b/Svc/CMakeLists.txt index 79797778a1..28ac758cd3 100644 --- a/Svc/CMakeLists.txt +++ b/Svc/CMakeLists.txt @@ -38,9 +38,9 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Time/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmPacketizer/") -# Allow and check for disabling of text loggers -# Building these fails if FW_ENABLE_TEXT_LOGGING == 0 -if (NOT FPRIME_DISABLE_TEXT_LOGGERS) +# Text logger components included by default, +# but can be disabled if FW_ENABLE_TEXT_LOGGING=0 is desired. +if (FPRIME_ENABLE_TEXT_LOGGERS) add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PassiveConsoleTextLogger/") add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ActiveTextLogger/") endif() diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 4b688c26a5..07b7889ee7 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -114,6 +114,22 @@ else() string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE) endif() +#### +# `FPRIME_ENABLE_TEXT_LOGGERS:` +# +# When FPRIME_ENABLE_TEXT_LOGGERS is set, the ActiveTextLogger and PassiveConsoleTextLogger +# svc components are included in the build. When unset, those components are excluded, +# allowing FpConfig.hpp:FW_ENABLE_TEXT_LOGGING to be unset as well, to save space. +# TextLoggers will fail to build if FW_ENABLE_TEXT_LOGGING=0. +# +# **Values:** +# - ON: (default) retains the text logger components in the target list +# - OFF: removes text logger components from the target list +# +# e.g. `-DFPRIME_ENABLE_TEXT_LOGGERS=OFF` +#### +option(FPRIME_ENABLE_TEXT_LOGGERS "Enable text loggers in build" ON) + #### # `CMAKE_BUILD_TYPE:` #