1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 01:35:35 +03:00

[CMAKE] Add support for having targets that are not part of the release

Add a SKIP_RELEASES target argument
This commit is contained in:
Alberto García Hierro 2020-08-10 10:43:05 +01:00
parent 77e3040523
commit bd490a52f3
16 changed files with 43 additions and 9 deletions

View file

@ -65,6 +65,11 @@ function(setup_firmware_target exe name)
set_property(GLOBAL PROPERTY VALID_TARGETS "${targets}") set_property(GLOBAL PROPERTY VALID_TARGETS "${targets}")
setup_openocd(${exe} ${name}) setup_openocd(${exe} ${name})
setup_svd(${exe} ${name}) setup_svd(${exe} ${name})
cmake_parse_arguments(args "SKIP_RELEASES" "" "" ${ARGN})
if(args_SKIP_RELEASES)
set_target_properties(${exe} ${name} PROPERTIES SKIP_RELEASES ON)
endif()
endfunction() endfunction()
function(exclude_from_all target) function(exclude_from_all target)
@ -77,11 +82,28 @@ endfunction()
function(collect_targets) function(collect_targets)
get_property(targets GLOBAL PROPERTY VALID_TARGETS) get_property(targets GLOBAL PROPERTY VALID_TARGETS)
list(SORT targets) list(SORT targets)
set(release_targets)
foreach(target ${targets})
get_target_property(skip_releases ${target} SKIP_RELEASES)
if(NOT skip_releases)
list(APPEND release_targets ${target})
endif()
endforeach()
list(JOIN targets " " target_names) list(JOIN targets " " target_names)
list(JOIN release_targets " " release_targets_names)
set(list_target_name "targets") set(list_target_name "targets")
add_custom_target(${list_target_name} add_custom_target(${list_target_name}
COMMAND cmake -E echo "Valid targets: ${target_names}") COMMAND ${CMAKE_COMMAND} -E echo "Valid targets: ${target_names}"
COMMAND ${CMAKE_COMMAND} -E echo "Release targets: ${release_targets_names}"
)
exclude_from_all(${list_target_name}) exclude_from_all(${list_target_name})
set(release_target_name "release")
add_custom_target(${release_target_name}
${CMAKE_COMMAND} -E true
DEPENDS ${release_targets}
)
list(LENGTH targets target_count) list(LENGTH targets target_count)
message("-- ${target_count} targets found for toolchain ${TOOLCHAIN}") message("-- ${target_count} targets found for toolchain ${TOOLCHAIN}")
endfunction() endfunction()

View file

@ -378,7 +378,7 @@ function(target_stm32)
set_property(TARGET ${main_target_name} PROPERTY OPENOCD_DEFAULT_INTERFACE stlink) set_property(TARGET ${main_target_name} PROPERTY OPENOCD_DEFAULT_INTERFACE stlink)
set_property(TARGET ${main_target_name} PROPERTY SVD ${args_SVD}) set_property(TARGET ${main_target_name} PROPERTY SVD ${args_SVD})
setup_firmware_target(${main_target_name} ${name}) setup_firmware_target(${main_target_name} ${name} ${ARGN})
if(args_BOOTLOADER) if(args_BOOTLOADER)
# Bootloader for the target # Bootloader for the target

View file

@ -106,6 +106,7 @@ endfunction()
macro(define_target_stm32f7 subfamily size) macro(define_target_stm32f7 subfamily size)
function(target_stm32f7${subfamily}x${size} name) function(target_stm32f7${subfamily}x${size} name)
set(func_ARGV ARGV)
string(TOUPPER ${size} upper_size) string(TOUPPER ${size} upper_size)
get_stm32_flash_size(flash_size ${size}) get_stm32_flash_size(flash_size ${size})
set(definitions set(definitions
@ -119,7 +120,7 @@ macro(define_target_stm32f7 subfamily size)
STARTUP startup_stm32f7${subfamily}xx.s STARTUP startup_stm32f7${subfamily}xx.s
COMPILE_DEFINITIONS ${definitions} COMPILE_DEFINITIONS ${definitions}
LINKER_SCRIPT stm32_flash_f7${subfamily}x${size} LINKER_SCRIPT stm32_flash_f7${subfamily}x${size}
${ARGN} ${${func_ARGV}}
) )
endfunction() endfunction()
endmacro() endmacro()

View file

@ -9,8 +9,8 @@ function(setup_svd target_exe target_name)
) )
else() else()
add_custom_target(${svd_target_name} add_custom_target(${svd_target_name}
cmake -E echo "target ${target_name} does not declare an SVD filename" ${CMAKE_COMMAND} -E echo "target ${target_name} does not declare an SVD filename"
COMMAND cmake -E false) COMMAND ${CMAKE_COMMAND} -E false)
endif() endif()
exclude_from_all(${svd_target_name}) exclude_from_all(${svd_target_name})
endfunction() endfunction()

View file

@ -0,0 +1 @@
target_stm32f303xc(ALIENFLIGHTF3 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f405xg(ALIENFLIGHTF4 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f722xe(ANYFCM7 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f303xc(CHEBUZZF3 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f303xc(COLIBRI_RACE SKIP_RELEASES)

View file

@ -1 +1 @@
target_stm32f405xg(FISHDRONEF4) target_stm32f405xg(FISHDRONEF4 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f303xc(KISSFC SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f405xg(KROOZX HSE_MHZ 16 SKIP_RELEASES)

View file

@ -1 +1 @@
target_stm32f303xc(OMNIBUS) target_stm32f303xc(OMNIBUS SKIP_RELEASES)

View file

@ -1,3 +1,3 @@
target_stm32f405xg(SPEEDYBEEF4) target_stm32f405xg(SPEEDYBEEF4)
target_stm32f405xg(SPEEDYBEEF4_SFTSRL1) target_stm32f405xg(SPEEDYBEEF4_SFTSRL1 SKIP_RELEASES)
target_stm32f405xg(SPEEDYBEEF4_SFTSRL2) target_stm32f405xg(SPEEDYBEEF4_SFTSRL2 SKIP_RELEASES)

View file

@ -0,0 +1 @@
target_stm32f303xc(SPRACINGF3NEO SKIP_RELEASES)

View file

@ -0,0 +1,3 @@
target_stm32f405xg(YUPIF4 SKIP_RELEASES)
target_stm32f405xg(YUPIF4MINI SKIP_RELEASES)
target_stm32f405xg(YUPIF4R2 SKIP_RELEASES)