Browse Source

Changed CMake warning to status to not kill the CI

Furthermore removed obsolete uavcanconfig target
master
Peter van der Perk 4 years ago committed by Daniel Agar
parent
commit
8df21b0b42
  1. 190
      cmake/kconfig.cmake
  2. 41
      src/drivers/uavcan_v1/CMakeLists.txt

190
cmake/kconfig.cmake

@ -4,7 +4,7 @@ set(BOARD_DEFCONFIG ${PX4_BOARD_DIR}/${PX4_BOARD_LABEL}-boardconfig CACHE FILEPA @@ -4,7 +4,7 @@ set(BOARD_DEFCONFIG ${PX4_BOARD_DIR}/${PX4_BOARD_LABEL}-boardconfig CACHE FILEPA
find_program(MENUCONFIG_PATH menuconfig)
find_program(GUICONFIG_PATH guiconfig)
if(NOT MENUCONFIG_PATH AND NOT GUICONFIG_PATH)
message(WARNING "kconfiglib is not installed\n"
message(STATUS "kconfiglib is not installed\n"
"please install using \"pip3 install kconfiglib\"\n")
endif()
@ -40,96 +40,98 @@ add_custom_target(boardguiconfig @@ -40,96 +40,98 @@ add_custom_target(boardguiconfig
COMMAND_EXPAND_LISTS
)
# parse board config options for cmake
file(STRINGS ${BOARD_DEFCONFIG} ConfigContents)
foreach(NameAndValue ${ConfigContents})
# Strip leading spaces
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
# Find variable name
string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue})
if(Name)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
if(Value)
# remove extra quotes
string(REPLACE "\"" "" Value ${Value})
# Set the variable
#message(STATUS "${Name} ${Value}")
set(${Name} ${Value} CACHE INTERNAL "BOARD DEFCONFIG: ${Name}" FORCE)
endif()
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_DRIVERS[^=]+" Drivers ${NameAndValue})
if(Drivers)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_DRIVERS_" "" driver ${Name})
string(TOLOWER ${driver} driver)
string(REPLACE "_" "/" driver_path ${driver})
# Pattern 1 XXX / XXX_XXX
string(REGEX REPLACE "(^[a-z]+)_([a-z]+_[a-z0-9]+).*$" "\\1" driver_p1_folder ${driver})
string(REGEX REPLACE "(^[a-z]+)_([a-z]+_[a-z0-9]+).*$" "\\2" driver_p1_subfolder ${driver})
# Pattern 2 XXX_XXX / XXXXXX
string(REGEX REPLACE "(^[a-z]+_[a-z]+)_([a-z0-9]+).*$" "\\1" driver_p2_folder ${driver})
string(REGEX REPLACE "(^[a-z]+_[a-z]+)_([a-z0-9]+).*$" "\\2" driver_p2_subfolder ${driver})
# Trick circumvent PX4 src naming problem with underscores and slashes
if(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver})
list(APPEND config_module_list drivers/${driver})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_path})
list(APPEND config_module_list drivers/${driver_path})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_p1_folder}/${driver_p1_subfolder})
list(APPEND config_module_list drivers/${driver_p1_folder}/${driver_p1_subfolder})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_p2_folder}/${driver_p2_subfolder})
list(APPEND config_module_list drivers/${driver_p2_folder}/${driver_p2_subfolder})
else()
message(FATAL_ERROR "Couldn't find path for ${driver}")
endif()
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_MODULES[^=]+" Modules ${NameAndValue})
if(Modules)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_MODULES_" "" module ${Name})
string(TOLOWER ${module} module)
list(APPEND config_module_list modules/${module})
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_SYSTEMCMDS[^=]+" Systemcmds ${NameAndValue})
if(Systemcmds)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_SYSTEMCMDS_" "" systemcmd ${Name})
string(TOLOWER ${systemcmd} systemcmd)
list(APPEND config_module_list systemcmds/${systemcmd})
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_EXAMPLES[^=]+" Examples ${NameAndValue})
if(Examples)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_EXAMPLES_" "" example ${Name})
string(TOLOWER ${example} example)
list(APPEND config_module_list examples/${example})
endif()
endforeach()
if(EXISTS ${BOARD_DEFCONFIG})
# parse board config options for cmake
file(STRINGS ${BOARD_DEFCONFIG} ConfigContents)
foreach(NameAndValue ${ConfigContents})
# Strip leading spaces
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
# Find variable name
string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue})
if(Name)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
if(Value)
# remove extra quotes
string(REPLACE "\"" "" Value ${Value})
# Set the variable
#message(STATUS "${Name} ${Value}")
set(${Name} ${Value} CACHE INTERNAL "BOARD DEFCONFIG: ${Name}" FORCE)
endif()
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_DRIVERS[^=]+" Drivers ${NameAndValue})
if(Drivers)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_DRIVERS_" "" driver ${Name})
string(TOLOWER ${driver} driver)
string(REPLACE "_" "/" driver_path ${driver})
# Pattern 1 XXX / XXX_XXX
string(REGEX REPLACE "(^[a-z]+)_([a-z]+_[a-z0-9]+).*$" "\\1" driver_p1_folder ${driver})
string(REGEX REPLACE "(^[a-z]+)_([a-z]+_[a-z0-9]+).*$" "\\2" driver_p1_subfolder ${driver})
# Pattern 2 XXX_XXX / XXXXXX
string(REGEX REPLACE "(^[a-z]+_[a-z]+)_([a-z0-9]+).*$" "\\1" driver_p2_folder ${driver})
string(REGEX REPLACE "(^[a-z]+_[a-z]+)_([a-z0-9]+).*$" "\\2" driver_p2_subfolder ${driver})
# Trick circumvent PX4 src naming problem with underscores and slashes
if(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver})
list(APPEND config_module_list drivers/${driver})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_path})
list(APPEND config_module_list drivers/${driver_path})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_p1_folder}/${driver_p1_subfolder})
list(APPEND config_module_list drivers/${driver_p1_folder}/${driver_p1_subfolder})
elseif(EXISTS ${PX4_SOURCE_DIR}/src/drivers/${driver_p2_folder}/${driver_p2_subfolder})
list(APPEND config_module_list drivers/${driver_p2_folder}/${driver_p2_subfolder})
else()
message(FATAL_ERROR "Couldn't find path for ${driver}")
endif()
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_MODULES[^=]+" Modules ${NameAndValue})
if(Modules)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_MODULES_" "" module ${Name})
string(TOLOWER ${module} module)
list(APPEND config_module_list modules/${module})
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_SYSTEMCMDS[^=]+" Systemcmds ${NameAndValue})
if(Systemcmds)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_SYSTEMCMDS_" "" systemcmd ${Name})
string(TOLOWER ${systemcmd} systemcmd)
list(APPEND config_module_list systemcmds/${systemcmd})
endif()
# Find variable name
string(REGEX MATCH "^CONFIG_EXAMPLES[^=]+" Examples ${NameAndValue})
if(Examples)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
string(REPLACE "CONFIG_EXAMPLES_" "" example ${Name})
string(TOLOWER ${example} example)
list(APPEND config_module_list examples/${example})
endif()
endforeach()
endif()

41
src/drivers/uavcan_v1/CMakeLists.txt

@ -31,8 +31,6 @@ @@ -31,8 +31,6 @@
#
############################################################################
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(DSDL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/public_regulated_data_types)
set(LEGACY_DSDL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/legacy_data_types)
@ -51,14 +49,6 @@ else() @@ -51,14 +49,6 @@ else()
message(FATAL_ERROR "UAVCAN Nunavut nnvg not found")
endif()
find_program(KCONFIG_PATH kconfig-mconf)
if(KCONFIG_PATH)
set(menuconfig ${KCONFIG_PATH})
else()
set(menuconfig "python3")
set(menuconfig_arg "${NUTTX_SRC_DIR}/tools/menuconfig.py")
endif()
set(SRCS)
if(${PX4_PLATFORM} MATCHES "nuttx")
if(CONFIG_NET_CAN)
@ -108,34 +98,3 @@ px4_add_module( @@ -108,34 +98,3 @@ px4_add_module(
git_legacy_data_types
version
)
# Use uavcanconfig file for compile definitions
if(EXISTS ${UAVCAN_DEFCONFIG})
file(STRINGS ${UAVCAN_DEFCONFIG} lines)
FOREACH(i IN LISTS lines)
if(i MATCHES "#")
else()
string(REPLACE "\n" "" i ${i})
SET(uavcan_config "${uavcan_config}${i};")
endif()
ENDFOREACH()
else()
file(TOUCH ${UAVCAN_DEFCONFIG} lines)
endif()
target_compile_definitions(drivers__uavcan_v1 PRIVATE ${uavcan_config})
# UAVCANv1 menuconfig + savedefconfig back to PX4
add_custom_target(uavcanconfig
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${UAVCAN_DEFCONFIG} ${CMAKE_CURRENT_SOURCE_DIR}/.config
COMMAND ${menuconfig} ${menuconfig_arg} Kconfig
COMMENT "Running UAVCAN make menuconfig for ${UAVCAN_DEFCONFIG}"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/.config ${UAVCAN_DEFCONFIG}
COMMENT "Saved config to ${UAVCAN_DEFCONFIG}"
COMMENT "Reconfiguring ${PX4_BINARY_DIR}"
COMMAND ${CMAKE_COMMAND} --clean ${PX4_BINARY_DIR}
USES_TERMINAL
)

Loading…
Cancel
Save