Skip to content
Snippets Groups Projects
CMakeLists.txt 2.74 KiB
Newer Older
kongr45gpen's avatar
kongr45gpen committed
cmake_minimum_required(VERSION 3.7)
kongr45gpen's avatar
kongr45gpen committed
project(ecss_services)

# Set C++ version to c++17
set(CMAKE_CXX_STANDARD 17)

# Specify the directories for #includes
include_directories("${PROJECT_SOURCE_DIR}/inc" "${PROJECT_SOURCE_DIR}/lib/etl/include"
        "${PROJECT_SOURCE_DIR}/lib/logger/inc")
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")

# Allow the user to set the ECSS Configuration directory using the -DECSS_CONFIGURATION=... command line argument
set(ECSS_CONFIGURATION "${PROJECT_SOURCE_DIR}/inc/Platform/x86" CACHE PATH
        "The include directory for the platform-specific ECSS configuration headers"
        )
include_directories(${ECSS_CONFIGURATION})

# Specify the .cpp files common across all targets
add_library(common OBJECT
        lib/logger/src/Logger.cpp
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/AllMessageTypes.cpp
kongr45gpen's avatar
kongr45gpen committed
# Specify the .cpp files for the executables
kongr45gpen's avatar
kongr45gpen committed
file(GLOB_RECURSE x86_main_SRC "src/Platform/x86/*.cpp" "lib/logger/src/Platform/x86/*.cpp")
add_executable(ecss_services
        $<TARGET_OBJECTS:common>
        ${x86_main_SRC}
# 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(ecss_services PUBLIC LOGLEVEL_TRACE)

thodkatz's avatar
thodkatz committed
IF (EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt")
    # Gather all the .cpp files corresponding to tests
kongr45gpen's avatar
kongr45gpen committed
    file(GLOB test_main_SRC "test/*.cpp")
    file(GLOB test_SRC "test/**/*.cpp")

thodkatz's avatar
thodkatz committed
    add_subdirectory(lib/Catch2)
    add_executable(tests
            $<TARGET_OBJECTS:common>
kongr45gpen's avatar
kongr45gpen committed
            ${test_main_SRC}
            ${test_SRC}
athatheo's avatar
athatheo committed
    target_link_libraries(tests Catch2::Catch2WithMain)
thodkatz's avatar
thodkatz committed
ENDIF ()