added cmakelists.txt

This commit is contained in:
Robin Müller 2021-07-12 21:54:04 +02:00
parent e21175b260
commit 82671539a4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -20,7 +20,7 @@ if(NOT OS_FSFW)
endif()
# Project Name
project(fsfw-example-hosted C CXX)
project(fsfw-example-stm32h7-freertos ASM C CXX)
################################################################################
# Pre-Sources preparation
@ -40,7 +40,7 @@ set(FSFW_PATH fsfw)
set(COMMON_PATH example_common)
set(LIB_FSFW_HAL_PATH fsfw_hal)
set(BSP_PATH "bsp_hosted")
set(BSP_PATH "bsp_stm32h7_freertos")
set(COMMON_CONFIG_PATH "${COMMON_PATH}/config")
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
set(FSFW_ADDITIONAL_INC_PATHS
@ -70,18 +70,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(NOMINMAX)
endif()
if(${OS_FSFW} STREQUAL linux)
find_package(Threads REQUIRED)
# Hosted
else()
if(WIN32)
elseif(UNIX)
find_package(Threads REQUIRED)
endif()
endif()
################################################################################
# Executable and Sources
################################################################################
@ -104,8 +92,6 @@ add_subdirectory(${COMMON_PATH})
# Add libraries for all sources.
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_FSFW_NAME}
${LIB_OS_NAME}
# ${LIB_FSFW_HAL_NAME}
)
# Add include paths for all sources.
@ -146,13 +132,6 @@ target_compile_options(${TARGET_NAME} PRIVATE
${WARNING_FLAGS}
)
if(NOT CMAKE_SIZE)
set(CMAKE_SIZE size)
if(WIN32)
set(FILE_SUFFIX ".exe")
endif()
endif()
if(TGT_BSP)
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
else()
@ -165,13 +144,8 @@ string(CONCAT POST_BUILD_COMMENT
"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}
)
# TODO: Generate bin file with stm32-cmake command
# TODO: Print size with stm32-cmake command
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
set_build_type()