This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
fsfw_example_public/bsp_stm32_freertos/STM32CubeH7/Drivers/BSP/STM32H7xx_HAL_Driver/CMakeLists.txt

107 lines
2.4 KiB
CMake

cmake_minimum_required(VERSION 3.13)
option(STM_HAL_GENERATE_SECTIONS
"Generate function and data sections. Required to remove unused code" ON
)
if(STM_HAL_GENERATE_SECTIONS)
option(STM_HAL_REMOVE_UNUSED_CODE "Remove unused code" ON)
endif()
set(LIB_STM_HAL_NAME stm_hal)
add_library(${LIB_STM_HAL_NAME})
target_sources(${LIB_STM_HAL_NAME} PRIVATE
Src/stm32h7xx_hal_gpio.c
Src/stm32h7xx_hal.c
Src/stm32h7xx_hal_cortex.c
Src/stm32h7xx_hal_tim.c
Src/stm32h7xx_hal_tim_ex.c
Src/stm32h7xx_hal_rcc.c
Src/stm32h7xx_hal_rcc_ex.c
Src/stm32h7xx_hal_flash.c
Src/stm32h7xx_hal_flash_ex.c
Src/stm32h7xx_hal_hsem.c
Src/stm32h7xx_hal_dma.c
Src/stm32h7xx_hal_dma_ex.c
Src/stm32h7xx_hal_mdma.c
Src/stm32h7xx_hal_pwr.c
Src/stm32h7xx_hal_pwr_ex.c
Src/stm32h7xx_hal_i2c.c
Src/stm32h7xx_hal_i2c_ex.c
Src/stm32h7xx_hal_uart.c
Src/stm32h7xx_hal_uart_ex.c
Src/stm32h7xx_hal_eth.c
Src/stm32h7xx_hal_adc.c
)
if(NOT STM_HAL_CONFIG_PATH)
message(WARNING
"STM HAL library configuration include path"
"STM_HAL_CONFIG_PATH not set!"
)
endif()
if(IS_ABSOLUTE ${STM_HAL_CONFIG_PATH})
set(STM_HAL_CONFIG_PATH_ABS "${STM_HAL_CONFIG_PATH}")
else()
get_filename_component(STM_HAL_CONFIG_PATH_ABS
${STM_HAL_CONFIG_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
)
endif()
if(NOT CMSIS_INC_PATH)
message(WARNING "No include path for CMSIS includes specified!")
endif()
if(IS_ABSOLUTE ${CMSIS_INC_PATH})
set(CMSIS_INC_PATH_ABS "${STM_HAL_CONFIG_PATH}")
else()
get_filename_component(CMSIS_INC_PATH_ABS
${CMSIS_INC_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
)
endif()
if(CMAKE_VERBOSE)
message(STATUS "STM HAL defines: ${STM_HAL_DEFINES}")
endif()
target_compile_definitions(${LIB_STM_HAL_NAME} PRIVATE
${STM_HAL_DEFINES}
)
target_include_directories(${LIB_STM_HAL_NAME} PRIVATE
"${STM_HAL_CONFIG_PATH_ABS}"
"${CMSIS_INC_PATH_ABS}"
Inc
)
target_include_directories(${LIB_STM_HAL_NAME} INTERFACE
"${STM_HAL_CONFIG_PATH_ABS}"
"${CMSIS_INC_PATH_ABS}"
Inc
)
target_compile_definitions(${LIB_STM_HAL_NAME} INTERFACE
${STM_HAL_DEFINES}
)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(STM_HAL_GENERATE_SECTIONS)
target_compile_options(${LIB_STM_HAL_NAME} PRIVATE
"-ffunction-sections"
"-fdata-sections"
)
endif()
if(STM_HAL_REMOVE_UNUSED_CODE)
target_link_options(${LIB_STM_HAL_NAME} PRIVATE
"Wl,--gc-sections"
)
endif()
endif()