Skip to content
Snippets Groups Projects
CMakeLists.txt 2.59 KiB
Newer Older
cmake_minimum_required(VERSION 3.18)
kongr45gpen's avatar
kongr45gpen committed
project(ecss_services)
set(CMAKE_CXX_STANDARD 17)

find_package(etl CONFIG REQUIRED)
athatheo's avatar
athatheo committed
find_package(logger CONFIG REQUIRED COMPONENTS log_common log_x86)
kongr45gpen's avatar
kongr45gpen committed

add_custom_target(check
        COMMAND ./cppcheck.sh
        COMMAND ./clang-tidy.sh
        COMMAND ./cppcheck-misra.sh
        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/ci")

add_compile_options(-Wvla)
athatheo's avatar
athatheo committed
include_directories(${ECSS_CONFIGURATION})
add_library(common STATIC)
target_include_directories(common PUBLIC "${PROJECT_SOURCE_DIR}/inc/")
target_sources(common PRIVATE
kongr45gpen's avatar
kongr45gpen committed
        src/ErrorHandler.cpp
        src/Message.cpp
        src/MessageParser.cpp
Grigoris Pavlakis's avatar
Grigoris Pavlakis committed
        src/Helpers/CRCHelper.cpp
kongr45gpen's avatar
kongr45gpen committed
        src/Time/UTCTimestamp.cpp
        src/Services/EventReportService.cpp
        src/Services/MemoryManagementService.cpp
        src/Services/ParameterService.cpp
        src/Services/RequestVerificationService.cpp
        src/Services/TestService.cpp
        src/Services/EventActionService.cpp
        src/Services/FunctionManagementService.cpp
        src/Services/StorageAndRetrievalService.cpp
        src/Services/HousekeepingService.cpp
        src/Services/ParameterStatisticsService.cpp
        src/Services/OnBoardMonitoringService.cpp
        src/Services/RealTimeForwardingControlService.cpp
        src/Helpers/PMONBase.cpp
        src/Helpers/AllReportTypes.cpp
        src/Helpers/FilepathValidators.cpp
        src/Services/FileManagementService.cpp
athatheo's avatar
athatheo committed
target_link_libraries(common PRIVATE etl log_common log_x86)
kongr45gpen's avatar
kongr45gpen committed
# Specify the .cpp files for the executables
athatheo's avatar
athatheo committed
IF (X86_BUILD)
    file(GLOB_RECURSE x86_main_SRC "src/Platform/x86/*.cpp")
athatheo's avatar
athatheo committed
    add_executable(x86_services
            ${x86_main_SRC}
            )
    target_link_libraries(x86_services PRIVATE etl log_common log_x86 common)
athatheo's avatar
athatheo committed
    # Logs all levels of messages. This command can be added by other users of this
    # library to override the respective log level.
    target_compile_definitions(x86_services PUBLIC LOGLEVEL_TRACE)
athatheo's avatar
athatheo committed
    find_package(Catch2 CONFIG)
    IF(Catch2_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/test")
        file(GLOB test_main_SRC "test/*.cpp")
        file(GLOB test_SRC "test/**/*.cpp")
        add_executable(tests
                ${test_main_SRC}
athatheo's avatar
athatheo committed
        target_link_libraries(tests PRIVATE etl log_common log_x86 common Catch2::Catch2WithMain)
    ENDIF()
athatheo's avatar
athatheo committed
ENDIF()

install(TARGETS common)