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
|
||||
#
|
||||
#
|
||||
# Developed in an effort to replace Make with a modern build system.
|
||||
#
|
||||
#
|
||||
# Author: R. Mueller
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Pre-Project preparation
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
@ -16,7 +16,9 @@ cmake_minimum_required(VERSION 3.13)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
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()
|
||||
|
||||
# Project Name
|
||||
@ -28,9 +30,9 @@ if(OBSW_ENABLE_IPO)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Pre-Sources preparation
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@ -50,11 +52,8 @@ set(BSP_PATH "bsp_hosted")
|
||||
set(COMMON_CONFIG_PATH "${COMMON_PATH}/config")
|
||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||
set(FSFW_ADDITIONAL_INC_PATHS
|
||||
"${COMMON_CONFIG_PATH}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CACHE STRING
|
||||
"FSFW configuration paths"
|
||||
)
|
||||
"${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
CACHE STRING "FSFW configuration paths")
|
||||
|
||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.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)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(WARNING_FLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wimplicit-fallthrough=1
|
||||
-Wno-unused-parameter
|
||||
-Wno-psabi
|
||||
)
|
||||
set(WARNING_FLAGS -Wall -Wextra -Wimplicit-fallthrough=1
|
||||
-Wno-unused-parameter -Wno-psabi)
|
||||
|
||||
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
@ -84,15 +78,15 @@ if(FSFW_OSAL MATCHES linux)
|
||||
else()
|
||||
|
||||
if(WIN32)
|
||||
|
||||
elseif(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Executable and Sources
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
# Add executable
|
||||
add_executable(${TARGET_NAME})
|
||||
@ -105,52 +99,40 @@ add_subdirectory(${BSP_PATH})
|
||||
add_subdirectory(${FSFW_PATH})
|
||||
add_subdirectory(${COMMON_PATH})
|
||||
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
# Post-Sources preparation
|
||||
################################################################################
|
||||
# ##############################################################################
|
||||
|
||||
# Add libraries for all sources.
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_FSFW_NAME}
|
||||
${LIB_OS_NAME}
|
||||
# ${LIB_FSFW_HAL_NAME}
|
||||
)
|
||||
target_link_libraries(
|
||||
${TARGET_NAME} PRIVATE ${LIB_FSFW_NAME} ${LIB_OS_NAME}
|
||||
# ${LIB_FSFW_HAL_NAME}
|
||||
)
|
||||
|
||||
# Add include paths for all sources.
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${FSFW_CONFIG_PATH}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${FSFW_CONFIG_PATH})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
"-Wl,-Map=${TARGET_NAME}.map"
|
||||
)
|
||||
target_link_options(${TARGET_NAME} PRIVATE "-Wl,-Map=${TARGET_NAME}.map")
|
||||
|
||||
# Remove unused sections.
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
"-ffunction-sections"
|
||||
"-fdata-sections"
|
||||
)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE "-ffunction-sections"
|
||||
"-fdata-sections")
|
||||
|
||||
# Removed unused sections.
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
"-Wl,--gc-sections"
|
||||
)
|
||||
target_link_options(${TARGET_NAME} PRIVATE "-Wl,--gc-sections")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE)
|
||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||
endif()
|
||||
|
||||
|
||||
# Compile options for all sources.
|
||||
target_compile_options(${TARGET_NAME} PRIVATE
|
||||
${WARNING_FLAGS}
|
||||
)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE ${WARNING_FLAGS})
|
||||
|
||||
if(NOT CMAKE_SIZE)
|
||||
set(CMAKE_SIZE size)
|
||||
@ -165,19 +147,15 @@ else()
|
||||
set(TARGET_STRING "Target BSP: Hosted")
|
||||
endif()
|
||||
|
||||
string(CONCAT POST_BUILD_COMMENT
|
||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||
"Target OSAL: ${FSFW_OSAL}\n"
|
||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
|
||||
"${TARGET_STRING}"
|
||||
)
|
||||
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||
"Target OSAL: ${FSFW_OSAL}\n"
|
||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
||||
COMMENT ${POST_BUILD_COMMENT}
|
||||
)
|
||||
COMMENT ${POST_BUILD_COMMENT})
|
||||
|
||||
include (BuildType)
|
||||
include(BuildType)
|
||||
set_build_type()
|
||||
|
@ -1,13 +1,7 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE main.cpp)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(utility)
|
||||
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
@ -1,5 +1 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
InitMission.cpp
|
||||
ObjectFactory.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE InitMission.cpp ObjectFactory.cpp)
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
void ObjectFactory::produce(void* args) {
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
|
||||
ObjectFactory::produceGenericObjects();
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
{
|
||||
LocalPool::LocalPoolConfig poolCfg = {{16, 100}, {32, 50}, {64, 25}, {128, 15}, {1024, 5}};
|
||||
@ -62,6 +62,4 @@ void ObjectFactory::produce(void* args) {
|
||||
periodicEvent = true;
|
||||
#endif
|
||||
new FsfwTestTask(objects::TEST_TASK, periodicEvent);
|
||||
|
||||
ObjectFactory::produceGenericObjects();
|
||||
}
|
||||
|
@ -1,25 +1,16 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
ipc/missionMessageTypes.cpp
|
||||
pollingsequence/pollingSequenceFactory.cpp
|
||||
)
|
||||
target_sources(
|
||||
${TARGET_NAME} PRIVATE ipc/missionMessageTypes.cpp
|
||||
pollingsequence/pollingSequenceFactory.cpp)
|
||||
|
||||
# Add include paths for the executable
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# If a special translation file for object IDs exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
objects/translateObjects.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE objects/translateObjects.cpp)
|
||||
endif()
|
||||
|
||||
# If a special translation file for events exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
events/translateEvents.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE events/translateEvents.cpp)
|
||||
endif()
|
||||
|
@ -1,7 +1 @@
|
||||
target_sources(${TARGET_NAME}
|
||||
PUBLIC
|
||||
printChar.c
|
||||
)
|
||||
|
||||
|
||||
|
||||
target_sources(${TARGET_NAME} 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