UAVCANv1 menuconfig make it board label configurable

This commit is contained in:
Peter van der Perk 2021-03-10 19:02:51 +01:00 committed by Daniel Agar
parent b9bcb7fe7f
commit 55aa2e50ff
1 changed files with 13 additions and 9 deletions

View File

@ -31,7 +31,7 @@
# #
############################################################################ ############################################################################
set(UAVCAN_DEFCONFIG ${PX4_BOARD_DIR}/uavcanconfig CACHE FILEPATH "path to defconfig" FORCE) set(UAVCAN_DEFCONFIG ${PX4_BOARD_DIR}/${PX4_BOARD_LABEL}-uavcanconfig CACHE FILEPATH "path to defconfig" FORCE)
set(LIBCANARD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libcanard) set(LIBCANARD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libcanard)
set(DSDL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/public_regulated_data_types) set(DSDL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/public_regulated_data_types)
@ -111,15 +111,19 @@ px4_add_module(
# Use uavcanconfig file for compile definitions # Use uavcanconfig file for compile definitions
file(STRINGS ${UAVCAN_DEFCONFIG} lines) if(EXISTS ${UAVCAN_DEFCONFIG})
file(STRINGS ${UAVCAN_DEFCONFIG} lines)
FOREACH(i IN LISTS lines) FOREACH(i IN LISTS lines)
if(i MATCHES "#") if(i MATCHES "#")
else() else()
string(REPLACE "\n" "" i ${i}) string(REPLACE "\n" "" i ${i})
SET(uavcan_config "${uavcan_config}${i};") SET(uavcan_config "${uavcan_config}${i};")
endif() endif()
ENDFOREACH() ENDFOREACH()
else()
file(TOUCH ${UAVCAN_DEFCONFIG} lines)
endif()
target_compile_definitions(drivers__uavcan_v1 PRIVATE ${uavcan_config}) target_compile_definitions(drivers__uavcan_v1 PRIVATE ${uavcan_config})