update and apply afmt
Some checks failed
fsfw/fsfw example hosted/pipeline/head There was a failure building this commit
Some checks failed
fsfw/fsfw example hosted/pipeline/head There was a failure building this commit
This commit is contained in:
parent
da168b21ef
commit
ab047190be
@ -1,14 +1,14 @@
|
|||||||
################################################################################
|
# ##############################################################################
|
||||||
# CMake support for the Flight Software Framework
|
# CMake support for the Flight Software Framework
|
||||||
#
|
#
|
||||||
# Developed in an effort to replace Make with a modern build system.
|
# Developed in an effort to replace Make with a modern build system.
|
||||||
#
|
#
|
||||||
# Author: R. Mueller
|
# Author: R. Mueller
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Pre-Project preparation
|
# Pre-Project preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
# set(CMAKE_VERBOSE TRUE)
|
# set(CMAKE_VERBOSE TRUE)
|
||||||
@ -16,7 +16,9 @@ cmake_minimum_required(VERSION 3.13)
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL
|
||||||
|
host
|
||||||
|
CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
@ -28,9 +30,9 @@ if(OBSW_ENABLE_IPO)
|
|||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Specify the C++ standard
|
# Specify the C++ standard
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
@ -50,11 +52,8 @@ set(BSP_PATH "bsp_hosted")
|
|||||||
set(COMMON_CONFIG_PATH "${COMMON_PATH}/config")
|
set(COMMON_CONFIG_PATH "${COMMON_PATH}/config")
|
||||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||||
set(FSFW_ADDITIONAL_INC_PATHS
|
set(FSFW_ADDITIONAL_INC_PATHS
|
||||||
"${COMMON_CONFIG_PATH}"
|
"${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
CACHE STRING "FSFW configuration paths")
|
||||||
CACHE STRING
|
|
||||||
"FSFW configuration paths"
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
@ -63,13 +62,8 @@ configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
|||||||
set(FSFW_ADD_MONITORING ON)
|
set(FSFW_ADD_MONITORING ON)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(WARNING_FLAGS
|
set(WARNING_FLAGS -Wall -Wextra -Wimplicit-fallthrough=1
|
||||||
-Wall
|
-Wno-unused-parameter -Wno-psabi)
|
||||||
-Wextra
|
|
||||||
-Wimplicit-fallthrough=1
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Wno-psabi
|
|
||||||
)
|
|
||||||
|
|
||||||
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
|
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
@ -84,15 +78,15 @@ if(FSFW_OSAL MATCHES linux)
|
|||||||
else()
|
else()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ##############################################################################
|
||||||
################################################################################
|
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Add executable
|
# Add executable
|
||||||
add_executable(${TARGET_NAME})
|
add_executable(${TARGET_NAME})
|
||||||
@ -105,52 +99,40 @@ add_subdirectory(${BSP_PATH})
|
|||||||
add_subdirectory(${FSFW_PATH})
|
add_subdirectory(${FSFW_PATH})
|
||||||
add_subdirectory(${COMMON_PATH})
|
add_subdirectory(${COMMON_PATH})
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Post-Sources preparation
|
# Post-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Add libraries for all sources.
|
# Add libraries for all sources.
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(
|
||||||
${LIB_FSFW_NAME}
|
${TARGET_NAME} PRIVATE ${LIB_FSFW_NAME} ${LIB_OS_NAME}
|
||||||
${LIB_OS_NAME}
|
# ${LIB_FSFW_HAL_NAME}
|
||||||
# ${LIB_FSFW_HAL_NAME}
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths for all sources.
|
# Add include paths for all sources.
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR} ${FSFW_CONFIG_PATH})
|
||||||
${FSFW_CONFIG_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
target_link_options(${TARGET_NAME} PRIVATE "-Wl,-Map=${TARGET_NAME}.map")
|
||||||
"-Wl,-Map=${TARGET_NAME}.map"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Remove unused sections.
|
# Remove unused sections.
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
target_compile_options(${TARGET_NAME} PRIVATE "-ffunction-sections"
|
||||||
"-ffunction-sections"
|
"-fdata-sections")
|
||||||
"-fdata-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Removed unused sections.
|
# Removed unused sections.
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
target_link_options(${TARGET_NAME} PRIVATE "-Wl,--gc-sections")
|
||||||
"-Wl,--gc-sections"
|
|
||||||
)
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Compile options for all sources.
|
# Compile options for all sources.
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
target_compile_options(${TARGET_NAME} PRIVATE ${WARNING_FLAGS})
|
||||||
${WARNING_FLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT CMAKE_SIZE)
|
if(NOT CMAKE_SIZE)
|
||||||
set(CMAKE_SIZE size)
|
set(CMAKE_SIZE size)
|
||||||
@ -165,19 +147,15 @@ else()
|
|||||||
set(TARGET_STRING "Target BSP: Hosted")
|
set(TARGET_STRING "Target BSP: Hosted")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(CONCAT POST_BUILD_COMMENT
|
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
"Target OSAL: ${FSFW_OSAL}\n"
|
||||||
"Target OSAL: ${FSFW_OSAL}\n"
|
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
|
||||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
|
|
||||||
"${TARGET_STRING}"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${TARGET_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
||||||
COMMENT ${POST_BUILD_COMMENT}
|
COMMENT ${POST_BUILD_COMMENT})
|
||||||
)
|
|
||||||
|
|
||||||
include (BuildType)
|
include(BuildType)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
target_sources(${TARGET_NAME}
|
target_sources(${TARGET_NAME} PRIVATE main.cpp)
|
||||||
PRIVATE
|
|
||||||
main.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(fsfwconfig)
|
add_subdirectory(fsfwconfig)
|
||||||
add_subdirectory(utility)
|
add_subdirectory(utility)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME}
|
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
@ -1,5 +1 @@
|
|||||||
target_sources(${TARGET_NAME}
|
target_sources(${TARGET_NAME} PRIVATE InitMission.cpp ObjectFactory.cpp)
|
||||||
PRIVATE
|
|
||||||
InitMission.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
|
ObjectFactory::produceGenericObjects();
|
||||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||||
{
|
{
|
||||||
LocalPool::LocalPoolConfig poolCfg = {{16, 100}, {32, 50}, {64, 25}, {128, 15}, {1024, 5}};
|
LocalPool::LocalPoolConfig poolCfg = {{16, 100}, {32, 50}, {64, 25}, {128, 15}, {1024, 5}};
|
||||||
@ -62,6 +62,4 @@ void ObjectFactory::produce(void* args) {
|
|||||||
periodicEvent = true;
|
periodicEvent = true;
|
||||||
#endif
|
#endif
|
||||||
new FsfwTestTask(objects::TEST_TASK, periodicEvent);
|
new FsfwTestTask(objects::TEST_TASK, periodicEvent);
|
||||||
|
|
||||||
ObjectFactory::produceGenericObjects();
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,16 @@
|
|||||||
target_sources(${TARGET_NAME}
|
target_sources(
|
||||||
PRIVATE
|
${TARGET_NAME} PRIVATE ipc/missionMessageTypes.cpp
|
||||||
ipc/missionMessageTypes.cpp
|
pollingsequence/pollingSequenceFactory.cpp)
|
||||||
pollingsequence/pollingSequenceFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths for the executable
|
# Add include paths for the executable
|
||||||
target_include_directories(${TARGET_NAME}
|
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# If a special translation file for object IDs exists, compile it.
|
# If a special translation file for object IDs exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE objects/translateObjects.cpp)
|
||||||
objects/translateObjects.cpp
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If a special translation file for events exists, compile it.
|
# If a special translation file for events exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE events/translateEvents.cpp)
|
||||||
events/translateEvents.cpp
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,7 +1 @@
|
|||||||
target_sources(${TARGET_NAME}
|
target_sources(${TARGET_NAME} PUBLIC printChar.c)
|
||||||
PUBLIC
|
|
||||||
printChar.c
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e1aa39f5e4ccd7dc5694e2f5bffb5e3161778097
|
Subproject commit 21e998763671026bcc53e1df26acdd40e6589fd5
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 576414438c81b43d18ac0472c4baa8bc545f8d3f
|
Subproject commit d0fc360697e0fae7ccb4b827b8bc3d0398c342bc
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if [[ ! -f README.md ]]; then
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
|
|
||||||
find ./bsp_hosted -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
|
||||||
find ./example_common -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
|
32
scripts/auto-formatter.sh
Executable file
32
scripts/auto-formatter.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ ! -f README.md ]]; then
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
folder_list=(
|
||||||
|
"./bsp_hosted"
|
||||||
|
"./example_common"
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_fmt="cmake-format"
|
||||||
|
file_selectors="-iname CMakeLists.txt"
|
||||||
|
if command -v ${cmake_fmt} &> /dev/null; then
|
||||||
|
echo "Auto-formatting all CMakeLists.txt files"
|
||||||
|
${cmake_fmt} -i CMakeLists.txt
|
||||||
|
for dir in ${folder_list[@]}; do
|
||||||
|
find ${dir} ${file_selectors} | xargs ${cmake_fmt} -i
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cpp_format="clang-format"
|
||||||
|
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
|
||||||
|
if command -v ${cpp_format} &> /dev/null; then
|
||||||
|
for dir in ${folder_list[@]}; do
|
||||||
|
echo "Auto-formatting C/C++ files in ${dir} recursively"
|
||||||
|
find ${dir} ${file_selectors} | xargs ${cpp_format} --style=file -i
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user